function pageload(pageType, id, cat){
	if (top.frames.length==0){
		sLocation = "default.asp?PT=" + pageType
		if (id != "") {
			sLocation = sLocation + "&ID=" + id
		}	
		if (cat != "") {
			sLocation = sLocation + "&Cat=" + cat
		}			
		top.location =  sLocation
	}
}

function reloadTopMenu(){
	parent.Header.location = "InterfaceHeader.asp"
}

function loadCart(){
	top.location= httpAddress + 'Cart2.asp?cID=' + cartID
}
function setDefault(sLink, sImage) {
	for (i=1; i <= 8 ; i++){
		obj = eval ('document.all.tab' + i);
		obj.className = 'sectionHeaderOff';
	}
	if (sLink != "tab0"){
		obj = eval ("document.all." + sLink);
		obj.className = 'sectionHeaderOn';
		document.all.tab5.className = 'sectionHeaderCart'
	}
}

//not required
function setTopMenu(sLink, sImage){
	if (top.Header.isLoaded == true){
		top.Header.setDefault(sLink)
	}
}
function setSideMenu(Mode){
	if (parent.Menu.location.search != "?Mode=" + Mode){
		parent.Menu.location = "InterfaceMenu.asp?Mode=" + Mode
	}
}

//function openWindow(openPage){
//	window.open(openPage, 'Board','scrollbars=yes,status=yes,width=400, height=425')
//}

function doPrint(){
	shouldLogOut = false;

	if(canPrint())
		print();
	else
		alert("Press 'APPLE + P' to print.");
}

// This function is to test for users of IE on Mac. These people can't do a print from a link.
function canPrint(){
	var isMac = navigator.userAgent.indexOf("Mac");
	var isIE = navigator.userAgent.indexOf("MSIE");

	if((isMac != -1) && (isIE != -1))
		return false;
	else
		return true;
}


function isDigit(str){
   if (str.length == 0){
      return false;
   }
   for (var i=0;i < str.length;i++){
      if ((str.substring(i,i+1)<'0')||(str.substring(i,i+1)>'9')){
        return false;
      }
   }
   return true;
}

function isLetter(str){
   characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
   if (str.length == 0){
      return false;
   }
   for (var i=0;i < str.length;i++){
      if (characters.indexOf(str.charAt(i)) == -1){
         return false;
      }
   }
   return true;
}

function OpenWindow(s){
	//function to open new browser for little Question Mark Icon
	newWin = window.open(s,"Win","toolbar=0,location=0,directories=0,status=yes,menubar=no,scrollbars=yes,resizable=no,screenX=0,screenY=0,left=0,top=0,width=380,height=320");
	newWin.focus();
} 

function OpenWindowBig(s){
  //function to open new browser for Help Icon - Bigger browser
  newWin = window.open(s,"WinBig","toolbar=0,location=0,directories=0,status=yes,menubar=no,scrollbars=yes,resizable=yes,screenX=0,screenY=0,left=0,top=0,width=536,height=300");
	newWin.focus();
}
function OpenWindowPrint(s){
  //function to open new browser for Help Icon - Bigger browser
  newWin = window.open(s,"WinPrint","toolbar=0,location=0,directories=0,status=yes,menubar=no,scrollbars=yes,resizable=yes,screenX=0,screenY=0,left=0,top=0,width=660,height=400");
	newWin.focus();
}
function OpenWindowExit(s){
	//function to open new browser

	var height=800;
	var width=550;
	newWin = window.open(s, "WIN", "toolbar=1,status=1,location=yes,menubar=yes,directories=yes,scrollbars=yes,resizable=yes,screenX=0,screen=0,left=0,top=0,width=" + width + ",height=" + height);
}

function OpenToolWindowSmall(s) {   
  var URL = s	
  if (s.search(".htm") != -1)
  {
	URL = "/inetbank/banklink/Popup.asp?filename=" + s
  }
  newWin = window.open(URL,"ToolWin","toolbar=0,location=0,directories=0,status=yes,menubar=no,scrollbars=1,resizable=yes,width=300,height=225");
}

// Workaround for browsers that support ActiveX but not window.print(); (ie IE4)
function printFrame() {
	if ( document.readyState != "complete" &&
		!confirm("The document to print is not downloaded yet! Continue?") )
	{
		return;
	}
	else
	{
		document.body.insertAdjacentHTML("beforeEnd", "<object id=\"printWB\" width=0 height=0 classid=\"clsid:8856F961-340A-11D0-A96B-00C04FD705A2\"></object>");
	    execScript("on error resume next: printWB.ExecWB 6, 1", "VBScript");
	    printWB.outerHTML = "";
	}
}

// is the window.print() method supported?
function printIsNativeSupport() {
  var agent = window.navigator.userAgent;
  var i = agent.indexOf("MSIE ")+5;
  return parseInt(agent.substr(i)) >= 5 && agent.indexOf("5.0b1") < 0;
}

//This function returns the correct form for the main template page depending upon what document structure the 
//HTML page is using.
function getRightForm() {
	return document.forms[2];
}
