//
// preload Images
//

// onLoad="MM_preloadImages('','',...)"
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}




//
// popUpload
//
function popUpload(vCaption, vField, vValue, sName, sPath){
	//alert(vValue);
	var iWidth = 500;
	var iHeight = 250	;
	var iLeft = (screen.width - iWidth) / 2;
	var iTop = (screen.height - iHeight) / 2;
	var strWinProps = "top="+iTop+",left="+iLeft+",width="+iWidth+",height="+iHeight+",resizable=yes,scrollbars=yes,toolbar=no,menubar=no,status=no";
	var nW = window.open("", sName, strWinProps);
	nW.location.href = "ULWindow.asp?caption="+ escape(vCaption) + "&field="+ vField + "&value="+ vValue + "&Name=" + sName + "&Path=" + sPath;
	nW = null;
}


function popGraphic(sImage, sTitle)
{

//alert(sImage);

var iWinLeft;
var iWinTop;
var iImgWidth;
var iImgHeight;
var iWinWidth;
var iWinHeight;

var oImage = new Image();

if (sImage=="") {
return false;
}



oImage.src = sImage;
iImgHeight = oImage.height;
iImgWidth = oImage.width ;

//alert(iImgWidth);

var iWinWidth = iImgWidth + 50;
var iWinHeight = iImgHeight + 80;

iWinLeft = (window.screen.width/2) - (iWinWidth/2);
iWinTop = (window.screen.height/2) - (iWinHeight/2);

var winprops = 'height='+iWinHeight+',width='+iWinWidth+',top='+iWinTop+',left='+iWinLeft+',scrollbars='+scroll+',resizable,status=yes'
var displayPage = "../Include/ShopPopGraphic.asp?I=" + sImage + "&T=" + sTitle + "&H=" + iImgHeight + "&W=" + iImgWidth ;
//alert(displayPage);
var nW = window.open(displayPage, "Helper", winprops);

if (parseInt(navigator.appVersion) >= 4)
{
nW.window.focus();
}

//nW.location.href = "../Include/ShopPopGraphic.asp?I=" + sImage + "&T=" + sTitle;
//nW = null;

}


function isLowRes() {
   /*
   ** Check if the browser is running in a low-resolution environment
   ** try to use the screen object (in N4 or e4). If not available, try to use Java.
   ** If not available, assume low-res.
   ** returns true if in a low-resolution environment (width < 800 pixels)
   */
   if (self.screen)
     return (screen.width < 800);
   else
     if (navigator.javaEnabled && navigator.javaEnabled())
       return (java.awt.Toolkit.getDefaultToolkit().getScreenSize().width < 800);
     else
       return true;
   }

function toggleImage(ImgName) {

	// alert("toggleImage");

	if (document.getElementById) {

		//var strSrc = document.all.item(ImgName).src;
		var strSrc = document.getElementById(ImgName).src 
		var pos = strSrc.indexOf('icoPlus_11x11');
		// alert(pos);
		 if (pos != -1)
		 {
			document.getElementById(ImgName).src = "../images/icoMinus_11x11.gif";				 
		}
		else
		{
			document.getElementById(ImgName).src = "../images/icoPlus_11x11.gif";
		 }
			 
	}
	else if (document.all) {
			
		var strSrc = document.all.item(ImgName).src;
		var pos = strSrc.indexOf('icoPlus_11x11');

		 if (pos != -1)
		 {
			document.all.item(ImgName).src = "../images/icoMinus_11x11.gif";				 
		 } else {
			document.all.item(ImgName).src = "../images/icoPlus_11x11.gif";
		 }
		 
	}
	else if (document.layers) {
	
		// this is the way nn4 works
		document.layers[DivName].display = "";
	
		var strSrc = document.layers[DivName].src;
		var pos = strSrc.indexOf('icoPlus_11x11');

		 if (pos != -1)
		 {
			document.layers[DivName].src = "../images/icoMinus_11x11.gif";				 
		 } else {
			document.layers[DivName].src = "../images/icoPlus_11x11.gif";
		 }

	}
		

}

//
//
//
function toggleDiv(DivName){


				//alert("Clicked!");

				 /*if (document.all.item(DivName).style.display == "none")
				 {
					 document.all.item(DivName).style.display = "";
				 }
				 else
				 {
					document.all.item(DivName).style.display = "none";
				 }*/


					if (document.getElementById) {
						//alert("Click!");
						// this is the way the standards work
						if (document.getElementById(DivName).style.visibility == "hidden")
						{	document.getElementById(DivName).style.visibility = "visible";
							document.getElementById(DivName).style.display = "";
						} else {
							document.getElementById(DivName).style.visibility = "hidden";
							document.getElementById(DivName).style.display= "none";
						}
						
					}
					else if (document.all) {
			
						// this is the way old msie versions work
						if (document.all[DivName].style.visibility == "hidden")
						{
						document.all[DivName].style.visibility = "visible";
						}else{
							document.all[DivName].style.visibility = "hidden";
						}
					}
					else if (document.layers) {
						// this is the way nn4 works
						
						if (document.layers[DivName].visibility == "hidden"){
							document.layers[DivName].display = "";
						}else{
							document.layers[DivName].visibility = "visible";
						}
					}
}

function Toggle(oDiv, oImage){
	
	toggleDiv(oDiv);
	toggleImage(oImage);

}
