/* Author: SillyBrandz Global, LLC | Verso Group | Dynamic Design | Sarah Womack

*/

$(document).ready(function(){

$("#next").hover(function(){
	$(this).animate({"right": "-=15px"}, "slow");
},function(){
	$(this).animate({"right": "+=15px"}, "slow");
});

$("#prev").hover(function(){
	$(this).animate({"left": "-=15px"}, "slow");
},function(){
	$(this).animate({"left": "+=15px"}, "slow");
});
	
$("#gallery li").hover(function(){
	$(this).find(".item-title").animate({
		"height": "+=25px",
		"margin-top" : "-=25px"
	}, "slow");
},function(){
	$(this).find(".item-title").animate({
		"height": "6px",
		"margin-top": "+=25px"
	}, "slow");
});
	

var galleryThumb = new Array();

$("#gallery li").each(function(){
	galleryThumb.push($(this));
});

$("#services li").click(function() {
	var target = $(this);
	for (x=0; x<galleryThumb.length; x++){
		if(target.attr("class")==galleryThumb[x].attr("class")){
			$(galleryThumb[x]).css({"z-index": "400"});
			$(galleryThumb[x]).find("img").css({"display": "block"});	
			$(galleryThumb[x]).addClass("thumbactive");
			galleryThumb[x].animate({
				"margin" : "0px 10px 30px 0",
				"width": "180px",
				"height": "180px",
				"display": "block",
				"padding": "0px"
			}, "slow");
			galleryThumb[x].fadeIn("slow");	
					
		}
		else {
			$(galleryThumb[x]).removeClass("thumbactive");
			galleryThumb[x].animate({
				"width": "0px",
				"height": "0px",
				"padding": "0px",
				"margin" : "0px",
				"display": "none"
			}, "fast");
			$(galleryThumb[x]).find("img").css({
				"z-index": "10",
				"display": "none"
			});
		}
	}
});

$(".see-all").click(function(){
	$("#gallery li").removeClass("thumbactive");
	$("#gallery li").animate({
		"margin" : "0px 10px 30px 0",
		"width": "180px",
		"height": "180px",
		"display": "block",
		"padding": "0px"
	}, "slow");	
	$("#gallery li").fadeIn('slow');
	$("#gallery li").find('img').css({'display': 'block'});
});
	
	
 $("#gallery li").hover(function(){
	 if ($("#gallery li").hasClass('thumbactive')==true){
		$(function(){
			$('.print-media a').lightBox({fixedNavigation:true});
			$('.screenprint a').lightBox({fixedNavigation:true});
			$('.vehicle-wrap a').lightBox({fixedNavigation:true});
			$('.large-graphics a').lightBox({fixedNavigation:true});
		});
	 }
	 else {
		 $(function(){
			$('#gallery li a').lightBox({fixedNavigation:true});
		});
	 }
  });
  	


//which sectionlink was clicked? take it's .attr("class"), simulate click on gallery page's typeButton hasClass (sectionlink[x].attr("class"))

var typeButton = new Array();
$("#services li").each(function(){
	typeButton.push($(this));
});

var sectionlink = new Array();
$("#home-section-links div").each(function(){
	sectionlink.push($(this));
});


$("#home-section-links div").click(function(){
	document.location.href = '/test/dynamic-design/gallery/index.html';

});

/*$("#home-section-links div").click(function(){
	targetClass = $(this).attr("class");
	var target = targetClass.split(' ')[1];
	
	alert ("target is " + target);
	
	document.location.href = '/test/dynamic-design/gallery/index.html';
	
	alert ('on the page');
	
	for (x=0; x<typeButton.length; x++){
		if (targetClass==typeButton[x].attr("class")) {
			alert ('in 2nd function');
				
			$(typeButton[x]).trigger('click');
		}
		else {
		
		}
	}

});*/
	
swap_val = [];  
$(".swap").each(function(i){  
	swap_val[i] = $(this).val();  
	$(this).focusin(function(){  
			if ($(this).val() == swap_val[i]) {  
					$(this).val("");  
				}  
		}).focusout(function(){  
	if ($.trim($(this).val()) == "") {  
			$(this).val(swap_val[i]);  
		}  
	});  
});  
	
	
	
	
	
	
	
	
//end of document ready function
});






















