// JavaScript Document
$(document).ready(function(){
	// Use this example, or...
	//$('a[href~="project-locations"]').fancybox(); // Select all links that contains lightbox in the attribute rel
	
	//$('a[href~="jpg"]').fancybox(); // Select all links that contains lightbox in the attribute rel
	
	// Use this example, or...
	$('a[href~="jpg"]').each(function(){
		$(this).lightBox({imageLoading: '/images/lightbox/lightbox-ico-loading.gif',
		imageBtnClose: '/images/lightbox/lightbox-btn-close.gif',
		imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif',
		imageBtnNext: '/images/lightbox/lightbox-btn-next.gif',
		containerResizeSpeed: 350
		});/**/ // Select all links that contains lightbox in the attribute rel
	});
	
	$('a[href~="gif"]').lightBox({imageLoading: '/images/lightbox/lightbox-ico-loading.gif',
	imageBtnClose: '/images/lightbox/lightbox-btn-close.gif',
	imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif',
	imageBtnNext: '/images/lightbox/lightbox-btn-next.gif',
	containerResizeSpeed: 350
	}); // Select all links that contains lightbox in the attribute rel
	
	$('a[href~="png"]').lightBox({imageLoading: '/images/lightbox/lightbox-ico-loading.gif',
	imageBtnClose: '/images/lightbox/lightbox-btn-close.gif',
	imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif',
	imageBtnNext: '/images/lightbox/lightbox-btn-next.gif',
	containerResizeSpeed: 350
	}); // Select all links that contains lightbox in the attribute rel
	
	$('a.movie').lightBox({imageLoading: '/images/lightbox/lightbox-ico-loading.gif',
	imageBtnClose: '/images/lightbox/lightbox-btn-close.gif',
	imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif',
	imageBtnNext: '/images/lightbox/lightbox-btn-next.gif',
	containerResizeSpeed: 350
	}); // Select all links that contains lightbox in the attribute rel
	$('.media a[href~="pdf"],.standard .main-content a[href~="pdf"]').addClass("pdf").parent().css("padding-bottom","5px");
	$('.our-services a img').parent().css("background-image","none").css("padding-left","0px").css("padding-top","10px");
	$("div.scrollable").scrollable({
		size: 9,
		items: '#thumbs',  
		hoverClass: 'hover'
	});
	var api = $("div.scrollable").scrollable(); 
	$("div.scrollable").hover(function(){},function(){$(this).find("div.hide").fadeOut("fast");});
	$("a.year").hover(function(e){
							 if ($(this).parent().find("div.hide").css("display") != 'block'){
								   $(this).parent().parent().find("div.hide").fadeOut("fast");
							  		newheight = $(this).parent().height();
								  $(this).parent().parent().parent().css("height",(newheight + 250)+"px");
								  $(this).parent().find("div.hide").fadeIn("fast");
								 }
							  e.preventDefault();
							   },
						function(e){
							  e.preventDefault();
							   });
	
	if ($('.video ul li')){
			$('.video .more').click(function(e){
				$('#news_reel').scrollTo('+=274px', 800);
				e.preventDefault();
			});
			$('.video .less').click(function(e){
				$('#news_reel').scrollTo("-=274px",800);
				e.preventDefault();
			});
						
	}/**/
	
	$("#profile-info").click(function(){
		if ($("#profile-info").css("display") == 'block'){
			$(this).stop().fadeOut("fast",function(){$("#profile-info").css("display","none");});
		}
	});
	$("#Map area").click(function(e){
		href = $(this).attr("href").split("/");
		href = href[(href.length-1)];
		if ($("#profile-info").css("display") != 'block'){
				$("#profile-info").html($("#"+href).html());
				$("#profile-info").fadeIn("fast");
		}else{
			$("#profile-info").fadeOut("fast",function(){
				$("#profile-info").html($("#"+href).html()).fadeIn("fast");			
			});
		}
		e.preventDefault();
	});
	
	$("#newsletter-subscribe #name").focus(function(){
		if ($(this).val() == 'Name'){
			$(this).val("");
		}
	});
	$("#newsletter-subscribe #name").blur(function(){
		if ($(this).val() == ''){
			$(this).val("Name");
		}
	});
	$("#newsletter-subscribe #email").focus(function(){
		if ($(this).val() == 'Email'){
			$(this).val("");
		}
	});
	$("#newsletter-subscribe #email").blur(function(){
		if ($(this).val() == ''){
			$(this).val("Email");
		}
	});
	
	$("#newsletter-subscribe #btn-subscribe").click(function(e){
		if ($("#newsletter-subscribe #name").val() != 'Name' && $("#newsletter-subscribe #email").val() != 'Email'){
			$("#btn-subscribe").submit();	
		}
		
		e.preventDefault();
		
	});

	/*$("div.scrollable").scrollable({
		size: 10,
		items: '.item',  
		hoverClass: 'hover'
	});
	var api = $("div.scrollable").scrollable(); 
	$("div.scrollable").hover(function(){},function(){$(this).find("div.item div").fadeOut("fast");});
	$("a.year").hover(function(e){
							  $(this).parent().parent().find("div.item div").fadeOut("fast");
							  if ($(this).parent().find("div.item div").css("display") != 'block'){
								  newheight = $(this).parent().height();
								  $(this).parent().parent().parent().css("height",(newheight + 250)+"px");
								  $(this).parent().find("div.item div").fadeIn("fast");
								 }
							  e.preventDefault();
							   },
						function(e){
							  e.preventDefault();
							   });*/
	
});	
