$(function() {
		$("#accordion").accordion({
			autoHeight: false,
			collapsible: true
		});
		$(".accordionHeader:first").css('border-top', '1px solid #d3d3d3')
});


$(document).ready(function(){
	$('#testimonials').jcarousel({
		start:1,
		scroll:1,
		wrap:'both'
	});
       // set all input.text default value according to alt attribute
       $(":text").each(function(){
         $(this).val($(this).attr("alt"));
       });

       // clear input.text on focus, if still in default
       $(":text").focus(function() {

         if($(this).val()==$(this).attr("alt")) {
           $(this).val("");
         }
       });

       // if field is empty afterward, add text again
       $(":text").blur(function() {
         if($(this).val()=="") {
           $(this).val($(this).attr("alt"));
         }
       });

		
	
	
	//lightbox
	var windowWidth = $(window).width();
	var documentHeight = $(document).height();
	var windowHeight = $(window).height();
	
	$("#lightboxLink").click(function(){
		$("#overlay").height(windowHeight+"px");
		$("#overlay").show();
		
		var lightboxWidth = $(".lightbox").width();
		var lightboxHeight = $(".lightbox").height();
		
		$(".lightbox").css({'top': windowHeight/2-lightboxHeight/2 + "px", "left" : windowWidth/2-lightboxWidth/2 + "px"});
		$(".lightbox").show();
		
		$(window).resize(function(){
			windowWidth = $(window).width();
			windowHeight = $(window).height();
			
			$("#overlay").height(windowHeight+"px");
			$(".lightbox").css({'top': windowHeight/2-lightboxHeight/2 + "px", "left" : windowWidth/2-lightboxWidth/2 + "px"});
			
		});
		
	});
	
	$(".btnClose").click(function(){
		$("#overlay").hide();
		$(".lightbox").hide();
	});
		
});


