/**
 * @author Attila Kovács <attila.kovacs@travelgold.hu>
 */

/**
 * Function to initialize the horizontal carousel
 */

  function runTest() {
    hCarousel = new UI.Carousel("horizontal_carousel");
  }
  

 /**
  * Functions of the SEO friendly "perfect popup"
  */
  function findPopUps()
  {
    var popups = document.getElementsByTagName("a");
    for(i = 0; i < popups.length; i++)
    {
      if(popups[i].rel.indexOf("popup")!=-1)
      {
        popups[i].onclick = openGallery;
      }
    }
  }

  function openGallery(e)
  {
	  window.open(this.href, 'image','location=0,width=870,height=630,toolbar=0,resizable=0');
    if (window.event) 
	  {
	    window.event.returnValue = false;
  	  window.event.cancelBubble = true;
	  } 
    else if (e) 
	  {
  	  e.stopPropagation();
	    e.preventDefault();
  	}
  }


/**
 * Functions to change the paging images in the gallery.
 */
  function imgchange(type)
  {
    if(type == "next")
    {
      $('nextimg').src="/gfx2/arrow-right.png";
    }
    else if (type == "prev")
    {
      $('previmg').src="/gfx2/arrow-left.png";
    }
  }
  
  function imgreset(type)
  {
    if(type == "next")
    {
      $('nextimg').src="/gfx2/x.gif";
    }
    else if (type == "prev")
    {
      $('previmg').src="/gfx2/x.gif";
    }
    
  }
