isClick=" ";
checksp = 0;

function preloadImages() { //v2.0
  if (document.images) {
    var imgFiles = preloadImages.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}

function switchnavoff(iID,iSRC)
{
	for( i=0; i<=parent.document.images.length-1; i++)
	{
		checkSRC = parent.document.images[i].src;			
		checkID = parent.document.images[i].id;		
		v = checkSRC.length;
		n = checkID.length;
		checkimgSRC = checkSRC.substr(0, v-8);
		checkimgID = checkID.substr(0, (v+3)-v);
					
		if( checkimgID == "nav")
		{
			parent.document.images[i].src = checkimgSRC + "-off.gif";									
		}
	}
/*
	for( i=0; i<=document.images.length-1; i++)
	{			
		checkSRC = document.images[i].src;
		checkID = document.images[i].id;		
		v = checkSRC.length;
		n = checkID.length;
		checkimgSRC = checkSRC.substr(0, v-8);
		checkimgID = checkID.substr(0, (v+3)-v);
		
		//alert(iID + "=" + iSRC + "<br>" + checkSRC + " = " + checkimgSRC + "<br>" + checkID + " = " + checkimgID);
		if( checkimgID == "nav" && checkID !== iID)
		{
			document.images[i].src = checkimgSRC + "-off" + extension;									
		}
		else if( checkID == iID && iSRC != isClick )
		{
			document.images[iID].src = iSRC + "-ovr" + extension;
			isClick = iSRC + "-ovr" + extension;
		} 		
	}	
*/
}

/* menu navigation script.
/ need to set prefix to image ID in code to 'nav'
*/
function menunav(which, what, where)
{		
	imgSRC = document.images[which].src;
		
	v = imgSRC.length;
	oldimgSRC = imgSRC.substr(0, v-8);
	extension = ".gif";
											
	if( what == 1 )
	{			
		document.images[which].src = oldimgSRC + "-ovr" + extension; 		
	}
	else if( what == 2 )
	{			
		for( i=0; i<=document.images.length-1; i++)
		{					
			checkSRC = document.images[i].src;			
			checkID = document.images[i].id;		
			v = checkSRC.length;
			n = checkID.length;
			checkimgSRC = checkSRC.substr(0, v-8);
			checkimgID = checkID.substr(0, (v+3)-v);
						
			if( checkimgID == "nav" && checkID !== which)
			{
				document.images[i].src = checkimgSRC + "-off" + extension;									
			}
			else if( checkID == which )
			{
				if( where != "" )
				{
					//alert(parent.document.frames["main"].document.location);
					//parent.document.frames["content"].document.location.href=where;
					document.frames["content"].document.location.href=where;
				}
				document.images[which].src = oldimgSRC + "-ovr" + extension;
				isClick = oldimgSRC + "-ovr" + extension;				
			} 		
		}		
	}
	else if( what == 0 )
	{		
		if( imgSRC != isClick )
		{ 
			newimgSRC = oldimgSRC + "-off" + extension; 
			document.images[which].src = newimgSRC;
		}
	}
	else
	{
		alert("error: please contact administrator.");
	}	
}


function highlite(which,what,set)
{		
	oldCLASS = document.all(which).className;	
	if( set == 1 )
	{
		oldimgCLASS = document.all("img" + which).className;	
		oldCLASSb = document.all("b" + which).className;
		oldCLASSc = document.all("c" + which).className;
	}
		
	if( what == 1 ) 
	{
		//set 1 = showroom, also targets thumbnail class
		if( set == 1 )
		{
			document.all("img" + which).className = oldimgCLASS + "_on";
			document.all("b" + which).className = oldCLASSb + "_on";
			document.all("c" + which).className = oldCLASSc + "_on";			
		}
		document.all(which).className = oldCLASS + "_on";
	}
	else
	{
		v = oldCLASS.length;
		oldCLASS = oldCLASS.substr(0, v-3);		
		document.all(which).className = oldCLASS;
		
		if( set == 1 )
		{
			v = oldimgCLASS.length;
			oldimgCLASS = oldimgCLASS.substr(0, v-3);
			v = oldCLASSb.length;
			oldCLASSb = oldCLASSb.substr(0, v-3);
			v = oldCLASSc.length;
			oldCLASSc = oldCLASSc.substr(0, v-3);
			
			document.all("img" + which).className = oldimgCLASS;
			document.all("b" + which).className = oldCLASSb;
			document.all("c" + which).className = oldCLASSc;
		}	
	}
}

function imageviewer(which,h,w)
{
	if( h.length <= 0 )
	{
		h = 480;
	}
	if( w.length <= 0 )
	{
		w = 640;
	}	
	openWindow2("imageviewer.asp?SRC=" + which, '', '', 1, h, w, 0);
}

function openWindow2(URL, QS, windowName, center, theHeight, theWidth, scroll) 
{	
	if (theHeight == 0) {
		theHeight = 350
	}
	if (theWidth == 0) {
		theWidth = 300
	}
	if (windowName == 0) 
	{
		windowName = 'SEARCH'
	}
	if (scroll == 0) 
	{
		scroll = 0
	} 
	else
	{
		scroll = 1
	}	
	if (center == 1)
	{
		wheight = window.screen.height;
		wwidth = window.screen.width;
		wheight = (wheight/2)-(theHeight/2);
		wwidth = (wwidth/2)-(theWidth/2);		
	}
	else
	{
		wheight = 0;
		wwidth = 0;
	}
	
	if ( windowName == "new" )
	{
		window.open(URL+QS,"NEW","")
	}
	else
	{
		window.open(URL+QS,"LOGIN","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + scroll + ",resizable=0,left="+wwidth+",top="+wheight+",width="+theWidth+",height="+theHeight)
	}
}
