
var sIndex = 0;

var sImgTotal;

$(document).ready(function()
{


	$('#eventdate').focus(function()
	{
		//$(this).removeClass("formidle");
		//$(this).addClass("formfocus");
		
		if(this.value == this.defaultValue)
		{
			this.value = '';
		}
		if(this.value != this.defaultValue)
		{
			this.select();
		}
	});
	
	$('#eventdate').blur(function()
	{	
		if(this.value == '')
			{
				this.value = this.defaultValue;
			}		
	});

	
	var c = Math.floor(Math.random()*4);
	var i = 0;
	$('#slideshow img').each(function()
	{
	if(c == i)
		{			
			//$(this).css({'display' : 'block'});
		}
	i++;
	});		

	$('a:not(#thenav li a)').hover(function()
	{	
		$(this).animate({ color: '#ffffff'},150);
	},	
	function()
	{
		$(this).animate({color: '#ffabd5'},300);
	});
	

	$('#thenav li a:not(.selected)').hover(function()
	{
		$(this).animate({ backgroundColor: '#ffffff', color: 'black'},150);
	},	
	function()
	{
		$(this).animate({ backgroundColor: "#191919", color: '#ffabd5'},300);
	});	
	
	
	$('#link_prev').click(function()
		{
			tourPrev()
			return false;
		});
	$('#link_next').click(function()
		{
			tourNext()
			return false;
		});
	
	
	/*slideshow*/
	sImgTotal = $('#tour_slideshow').find('img').size();

	var sImg = $('#tour_slideshow').find('img')[sIndex];
	$(sImg).css('display','inline');

	
});

function tourNext()
	{	
		
	
	var cImg =  $('#tour_slideshow').find('img')[sIndex];

		$(cImg).fadeOut(300, function()	
		{
				
			sIndex++;		
			if(sIndex == sImgTotal)
			{
				sIndex = 0;			
			}		
			
			var nImg = $('#tour_slideshow').find('img')[sIndex];
			if($(nImg).attr('class') == "vertical")
				{				
				$(nImg).parent().animate({ width: "319px", marginLeft: "210px"},100);			
				} else {
				$(nImg).parent().animate({ width: "687px",  marginLeft: "0px"},100);
				}
			$(nImg).fadeIn(300);
		});
	return false;	
	
	}
function tourPrev()
	{	
		var cImg;
		var nImg;			
		
		cImg =  $('#tour_slideshow').find('img')[sIndex];
		
		$(cImg).fadeOut(300, function()	
		{	
			
			if(sIndex <= 0)
			{												
				sIndex = sImgTotal -1 ;											
			} else {			
				sIndex--;
			}
			
			var nImg = $('#tour_slideshow').find('img')[sIndex];
			
			if($(nImg).attr('class') == "vertical")
				{
				$(nImg).parent().animate({ width: "319px", marginLeft: "210px"},100);			
				} else {
				$(nImg).parent().animate({ width: "687px",  marginLeft: "0px"},100);
				}
			
			$(nImg).fadeIn(100);
			
			
		});		
	return false;
	}
	