// 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")
		{
			
			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")
		{
			v=$(this).attr("value");
			
		}
		else
		{
			if($(this).is("textarea"))
			{
				v=$(this).text();
			}
			else
			{
				v="";
			}
			
		}
		
		j=$(".focushide").index(this);
		
		
		
		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]);
		}
				
	});
	
	$(".writeus_button:reset").click(function(){
			
		for(i=0;i<$(".focushide").length;i++)
		{
			$($(".focushide").get(i)).attr("value",v1[i]);
			
		}
		
	});
	
	
	
	
	

	$('.transparent').ifixpng();
	
	carousel(0);
	
	setSocial();
	
	
//	window.onload=fixedMenu.init;
	
});


function carousel(n)
{
	
$(".carousel .slide").hide();
	$($(".carousel .slide").get(n)).fadeIn(500,function(){  
		
		
		if(n>=$(".carousel .slide").length-1)
		n=0;
		timeout=setTimeout(function(){
				$($(".carousel .slide").get(n)).fadeOut(500,function(){carousel(n+1)});
		},2000);	
		
	});
	
}

function setSocial()
{
/*	$(window).scroll(function(){
								 
		$(".social_icons").css("top",$(window).scrollTop()+$(window).height()/2-$(".social_icons").height()/2);
	});*/


	var offset = $(".social_icons").offset();
            var topPadding = 150;
            $(window).scroll(function() {
                if ($(window).scrollTop() > offset.top) {
                    $(".social_icons").stop().animate({
                        marginTop: $(window).scrollTop() - offset.top + topPadding
                    },1000);
                } else {
                    $(".social_icons").stop().animate({
                        marginTop: 0
                    });
                };
            });
}


