/********************************************************
 * This function opens a window for the print interface *
 ********************************************************/
function popbig(){
	MM_openBrWindow('/londonmaps/printwindow.php?'+iconurl+'IV_Icon='+iconflag+'&amp;Title=QW50aXF1YXJpdXM=&amp;Address=MTMxLTE0MSBLaW5ncyBSb2Fk&amp;NextRequest=1&amp;origh='+origh+'&amp;origv='+origv+'&amp;IVRAND=041456730762d84.38001789&amp;IV_ScalePointer=404&amp;IV_ResultImage=404&amp;IV_RunByMethod=VBGC&amp;IV_GeoHorizontal='+geoh+'&amp;IV_GeoVertical='+geov+'&amp;IV_Border=1','PrintWindow','width=540,height=655');
}

/********************************************************
 * This function opens a window for the email interface *
 ********************************************************/
function popemail(){
	MM_openBrWindow('/londonmaps/email.php?uri=/LondonInformation/Shopping/Antiquarius/c4ca/&amp;domain=www.londontown.com&amp;darkColor=8E155B&amp;image=newimages/shopping-header.gif','PrintWindow','width=471,height=378');
}

/********************************************************
 * This function will show a layer that is hidden.      *
 * If the layer has an image associated to it then it   *
 * will also change this for us.						*
 *														*
 * layerName is the name of the layer we wish to show   *
 *														*
 * oldLayer is the base layer name for example          *
 * 'details' there is no number appended on this.       *
 * 														*
 * totalLayers is the amount of layers with this name   *
 *														*
 * changeImage is a boolean to flag if we wish to 		*
 * change an image or not.								*
 ********************************************************/


// Initialise a counter for the amount of clicks so if the link is clicked a second time close the layer.
var counter = 0;

function showLayer(layerName, oldLayer, totalLayers, changeImage){


	try {

	// Set array for the image swap
	var aryImages = new Array(2);
	aryImages[0] = "/DirectoryV2/w3c/images/arrow_right.gif";
	aryImages[1] = "/DirectoryV2/w3c/images/arrow_down.gif";


	// Loop through the array and preload the images
	for (i=0; i < aryImages.length; i++) {
		var preload = new Image();
		preload.src = aryImages[i];
	}


	// Loop through the layers and check the layerName
	// against the oldLayerName if they dont match then
	// disable the layer.  If they do match then display the
	// layer.
	for(i = 1; i <= totalLayers; i++){
		var oldLayerName = oldLayer + i
		var imgMain = 'imgMain' + i;



		// Check if we need to do an image swap
		if(layerName != oldLayerName){
			if(changeImage){
				document[imgMain].src = aryImages[0];
			}
			try { document.getElementById(oldLayerName).style.display="none"; } catch ( iex){}
		} else {
			if(counter == 0 && document.getElementById(layerName).style.display == "none"){
				// Check if we need to do an image swap
				if(changeImage){
					document[imgMain].src = aryImages[1];
				}
				document.getElementById(layerName).style.display="";
				counter = 1;
			} else if(counter == 1 && document.getElementById(layerName).style.display == "none") {
				// Check if we need to do an image swap
				if(changeImage){
					document[imgMain].src = aryImages[1];
				}
				document.getElementById(layerName).style.display="";
				counter = 0;
			} else {
				// Check if we need to do an image swap
				if(changeImage){
					document[imgMain].src = aryImages[0];
				}
				document.getElementById(layerName).style.display="none";
				counter = 0;
			}
		}
	}

	} catch ( Exception ) {
		alert(Exception.message);
	}
}

/********************************************************
 * Function to hide the exsisting layer that is open	*
 *														*
 * layerName is the layer we wish to hide				*
 ********************************************************/
 function hideLayer(layerName){
 	document.getElementById(layerName).style.display="none";
 }

/********************************************************
 * Change a layer from a select box 					*
 ********************************************************/
 function changeLayer(layerName, totalLayers){
 	for(i = 1; i <= totalLayers; i++){
 		var oldLayerName = layerName + i;
 		var newLayerName = layerName + (document.actionForm.chooseEvent.selectedIndex + 1);

 		if(newLayerName != oldLayerName){
 			document.getElementById(oldLayerName).style.display='none';
 		} else {
 			document.getElementById(newLayerName).style.display='';
 		}
 	}
 }