// requires jquery// requires pictfilenamearray containing relative filepath// requires imgratioarray, captionarray variables in main php file// adapted from http://www.webmonkey.com/tutorial/Make_a_JavaScript_Slideshowvar interval = 7000;var imagedivshow = 0;	// both load imgvar maximgwidth = 720;var maximgheight = 500;var containerwidth = maximgwidth;// for container border set containerwidth belowfunction switchImage() {//	var whatdiv = $("#albumsdispldiv2").css("display");	// block or none//	alert(whatdiv);	if (imagedivshow == 1) {		$("#albumsdispldiv").hide();		$("#albumsdispldiv2").show();	}	if (imagedivshow == 0 || imagedivshow == 1) {		$("#albumsdispldiv").load("getimglistjson.php", {divno: 1}, function(){			// adjust size of img			var imgratio = $("#imgID").attr("name");			if (imgratio > 1) {		// landscape				$("#imgID").attr("width",maximgwidth);				$("#imgID").attr("height", Math.round(maximgwidth/imgratio));				containerwidth = maximgwidth;			}			else {	// portrait				$("#imgID").attr("height",maximgheight);				$("#imgID").attr("width", maximgheight*imgratio);				containerwidth = maximgheight*imgratio;			}		});	}	// if div1 is showing preload this, otherwise show	if (imagedivshow == 2) {		$("#albumsdispldiv2").hide();		$("#albumsdispldiv").show();	}	// preload next picture	if (imagedivshow == 0 || imagedivshow == 2) {		$("#albumsdispldiv2").load("getimglistjson.php", {divno: 2}, function(){			// adjust size of img			var imgratio = $("#imgID2").attr("name");			if (imgratio > 1) {		// landscape				$("#imgID2").attr("width",maximgwidth);				$("#imgID2").attr("height", Math.round(maximgwidth/imgratio));				containerwidth = maximgwidth;			}			else {	// portrait				$("#imgID2").attr("height",maximgheight);				$("#imgID2").attr("width", maximgheight*imgratio);				containerwidth = maximgheight*imgratio;			}		});	}	// set container width albumsdispldiv	$("#albumsdispldiv").width(containerwidth+50);	// set width offset here	$("#albumsdispldiv2").width(containerwidth+50);		if (imagedivshow == 0) {		imagedivshow = 1;	}	else if (imagedivshow == 1) {		imagedivshow = 2;	}	else if (imagedivshow == 2) {		imagedivshow = 1;	}		var recur_call = "switchImage()";	timerID = setTimeout(recur_call, interval);	/*	if(nextimg){		var new_image = nextimg;	}	else {		var new_image = getImgData();	}	$("#imgID").attr({src: new_image});	if (imgratio > 1) {		// landscape		$("#imgID").attr("width",maximgwidth);		$("#imgID").attr("height", Math.round(maximgwidth/imgratio));		var containerwidth = maximgwidth+20;	// set width offset here	}	else {	// portrait		$("#imgID").attr("height",maximgheight);		$("#imgID").attr("width", maximgheight*imgratio);		var containerwidth = maximgheight*imgratio+20;	// set width offset here	}	var captiontxt = captionarray[imageNum];	$("#captionp").text(captiontxt);	// set container width albumsdispldiv	$("#albumsdispldiv").width(containerwidth);		var recur_call = "switchImage()";	timerID = setTimeout(recur_call, interval);	// preload new image	var newimg = imageNum +1;	if (!pictfilenamearray[newimg]){		newimg = 0;	}	var nextimg = new Image();	nextimg.src = pictfilenamearray[newimg];*/		}/*better fadein but does not work $("#albumsdispldiv").fadeIn("slow").animate({opacity: 1.0}, 5000).fadeOut("slow");*/// starting the script on page load$(document).ready(function(){	switchImage();});