/*
- File name: inc/functions.js
- Use: for kabinart.com
- Autohr: larry french
- Date: 072307

- NOTES: jquery based js stuff
*/

/* Start jquery */
$(document).ready(function() {



/*-------- When a door swatch is clicked, replace the medium door image and load the 
Thickbox link with the new image name. ---------*/													 
$("div#swatches_wide img").click(function() {

	
	//////////make it void per request //////////
	/* Change the picture directory to /doors_medium/ 
	var medium = $(this).attr("src");
	var medium_pic = medium.replace("swatches", "medium");	
	
	/* change the medium image, the swatch must have title=medium/image/name.jpg 
	$("img#door_medium").attr("src", medium_pic );
	
	/* Change the picture directory to /doors_large/ 
	var large = $(this).attr("src");
	var large_pic = medium.replace("swatches", "large");	
	
	/* Load the thickbox 
	$("a#door_thickbox").attr("href", large_pic );*/

}); /* /click() */



/*-------- Glam shot pagination ---------*/
$("p#pagination a").click(function() {
	
	/* change the glam image, the pagination link must have title=path/to/picture.jpg */
	$("img#glam_picture").attr("src", $(this).attr("title") );	
	/* change the image caption, the pagination link must have alt='the caption text' */
	$("p#portfolio_caption").html( $(this).attr("alt") );
	
	highlight();
	/* change the link to indicate that it was viewed */
	$(this).addClass("portfolio_viewer_clicked");
	
	/* Give the thickbox link with the new image path. First replace /glam_shots/ with
	/glam_shots_large/ */
	var old_path = $(this).attr("title");
	var large_glam = old_path.replace("glam_shots", "glam_shots_large");	
	/* Load the thickbox's href */
	$("a#glam_thickbox").attr("href", large_glam );
	
	return false;

}); /* /click() */


		function highlight () {
			$(this).find('a').removeClass("portfolio_viewer_clicked");
		}


}); /* /jquery */
