/*
var panoImage;

function swapPano() {
	if(panoImage != null && panoImage != "") {
		//alert(panoImage);
		if(document.getElementById) {
			//alert('running');
			document.getElementById("pano").style.backgroundImage = "url('"+panoImage+"')";
		}
	}
}
*/

panoLocation = "";
panoCount = 0;

function swapPano() {
	//get the URL of the current page, convert it to a string and make the string lowercase	
	var location = window.location;
	location = location.toString();
	location = location.toLowerCase();
	//alert (location);
	
	// define a new array to contain the pairs necessary to identify the current directory and corresponding div
	splashImage = new Array();
	
	// directory is a string containing the name of the directory each section of the site is contained in, framed by slashes
	// imageCount specifies how many different images are defined for each page/section
	
	splashImage[0] = new Object();
			splashImage[0].directory = "/programs/camp-al-gon-quian"; 
			splashImage[0].imageCount = "10";
    
	// initiate a for loop to cycle through the array of site directories
	for (var i=0; i < splashImage.length; i++) {
	
	// move through the array, checking if the .directory element string is present in the URl of the current page  
	if 	(location.match(splashImage[i].directory))  { 
		// set the path to the pano image and the number of images if it matches the current directory
	    
	    panoLocation = splashImage[i].directory;
	    //alert(panoLocation);
	    panoCount = splashImage[i].imageCount;
	    
	    break;
	}
	
	}
	
	rotatingBanner = new Array();
	
	for (var j=0; j <= panoCount; j++) {
	
		rotatingBanner[j] = '/sites/all/themes/aaymca/images/pano'+panoLocation+'/0'+(j+1)+'.jpg';
	
	}
	
	var p = rotatingBanner.length;
	

	var whichRotatingBanner = Math.round(Math.random()*(p-1));

	if (document.getElementById) {
	
		alert(rotatingBanner[whichRotatingBanner]);
		document.getElementById("panoInner").style.backgroundImage="url('"+rotatingBanner[whichRotatingBanner]+"') 164px 0 no-repeat;";
		
}

	
}



