// Global variables
var isNav, isIE
var coll = ""
var styleObj = ""
var baseurl = "/"
var popupTB, popupWin, distribWin

if (parseInt (navigator.appVersion) >= 4)
{
	if (navigator.appName == "Netscape")
	{
		isNav = true;
		isIE = false;
	}
	else
	{
		isIE = true;
		isNav = false;
		coll = "all.";
		styleObj = ".style";
	}
}

if (document.images)
{
	home_on = new Image(); home_on.src = "/images/icon_home_bright.gif";
	home_off = new Image(); home_off.src = "/images/icon_home.gif";
	toolbox_on = new Image(); toolbox_on.src = "/images/icon_toolbox_bright.gif";
	toolbox_off = new Image(); toolbox_off.src = "/images/icon_toolbox.gif";
}

function SwapOn (obj)
{
	if (document.images)
	{
		document[obj].src = eval (obj + "_on.src");
	}
}

function SwapOff (obj)
{
	if (document.images)
	{
		document[obj].src = eval (obj + "_off.src");
	}
}

// Resize workaround for Netscape
function HandleResize()
{
	location.reload();
	return false;
}

if (isNav)
{
	window.captureEvents (Event.RESIZE);
	window.onResize = HandleResize;
}

// Convert object name string or reference into a valid object reference
function GetObject (obj)
{
	var theObj;
	
	if (typeof (obj) == "string")
	{
		theObj = eval ("document." + coll + obj + styleObj);
	}
	else
	{
		theObj = obj;
	}
	
	return theObj;
}

function hoverOn (row)
{
	var theRowObj = GetObject(row);
	theRowObj.backgroundColor = "#39c";
	return true;
}

function hoverOff (row)
{
	var theRowObj = GetObject(row);
	theRowObj.backgroundColor = "#eee";
	return true;
}

function hoverMenuOn (menu)
{
	var theRowObj = GetObject(menu);
	theRowObj.borderColor = "#666";
	return true;
}

function hoverMenuOff (menu)
{
	var theRowObj = GetObject(menu);
	theRowObj.borderColor = "#ccc";
	return true;
}

function hoverBodyOn ()
{
	var theRowObj = GetObject('bodyBorder');
	theRowObj.borderColor = "#666";
	return true;
}

function hoverBodyOff ()
{
	var theRowObj = GetObject('bodyBorder');
	theRowObj.borderColor = "#ccc";
	return true;
}

function ShowSubPanel (panel)
{
	var thePanelObj = GetObject (panel);
	thePanelObj.display = "inline";
	return true;
}

function HideSubPanel (panel)
{
	var thePanelObj = GetObject (panel);
	thePanelObj.display = "none";
	return true;
}

function PopupWindow (url)
{
	popupWin = window.open (url, "popupWin", 'toolbar=1, location=0, directories=0, status=0, menubar=1, scrollbars=1, resizable=yes, width=650, height=600');
	popupWin.focus();
}

function SendTo ()
{
	var link = "/scripts/sendto.asp?page=" + document.title + "&url=" + document.URL
	popupWin = window.open (link, "fwdWin", 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=no, width=680, height=580');
	popupWin.focus();
}

function SendNews (title)
{
	var link = "/scripts/sendnews.asp?article=" + title + "&url=" + document.URL
	popupWin = window.open (link, "fwdWin", 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=no, width=400, height=480');
	popupWin.focus();
}

function JumpTo (url)
{
	var link = "/scripts/linkto.asp?url=" + url
	popupWin = window.open (link);
	popupWin.focus();
}

function goPage(url)
{
	window.location.href = url;
}

function Newsletter (addr)
{
	var link = "/newsletter/subscribe.asp?Subscribe=" + addr
	location.href = link
}

function ToolBoxPopup ()
{
	popupTB = window.open ("", "popupTB", 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=yes, width=750, height=550');
	
	if (popupTB.location.href.indexOf ("partners") == -1)
	{
		popupTB.location.href = "/partners/"
	}
	popupTB.focus();
}

function DistribPopup (prod)
{
	var link = "/company/available.asp?product=" + prod
	distribWin = window.open (link, "distribWin", 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=no, width=400, height=480');
	distribWin.focus();
}

function PopupImg (img)
{
	imgWin = window.open (img, "imgWin", 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=yes, width=800, height=600');
}

function AreYouSure (redir)
{
	if (confirm("Are you sure?"))
	{
		location.href = redir
	}
}

function SetLocation (loc)
{
	var link = "/scripts/set_loc.asp?loc=" + loc + "&rem=" + document.loc_form.rem.checked
	document.location.href = link 
}

function testInput()
{
	var Email =  new String(document.inputForm.Email.value); 
	var Correct = true; 
	CharCount=1; 
	strLength=Email.length; 
	
	while ((CharCount < strLength) && (Email.charAt(CharCount) != '@')) 
	{ 
		CharCount++ 
	} 
	
	if ((CharCount>= strLength) || (Email.charAt(CharCount) != '@'))  
	{  
		alert ('Email address not valid.') 
		Correct = false; 
	} 
	else 
	{ 
		CharCount += 2; 
	} 
	
	while ((CharCount < strLength) && (Email.charAt(CharCount) != '.')) 
	{ 
		CharCount++ 
	} 

	if ((CharCount>= strLength - 1) || (Email.charAt(CharCount) != '.')) 
	{ 
		alert ('Email address not valid.') 
		Correct = false; 
	} 

	return Correct 
} 

