// ============================================== //
// ======== PRE-LOAD IMAGES ======== //
// ============================================== //
jQuery(document).ready(function() {
	/*for (i = 1; i < 5; i++) {
		imagePreL = new Image();
		imagePreL.src = "http://benpaddockdesign.com/wp-content/themes/benpaddockdesign/images/bg_main_" + i + ".jpg"
	}*/
});


// ============================================== //
// ======== PORTFOLIO LIST FILTER======== //
// ============================================== //
jQuery(document).ready(function() {
	jQuery("#show_all").addClass("selected");
	jQuery("#show_all").click (
		function() {
			jQuery(".category-web").show();
			jQuery(".category-print").show();
			jQuery("#filter li").removeClass("selected");
			jQuery(this).addClass("selected");
		}
	);	
	jQuery("#show_interactive").click (
		function() {
			jQuery(".category-web").show();
			jQuery(".category-print").hide();
			jQuery("#filter li").removeClass("selected");
			jQuery(this).addClass("selected");
		}
	);	
	jQuery("#show_print").click (
		function() {
			jQuery(".category-web").hide();
			jQuery(".category-print").show();
			jQuery("#filter li").removeClass("selected");
			jQuery(this).addClass("selected");
		}
	);	
});



// ============================================== //
// ======== PORTFOLIO IMAGE INFO SLIDE-UP======== //
// ============================================== //
jQuery(document).ready(function() {
	// ---------- PORT and GALLERY LIST ------------- 
	jQuery("#portfolioList .overlay, #galleryList .overlay").animate({marginTop:'275px'},750, function() {
	});
	
	jQuery("#galleryList .post, #portfolioList .post").hover(
		function(){
			parentId = jQuery(this).attr("id");
			jQuery("#" + parentId + " .overlay").animate({marginTop:'142px'},200, function() {
			});
		},
		function(){
			parentId = jQuery(this).attr("id");
			jQuery("#" + parentId + " .overlay").animate({marginTop:'275px'},200, function() {
			});
		});
	
	// ---------- PORT ITEM ------------- 
	jQuery(".port_Item .entry .overlay div").animate({marginTop:'41px'},750, function() {
	});
	
	//jQuery(".port_Item .entry a.portImageLink, .cboxElement .portImage, .port_Item .entry .overlay div").hover(
	jQuery(".portImage_Container").hover(
		function(){	
			parentId = jQuery(this).attr("id");
			jQuery(".port_Item .entry .overlay div").animate({marginTop:'0'},200, function() {
			});
		},
		function(){
			parentId = jQuery(this).attr("id");
			jQuery(".port_Item .entry .overlay div").animate({marginTop:'41px'},200, function() {
			});
		});
});



// ===================================== //
// ======== PORT IMAGE SWITCHER ======== //
// ===================================== //
/*jQuery(document).ready(function() {
	
	// ------------- BUILD OUT BUTTONS ------------- //
	var i = 0;
	var imageSwitchContent;
	
	jQuery(".portImage_Container p a img.portImage").each(
		function() {
			i++;
			imageSwitchContent = jQuery("#imageSwitch ul").html() + "<li id=btn_imageSwitch_" + i + "></li>"; 
			jQuery("#imageSwitch ul").html(imageSwitchContent);
			if (i == 1) {
				jQuery("#imageSwitch ul li").addClass("selected");
			}
		}
	);
	
	// ------------- HANDLE SWITCHING ------------- //
	jQuery("#imageSwitch ul li").click(
		function() {
			var imgNum = jQuery(this).attr("id").substring(16,1);
			jQuery(".portImage_Container a").animate({marginTop: -imgNum*460 + 'px'},200, function() {
			});
		}
	);
		   
});*/
	


// ===================================== //
// ======== BACKGROUND SWITCHER ======== //
// ===================================== //
/*jQuery(document).ready(function() {
	imgCap = 4;
	srcPath = "http://benpaddockdesign.com/wp-content/themes/benpaddockdesign/images/";
	
	// NOTE: if Cookie exists, set bgImgSrc to that num as zero-point. Otherwise, use default 2.
	iNumSt = getCookie('iNum');
	if (iNumSt!=null && iNumSt!="") {
		bgImgSrc = iNumSt;
		//alert("ifSt w/ bgImgSrc = " + bgImgSrc);
	} else {
		bgImgSrc = 2;
		//alert("ifSt w/ bgImgSrc = DOS!");
	}
	
	imgNumStart = bgImgSrc; // NOTE: The Base for the switchers to start from. Should equal the default at first.
	
	// DEF: Function that swaps out the img with one coinciding with imgNum var. 
	function bgImgAdjust(imgNum) {
		newBgImg = srcPath + "bg_main_" + imgNum + ".jpg";
		jQuery("#bgScaleContainer img").attr("src",newBgImg);
		bgImgSrc = imgNum;
		setCookie('iNum',bgImgSrc,365);
		
		//alert("bgImgAdjust w/ bgImgSrc = " + bgImgSrc);
		
		if (bgImgSrc == imgCap) {
			jQuery("#btn_nextBg").addClass("btn_innactive");
		} else if (bgImgSrc == 1) {
			jQuery("#btn_prevBg").addClass("btn_innactive");
		}
	}
	
	
	// DEF: Calls function to load next img on click 
	jQuery("#btn_nextBg").click(function(){
		if (imgNumStart + 1 > imgCap) {
			//alert("nextClk1 w/ imgNumStart = " + imgNumStart);
		} else {
			imgNumStart = imgNumStart + 1;
			//alert("nextClk2 w/ imgNumStart = " + imgNumStart);
			bgImgAdjust(imgNumStart);
			jQuery("#btn_prevBg").removeClass("btn_innactive");
		}
		
		if (imgNumStart == imgCap) {
			jQuery("#btn_nextBg").addClass("btn_innactive");
		}
	});
	
	// DEF: Calls function to load previous img on click 
	jQuery("#btn_prevBg").click(function(){
		if (imgNumStart == 1) {
		} else {
			imgNumStart = imgNumStart - 1;
			bgImgAdjust(imgNumStart);
			jQuery("#btn_nextBg").removeClass("btn_innactive");
		}
		
		if (imgNumStart == 1) {
			jQuery("#btn_prevBg").addClass("btn_innactive");
		}
	});
	
	// DEF: Calls function to load default(original) img on click 
	jQuery("#btn_default").click(function(){
		bgImgAdjust(2);
		imgNumStart = 2;
		jQuery("#btn_nextBg").removeClass("btn_innactive");
		jQuery("#btn_prevBg").removeClass("btn_innactive");
	});
	
	// DEF: Turns the content on or off, to see the background image better.
	jQuery("#btn_contentDisp").click(function(){
		if(jQuery("#btn_contentDisp").text() == "content on") {
			jQuery("#wrapper").hide('fast');
			jQuery("#btn_contentDisp").text("content off");
		} else {
			jQuery("#wrapper").show('fast');
			jQuery("#btn_contentDisp").text("content on");
		}
	});*/
	
	
////// ===================================== //
////// ======== COOKIE CREATOR ======== //
////// ===================================== //
/*jQuery(document).ready(function() {
	// DEF: get the current cookie, if it exists
	function getCookie(c_name) {
		if (document.cookie.length>0) {
			c_start=document.cookie.indexOf(c_name + "=");
			if (c_start!=-1) {
				c_start=c_start + c_name.length+1;
				c_end=document.cookie.indexOf(";",c_start);
				if (c_end==-1) c_end=document.cookie.length;
				return parseInt(unescape(document.cookie.substring(c_start,c_end)));
			}
		}
		return "";
	}
	
	// DEF: set the browser cookie, with the right expiration date
	function setCookie(c_name,value,expiredays) {
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ? "" : ";expires=" + exdate.toUTCString());
	}
	
	// DEF: check for the current cookie. if it exists, use that number. Otherwise, set it. 
	function checkCookie(bgImgSrc) {
		iNum = getCookie('iNum');
		if (iNum!=null && iNum!="") {
			bgImgAdjust(iNum);
			//alert("checkCookie w/ iNum = " + iNum);
		} else {
			setCookie('iNum',bgImgSrc,365);
			//alert("checkCookie w/ bgImgSrc = " + bgImgSrc);
		}
	}
	
	checkCookie(bgImgSrc);
	
});*/





