	/******************************************************************************************************
	(C) www.turkmenyolu.com, June 2008
	
	This is a script from www.turkmenyolu.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.turkmenyolu.com
	Yilmaz Towfeek
	
	*******************************************************************************************************/	

   var npNews = false;
   var npCurrent = -1;
   var npPagination = false;
   var npActiveLink = false;
	var opacitySpeed = 1;	// Speed of opacity - switching between large images - Lower = faster
	var opacitySteps = 20; 	// Also speed of opacity - Higher = faster
	var slideSpeed = 5000;	// Speed of news slide - Lower = faster
	var npPhoto = false;
	var npCurrentOpacity = 100;
   var npTimeOut;
   var npStopped = false;
	
	function initPanorama() {
      npPhoto = document.getElementById('npPhoto').getElementsByTagName('IMG')[0];
		npPagination = document.getElementById('npPagination');
		npBrief = document.getElementById('npBrief');
   } /* initPanorama */
	
   function selectNews(ind) {
      window.location = npNews[ind][1];
      return false;
   } // selectNews

	function previewNews(ind) {		
		if (npCurrent == ind)
         return;
      npBrief.innerHTML = npNews[ind][4];
      if (npCurrent != -1)
         npActiveLink.className = '';
		npActiveLink = npPagination.getElementsByTagName('A')[ind];
      npActiveLink.className = 'selected';
      npCurrent = ind;
      changeImage();
	} /* previewNews */

   function changeImage() {
      var tmpParent = npPhoto.parentNode; 
      npPhoto.parentNode.removeChild(npPhoto);
      npPhoto = document.createElement('IMG');
      tmpParent.appendChild(npPhoto);
	  npPhoto.src = npNews[npCurrent][0];
      npPhoto.width = 150;
      npPhoto.style.width = npPhoto.width+'px';
      npPhoto.height = 200;
      npPhoto.style.height = npPhoto.height+'px';
      npPhoto.style.marginTop = Math.round((220-npPhoto.height)/2)+'px';
      npPhoto.onclick = function() {selectNews(npCurrent);};
      npPhoto.onmouseout = function() {startSliding(false);};
      npPhoto.onmouseover = function() {stopSliding();};
   } /* changeImage */
	
	function slideImages(showNext) {
      if (npStopped)
         return ;
      if (showNext) {
         if (npCurrent+1 >= npNews.length)
            previewNews(0);
         else
            previewNews(npCurrent+1);
      }
      npTimeOut = setTimeout("slideImages(true)", slideSpeed);
	} /* slideImages */
	
	function stopSliding() {
      if (npStopped)
         return ;
      npStopped = true;
      clearTimeout(npTimeOut);
	} /* stopSliding */
	
	function startSliding(showNext) {
      npStopped = false;
      slideImages(showNext);
	} /* startSliding */


