// JavaScript Document

$(document).ready(function(){
	
//	alert($(".focushide").length)
	var v1= new Array();
	for(i=0;i<$(".focushide").length;i++)
	{
		if($($(".focushide").get(i)).is("input") && (( $($(".focushide").get(i)).attr("type")=="text")||($($(".focushide").get(i)).attr("type")=="password")))
		{
			
			v1.push($($(".focushide").get(i)).attr("value"));
			
		}
		else
		{
			if($($(".focushide").get(i)).is("textarea"))
			{
				v1.push($($(".focushide").get(i)).text());
			}
			else
			{
				//v="";
			}
			
		}	
		
	}
		
	
	
   $(".focushide").focus(function(){
		
		if($(this).is("input") &&  ($(this).attr("type")=="text")||($(this).attr("type")=="password"))
		{
			v=$(this).attr("value");			
		}
		else
		{
			if($(this).is("textarea"))
			{
				v=$(this).val();
			}
			else
			{
				v="";
			}			
		}
		
		j=$(".focushide").index(this);
		
		//setTimeout(function(){alert(v)},1000);
		
		if(v==v1[j])
		{	
			$(this).attr("value","");
		}
		
		
	});
   
   
    $(".focushide").blur(function(){
		k=$(".focushide").index(this);
		//alert(v1[k]);
		if($(this).attr("value")=="")
		{			
			$(this).attr("value",v1[k]);
		}
				
	});
	
	
	
	
	$(".navigation a").hover(function(){
									
			$(this).parent().css("z-index",3000);					
		},
		function(){
			$(this).parent().attr("style","");						
		}
	);
	
$('.transparent').ifixpng();
carousel();
//$('.zoom').fancyzoom();
	
});



speed=4000;
c=0;
n=0;

function carousel()
{
	
	slideCount=$(".slide_container .slide").length;
	slideW=$(".slide_container .slide").width();
	//alert(slideW);
	
	$(".slide_container").css("width",slideCount*slideW);
	banner_move(c);

	
	$(".rightarrow").click(function(){
		clearTimeout(n);
		if(c<$(".slide").length-1)
			c++;
		else
			c=0;
		
		banner_move(c);
				
	});
	
	$(".leftarrow").click(function(){
		clearTimeout(n);
		if(c>0)
			c--;
		else
			c=$(".slide").length-1;
		
		banner_move(c);
				
	});
	
	
	$(".dotpanel ul li").click(function(){
			ind=$(".dotpanel ul li").index(this);
			//alert(ind);
			
			clearTimeout(n);
			c=ind;
			banner_move(c);
					
		});
}
function banner_move(c)
{
	l=-1*c*$(".slide").width();
	
	
	$(".dotpanel ul li.active").attr("class","inactive");
	$($(".dotpanel ul>li").get(c)).attr("class","active");
	$(".slide_container").animate({
		left:l
	});
	
	
	if(c<$(".slide").length-1)
		c++;
	else
		c=0;
	n=setTimeout(banner_move,speed,c);
}

function addPhotosBox()
{
	$(".addPhotosBox").show();
}

function hidePhotosBox()
{
	$(".addPhotosBox").hide();
}
