var scrollable = null;
var pageWidth = 960;
var current = 0;
var speed = 250;

/////////////////////////////////////////////////////////////
$(document).ready(function() {
  if( $.fn.pngfix != null )			// This is required for the PNG fix to work.
    $("img[@src$=png]").pngfix();

  // This is some javascript to stop IE from displaying the img alt attributes
  // when you mouse over imagess.  If you would like IE to display the alt attributes,
  // just comment out the following 4 lines.  Don't worry, if you leave this in 
  // place, your ALT attributes are still readable by the search engines.
  var tmpalt;
  $("img").hover( 
    function(){ tmpalt = $(this).attr( "alt" ); $(this).attr( "alt", "" ); },
    function(){ $(this).attr( "alt", tmpalt ); });

	checkVersion();
	
	//setup custom scrollbars...
//	$('.text').jScrollPane();
	
	// Setup effects such as fades and round corners...
   $('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});

	$("#navbar ul li").fadeTo(0, .33);
	$("#navbar ul li:eq(0)").fadeTo(0, 100);

	if ($.browser.msie())
	{
		$("#u2fez").fadeTo(0, .33);
		$(".page .background").fadeTo(0, .75);
	}
	else
	{
		$("#vertigo_tour_lights").corner();
		$("#header").corner("top");
		$("#footer").corner("bottom");
		$("#u2fez").corner("bottom").fadeTo(0, .33);
		$(".page .background").corner().fadeTo(0, .75);
		$(".page").corner();
	}

	$("#navbar").fadeIn(3000);
	setTimeout(function() { $("#headers").fadeIn(3000) }, 500);

	// Google Analytics Setup...
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-13211890-1']);
	_gaq.push(['_trackPageview']);
			  
	(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();
	
//	roundCorners();
});

/////////////////////////////////////////////////////////////
function roundCorners()
{
	$('#main').corner("round 15px");
}

/////////////////////////////////////////////////////////////
function showHome()
{
	$('#headers div').hide();
	$('#content div').hide();
	$('#_home').show();
	$('#_homeHdr').show();
//	$("#_homeHdr").dropShadow();
}

/////////////////////////////////////////////////////////////
function showAbout()
{
	$('#headers div').hide();
	$('#content div').hide();
	$('#_about').show();
	$('#_aboutHdr').show();
//	$("#_aboutHdr").dropShadow();
}

/////////////////////////////////////////////////////////////
function showTour()
{
	$('#headers div').hide();
	$('#content div').hide();
	$('#_tourHdr').show();
	$('#_tour').show();
//	$("#_tourHdr").dropShadow();
}

/////////////////////////////////////////////////////////////
function showNews()
{
	$('#headers div').hide();
	$('#content div').hide();
	$('#_newsHdr').show();
	$('#_news').show();
//	$("#_newsHdr").dropShadow();
}

/////////////////////////////////////////////////////////////
function showMedia()
{
	$('#headers div').hide();
	$('#content div').hide();
	$('#_mediaHdr').show();
	$('#_media').show();
//	$("#_mediaHdr").dropShadow();

}

/////////////////////////////////////////////////////////////
function showContact()
{
	$('#headers div').hide();
	$('#content div').hide();
	$('#_contactHdr').show();
	$('#_contact').show();
//	$("#_contactHdr").dropShadow();
}

/////////////////////////////////////////////////////////////
function showLinks()
{
	$('#headers div').hide();
	$('#content div').hide();
	$('#_linksHdr').show();
	$('#_links').show();
//	$("#_linksHdr").dropShadow();
//	$("#thelinks").dropShadow();
}

/////////////////////////////////////////////////////////////
function showEPK()
{
	$('#headers div').hide();
	$('#content div').hide();
	$('#_epkHdr').show();
	$('#_epk').show();
//	$("#_epkHdr").dropShadow();
}

/////////////////////////////////////////////////////////////
function getInternetExplorerVersion()
// Returns the version of Windows Internet Explorer or a -1
// (indicating the use of another browser).
{
   var rv = -1; // Return value assumes failure.
   if (navigator.appName == 'Microsoft Internet Explorer')
   {
      var ua = navigator.userAgent;
      var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
      if (re.exec(ua) != null)
         rv = parseFloat( RegExp.$1 );
   }
   return rv;
}

/////////////////////////////////////////////////////////////
function checkVersion()
{
   var ver = getInternetExplorerVersion();
   $("#browser_error").hide();
   if ( ver > -1 )
   {
      if ( ver>= 8.0 )
         $("#browser_error").hide()
      else
         $("#browser_error").show()
    }
}

/////////////////////////////////////////////////////////////
function gotoPage(i)
{
	if (scrollable == null) scrollable = $("#scrollable");
	scrollable.animate({ left: -(i * pageWidth) }, speed * Math.abs(current - i), "easeOutCubic");
	current = i;

	$('#headers div').hide();
	$("#navbar ul li").fadeTo(0, .33);
	$('#_media div object').hide();

	switch (i)
	{
		case 0:
			$('#_homeHdr').show();
//			$("#_homeHdr").dropShadow();
			$("#navbar ul li:eq(0)").fadeTo(0, 100);
			break;
		case 1:
			$('#_mediaHdr').show();
//			$("#_mediaHdr").dropShadow();
			$("#navbar ul li:eq(1)").fadeTo(0, 100);
			$('#_media div object').show();
			break;
		case 2:
			$('#_tourHdr').show();
//			$("#_tourHdr").dropShadow();
			$("#navbar ul li:eq(2)").fadeTo(0, 100);
			break;
		case 3:
			$('#_newsHdr').show();
//			$("#_newsHdr").dropShadow();
			$("#navbar ul li:eq(3)").fadeTo(0, 100);
			break;
		case 4:
			$('#_linksHdr').show();
//			$("#_linksHdr").dropShadow();
			$("#navbar ul li:eq(4)").fadeTo(0, 100);
			break;
		case 5:
			$('#_aboutHdr').show();
//			$("#_aboutHdr").dropShadow();
			$("#navbar ul li:eq(5)").fadeTo(0, 100);
			break;
		case 6:
//			$('#_contactHdr').show();
//			$("#_contactHdr").dropShadow();
//			$("#navbar ul li:eq(6)").fadeTo(0, 100);
//			break;
//		case 7:
			$('#_epkHdr').show();
//			$("#_epkHdr").dropShadow();
			$("#navbar ul li:eq(7)").fadeTo(0, 100);
			break;
	}
}

/////////////////////////////////////////////////////////////

