//////////////////////////////////////////////////////////////////////
//
//  Rotation of Image Files
//
//////////////////////////////////////////////////////////////////////

function getBrowser()
//	Returns IE, NS, NS6
{
	if (document.all) {
	  return "IE"
	}
	else if (document.layers) {
	  return "NS"
	}
	else if (document.getElementById) {
	  return "NS6"
	}
	else {
	  return ""
	}
}

//*********************************************************************

function window_onresize() 
{
	if (getBrowser == 'NS') 
	{
		setTimeout(window.location.reload(), 1000)
//		var origWidth = innerWidth;
//		var origHeight = innerHeight;
//
//		if (innerWidth != origWidth || innerHeight != origHeight)
//			location.reload();
	}
}

//////////////////////////////////////////////////////////////////////
var CONFIG_MENU = 1;
var SELECT_MENU = 2;
var nextpage = ''

function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0; 
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0; 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns5) 

    return this 
} 

var bw = new verifyCompatibleBrowser();

function closeMenu(){
	if (bw.ie4 || bw.ie5 || bw.ie6 || bw.ie7){
		// for IE
		//document.all("pclayer").style.visibility = 'hidden';
		//document.all("viewport").style.visibility = 'hidden';
		document.all("selformlayer").style.visibility = 'hidden';
		return;
	}
	
	//document.layers["pclayer"].visibility = 'hidden';
	//document.layers["viewport"].visibility = 'hidden';
	document.layers["selformlayer"].visibility = 'hidden';

}

function showSeries(){
	if (document.layers){
		if (document.layers['selformlayer'].document.selForm.sersel.selectedIndex <= 0)
			return;
		document.location = "series.asp?S1=" + document.layers['selformlayer'].document.selForm.sersel.options[document.layers['selformlayer'].document.selForm.sersel.selectedIndex].value;
	}
	else{
		if (document.selForm.sersel.selectedIndex <= 0)
			return;
		document.location = "series.asp?S1=" + document.selForm['sersel'].options[document.selForm['sersel'].selectedIndex].value;
	}
}

function configureSwitch(){

	if (document.layers){
		if (document.layers['selformlayer'].document.selForm.switchsel.selectedIndex <= 0)
			return;
//		var parm = document.layers['selformlayer'].document.selForm.switchsel.options[document.layers['selformlayer'].document.selForm.switchsel.selectedIndex].value;
		var aryParms = document.layers['selformlayer'].document.selForm.switchsel.options[document.layers['selformlayer'].document.selForm.switchsel.selectedIndex].value.split(",");
		var ctype = aryParms[0];
		var parm = aryParms[1];
		if (ctype == 0)
			document.location = 'configuratorN4.asp' + parm;
		else if (ctype == 1)
			document.location = 'configureDLB_N4.asp' + parm;
		else if (ctype == 2)
			document.location = 'configureLW_N4.asp' + parm;
		else if (ctype == 3)
			document.location = 'configureS_N4.asp' + parm;
		else if (ctype == 4)
			document.location = 'configureHS_N4.asp' + parm;
	}
	else{
		if (document.selForm.switchsel.selectedIndex <= 0)
			return;
//		var parm = document.selForm['switchsel'].options[document.selForm['switchsel'].selectedIndex].value;
		var aryParms = document.selForm['switchsel'].options[document.selForm['switchsel'].selectedIndex].value.split(",");
		var ctype = aryParms[0];
		var parm = aryParms[1];
		
		if (ctype == 0)
			document.location = 'configuratorIE.asp' + parm;
		else if (ctype == 1)
			document.location = 'configureDLB.asp' + parm;
		else if (ctype == 2)
			document.location = 'configureLW.asp' + parm;
		else if (ctype == 3)
			document.location = 'configureS.asp' + parm;
		else if (ctype == 4)
			document.location = 'configureHS.asp' + parm;
	}
}

function showActuators(){
	if (document.layers){
		var aryParms = document.layers['selformlayer'].document.selForm.actsel.options[document.layers['selformlayer'].document.selForm.actsel.selectedIndex].value.split(",");
		if (document.layers['selformlayer'].document.selForm.actsel.selectedIndex <= 0)
			return;
		if (aryParms[0].substring(0,4) == 'http')
			document.location = aryParms[0]
		else
			document.location = aryParms[0] + "?S3=" + aryParms[1];
	}
	else{
		var aryParms = document.selForm['actsel'].options[document.selForm['actsel'].selectedIndex].value.split(",");
		if (document.selForm.actsel.selectedIndex <= 0)
			return;
		
		if (aryParms[0].substring(0,4) == 'http')
			document.location = aryParms[0]
		else
			document.location = aryParms[0] + "?S3=" + aryParms[1];
	}
}

function showMenu(menuid)
{
	if (bw.ie4 || bw.ie5 || bw.ie6 || bw.ie7){
		// for IE
		//document.all("pclayer").style.visibility = 'hidden';
		//document.all("viewport").style.visibility = 'hidden';
		document.all("selformlayer").style.visibility = 'visible';
		return;
	}
	else
	{
	// for netscape	
		//document.layers["pclayer"].visibility = 'hidden';		
		//document.layers["viewport"].visibility = 'hidden';
		document.layers["selformlayer"].visibility = 'visible';		
		return;
	}
}

var sRepeat=null
function doScroller(dir, src, amount) {
	// 3 arguments, dir: scroll "up" or "down", 
	// src is the string id of positioned element
	// amount (optional) is number of pixels to scroll 
	if (window.document.readyState=="loading") alert("Please wait until the page is finished loading.")
	if (amount==null) amount=10
	if (dir=="down") {
		document.all[src].style.pixelTop-=amount
		if (-document.all[src].style.pixelTop>=document.all[src].offsetHeight-document.all[src].offsetParent.offsetHeight)
			document.all[src].style.pixelTop=-document.all[src].offsetHeight+document.all[src].offsetParent.offsetHeight			
	}
	else {
		document.all[src].style.pixelTop+=amount
		if (document.all[src].style.pixelTop>0)
			document.all[src].style.pixelTop = 0
	}
	if (sRepeat==null)
		sRepeat = setInterval("doScroller('" + dir + "','" + src + "'," + amount + ")",100)
	return false
}

function loadActuators(SwitchTypeId)
{
	//	Load Actuator from page
	document.location.href = "Actuators.asp?S1=1&S2=1&S3=" + SwitchTypeId
	return true
}

function loadSeries(SeriesId)
{
	//	Load Actuator from page
	document.location.href = "Series.asp?S1=" + SeriesId + "&S2=1"
	return true
}

window.document.onmouseup = new Function("clearInterval(sRepeat);sRepeat=null")
window.document.ondragstart = new Function("return false")
