var agt;
var major;
var minor;
var NS;
var NS2;
var NS3;
var NS4;
var NS4up;
var NS6;
var NS6up;
var gecko;
var IE;
var IE3;
var IE4;
var IE4up;
var IE5;
var IE5up;
var IE5_5;
var IE5_5up;
var IE6;
var IE6up;
var img = new Array();

 function CheckLogin() {

	var idx = 0;
    var index = document.cookie.indexOf("LoggedIn");
    if (index == -1) {
      document.cookie = "LoggedIn=" +idx;
    } 
    else {
      countbegin = (document.cookie.indexOf("=", index) + 1);
      countend = document.cookie.indexOf(";", index);
      if (countend == -1) {
        countend = document.cookie.length;
      }
	  if (countbegin >= countend) {
	    idx = 0;
	  } else {      
        idx = parseInt(document.cookie.substring(countbegin,countend));
      }
      if (isNaN(idx)) idx = 0;
      if (idx < 0) idx = 0;
  }
  if(idx == 0) {
	window.location = "login.asp";
  }
  }
 
 function ChkBrw() {

  agt=navigator.userAgent.toLowerCase();
  major = parseInt(navigator.appVersion);
  minor = parseFloat(navigator.appVersion);

  NS = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
  NS2 = (NS && (major == 2));
  NS3 = (NS && (major == 3));
  NS4 = (NS && (major == 4));
  NS4up = (NS && (major >= 4));
  NS6 = (NS && (major == 5));
  NS6up = (NS && (major >= 5));
  gecko = (agt.indexOf('gecko') != -1);
  IE = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
  IE3 = (IE && (major < 4));
  IE4 = (IE && (major == 4) && (agt.indexOf("msie 4")!=-1));
  IE4up = (IE && (major >= 4));
  IE5 = (IE && (major == 4) && (agt.indexOf("msie 5.0")!=-1));
  IE5_5 = (IE && (major == 4) && (agt.indexOf("msie 5.5") !=-1));
  IE5up = (IE && !IE3 && !IE4);
  IE5_5up = (IE && !IE3 && !IE4 && !IE5);
  IE6 = (IE && (major == 4) && (agt.indexOf("msie 6.")!=-1));
  IE6up = (IE && !IE3 && !IE4 && !IE5 && !IE5_5);
  
}

function jump_to() {

  if (IE5 || IE5up || IE5_5 || IE5_5up || IE6up || IE6up || NS6 || NS6up) {
    
    brwlocation = 'westinsp/index.asp'
    window.location = brwlocation
    
    }
    
  else {
  
    brwlocation = 'westinsp/badBrowser.htm'
    window.location = brwlocation;
    
  }
  
 }
 
 
function set_title_story(row_idx) {

  TitleContent = arr[0][row_idx];
  StoryContent = arr[1][row_idx];
  
    if (IE5 || IE5up || IE5_5 || IE5_5up || IE6up || IE6up) {

      TitleTxt.innerHTML = TitleContent;
      StoryTxt.innerHTML = StoryContent;

    }

    else if (NS6 || NS6up) {

      TitleTxt = document.getElementById("TitleTxt")
      TitleTxt.innerHTML = TitleContent;
      StoryTxt = document.getElementById("StoryTxt")
      StoryTxt.innerHTML = StoryContent;
    
    }

    else {
      
      nglocation ='badBrowser.htm'
      window.location=nglocation;

    }

}


function preload_img() {

  for (i = 0; i > img.length; i++) {
    img[i] = newImage();
    img.scr = img[i];

  }

}


function loadapplet_Reprint() {
 
  var StoryContent;
  StoryContent = "";
	  
    if (IE5 || IE5up || IE5_5 || IE5_5up || IE6up || IE6up) {
//

        StoryContent = '<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"';
//        StoryContent = StoryContent + 'WIDTH = "100%" HEIGHT = "100%" NAME = "WILReprintApp" ALIGN = "left" VSPACE = "0" HSPACE = "0"  codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_5-windows-i586.cab#Version=1,5,0,0">';
        StoryContent = StoryContent + 'WIDTH = "100%" HEIGHT = "100%" NAME = "WILReprintApp" ALIGN = "left" VSPACE = "0" HSPACE = "0"  codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2_03-windows-i586.cab#version=1,3,1,0">';
        StoryContent = StoryContent + '<PARAM NAME = "CODE" VALUE = "com.wil.shop.applets.reprints.zReprintApplet" >';
        StoryContent = StoryContent + '<PARAM NAME = "CODEBASE" VALUE = "http://www.westerninspection.com/WILWebApps/">';
//        StoryContent = StoryContent + '<PARAM NAME = "CODEBASE" VALUE = "http://192.168.0.171/WILWebApps/">';
//        StoryContent = StoryContent + '<PARAM NAME = "ARCHIVE" VALUE = "jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3_min-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar">';
//        StoryContent = StoryContent + '<PARAM NAME = "cache_option" VALUE="Plugin">';
        StoryContent = StoryContent + '<PARAM NAME = "cache_archive" VALUE = "jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3_min-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar">';
        StoryContent = StoryContent + '<PARAM NAME = "cache_version" VALUE = "1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4,5.5.5.5,6.6.6.6,7.7.7.7,8.8.8.8">';
        StoryContent = StoryContent + '<PARAM NAME = "NAME" VALUE = "ReprintApplet">';
        StoryContent = StoryContent + '<PARAM NAME = "MAYSCRIPT" VALUE = true>';
        StoryContent = StoryContent + '<PARAM NAME ="type" VALUE="application/x-java-applet;version=1.4">';
        StoryContent = StoryContent + '<PARAM NAME ="scriptable" VALUE="false">';
        StoryContent = StoryContent + '<PARAM NAME = "UserName" VALUE = "' + jUserName + '">';
        StoryContent = StoryContent + '<PARAM NAME = "Password" VALUE = "' + jPassword + '">';
        StoryContent = StoryContent + '<PARAM NAME = "Source" VALUE ="Shop">';
        StoryContent = StoryContent + '<PARAM NAME = "SecurityID" VALUE ="' + jGUID + '">';
        StoryContent = StoryContent + '<B>This application requires a browser that supports Java.</B>';
        StoryContent = StoryContent + '</OBJECT>';

	     StoryWindow.innerHTML = StoryContent;



	}
 
	else if (NS6 || NS6up) {
	    StoryContent = StoryContent + '<EMBED type="application/x-java-applet;version=1.3" CODE="com.wil.shop.applets.reprints.zReprintApplet" CODEBASE="http://www.westerninspection.com/WILWebApps/" ARCHIVE="jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3-1.1.3.4.M.jar,jars/LwVCL.jar,jars/LwVCLExt.jar" NAME="WILReprintApp" WIDTH="613" HEIGHT="263" MAYSCRIPT="true" UserName="' + jUserName + '" Password="' + jPassword + '" Source = "Shop" scriptable="false" pluginspage="http://dlres.java.sun.com/PluginBrowserCheck"><NOEMBED>';
//	    StoryContent = StoryContent + '<EMBED type="application/x-java-applet;version=1.3" CODE="com.wil.shop.applets.reprints.zReprintApplet" CODEBASE="http://192.168.0.171/WILWebApps/" ARCHIVE="jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3-1.1.3.4.M.jar,jars/LwVCL.jar,jars/LwVCLExt.jar" NAME="WILReprintApp" WIDTH="613" HEIGHT="263" MAYSCRIPT="true" UserName="' + jUserName + '" Password="' + jPassword + '" Source = "Shop" scriptable="false" pluginspage="http://dlres.java.sun.com/PluginBrowserCheck"><NOEMBED>';
	    StoryContent = StoryContent + '<B>This application requires a browser that supports Java.</B>';
	    StoryContent = StoryContent + '</NOEMBED></EMBED>';
	
	    StoryWindow = document.getElementById("StoryWindow")
	    StoryWindow.innerHTML = StoryContent;

    }
  
    else {
      StoryContent = StoryContent + '<APPLET CODE = "com.wil.shop.applets.reprints.zReprintApplet" CODEBASE = "http://www.westerninspection.com/WILWebApps/" ARCHIVE = "jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar" WIDTH = "613" HEIGHT = "263" NAME = "WILReprintApp" MAYSCRIPT>';
//      StoryContent = StoryContent + '<APPLET CODE = "com.wil.shop.applets.reprints.zReprintApplet" CODEBASE = "http://192.168.0.171/WILWebApps/" ARCHIVE = "jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar" WIDTH = "613" HEIGHT = "263" NAME = "WILReprintApp" MAYSCRIPT>';
      StoryContent = StoryContent + '<PARAM NAME = "UserName" VALUE ="' + jUserName + '">';
      StoryContent = StoryContent + '<PARAM NAME = "Password" VALUE ="' + jPassword + '">';
      StoryContent = StoryContent + '<PARAM NAME = "Source" VALUE ="Shop">';
	StoryContent = StoryContent + '<B>This application requires a browser that supports Java 1.3 or higher.</B>';
      StoryContent = StoryContent + '</APPLET>';
    }
  }



function loadapplet_Stats() {

  var StoryContent;
  StoryContent = "";

    if (IE5 || IE5up || IE5_5 || IE5_5up || IE6up || IE6up) {

        StoryContent = '<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"';
//	StoryContent = StoryContent + 'WIDTH = "100%" HEIGHT = "100%" NAME = "StatisticalApplet" ALIGN = "left" VSPACE = "0" HSPACE = "0"  codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_5-windows-i586.cab#Version=1,5,0,0">';
      StoryContent = StoryContent + 'WIDTH = "100%" HEIGHT = "100%" NAME = "StatisticalApplet" ALIGN = "left" VSPACE = "0" HSPACE = "0"  codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2_03-windows-i586.cab#version=1,3,1,0">';
        StoryContent = StoryContent + '<PARAM NAME = "CODE" VALUE = "com.wil.shop.applets.statisticals.zStatisticalApplet" >';
        StoryContent = StoryContent + '<PARAM NAME = "CODEBASE" VALUE = "http://www.westerninspection.com/WILWebApps/">';
//        StoryContent = StoryContent + '<PARAM NAME = "CODEBASE" VALUE = "http://192.168.0.171/WILWebApps/">';
//        StoryContent = StoryContent + '<PARAM NAME = "cache_option" VALUE="Plugin">';
        StoryContent = StoryContent + '<PARAM NAME = "cache_archive" VALUE = "jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3_min-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar">';
        StoryContent = StoryContent + '<PARAM NAME = "cache_version" VALUE = "1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4,5.5.5.5,6.6.6.6,7.7.7.7,8.8.8.8">';
//            StoryContent = StoryContent + '<PARAM NAME = "ARCHIVE" VALUE = "jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3_min-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar">';
        StoryContent = StoryContent + '<PARAM NAME = "NAME" VALUE = "StatisticalApplet">';
        StoryContent = StoryContent + '<PARAM NAME = "MAYSCRIPT" VALUE = true>';
        StoryContent = StoryContent + '<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">';
        StoryContent = StoryContent + '<PARAM NAME="scriptable" VALUE="false">';
        StoryContent = StoryContent + '<PARAM NAME = "UserName" VALUE = "' + jUserName + '">';
        StoryContent = StoryContent + '<PARAM NAME = "Password" VALUE = "' + jPassword + '">';
        StoryContent = StoryContent + '<PARAM NAME = "Source" VALUE ="Shop">';
        StoryContent = StoryContent + '<PARAM NAME = "SecurityID" VALUE ="' + jGUID + '">';
        StoryContent = StoryContent + '<B>This application requires a browser that supports Java.</B>';
        StoryContent = StoryContent + '</OBJECT>';      
      StoryWindow.innerHTML = StoryContent;
      
    }
 
	else if (NS6 || NS6up) {
	 
	  StoryContent = StoryContent + '<EMBED type="application/x-java-applet;version=1.3" CODE="com.wil.shop.applets.statisticals.zStatisticalApplet" CODEBASE="http://www.westerninspection.com/WILWebApps/" ARCHIVE="jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3_min-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar" NAME="WILStatClient" WIDTH="613" HEIGHT="263" MAYSCRIPT="true" UserName="' + jUserName + '" Password="' + jPassword + '" GUID="' + jGUID + '" Source = "Shop" scriptable="false" pluginspage="http://dlres.java.sun.com/PluginBrowserCheck"><NOEMBED>';
//	  StoryContent = StoryContent + '<EMBED type="application/x-java-applet;version=1.3" CODE="com.wil.shop.applets.statisticals.zStatisticalApplet" CODEBASE="http://192.168.0.171/WILWebApps/" ARCHIVE="jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3_min-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar" NAME="WILStatClient" WIDTH="613" HEIGHT="263" MAYSCRIPT="true" UserName="' + jUserName + '" Password="' + jPassword + '" GUID="' + jGUID + '" Source = "Shop" scriptable="false" pluginspage="http://dlres.java.sun.com/PluginBrowserCheck"><NOEMBED>';
	  StoryContent = StoryContent + '<B>This application requires a browser that supports Java.</B>';
	  StoryContent = StoryContent + '</NOEMBED></EMBED>';
	
	  StoryWindow = document.getElementById("StoryWindow")
	  StoryWindow.innerHTML = StoryContent;

    }
  
    else {

      StoryContent = StoryContent + '<APPLET CODE = "com.wil.shop.applets.statisticals.zStatisticalApplet" CODEBASE = "http://www.westerninspection.com/WILWebApps/" ARCHIVE = "jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3_min-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar" WIDTH = "613" HEIGHT = "263" NAME = "WILStatClient" MAYSCRIPT>';
//      StoryContent = StoryContent + '<APPLET CODE = "com.wil.shop.applets.statisticals.zStatisticalApplet" CODEBASE = "http://192.168.0.171/WILWebApps/" ARCHIVE = "jars/WILShopApplets.jar,jars/WILCommon.jar,jars/WILBeans.jar,jars/WILUtil.jar,jars/xstream-1.1.2.jar,jars/xpp3_min-1.1.3.4.O.jar,jars/LwVCL.jar,jars/LwVCLExt.jar" WIDTH = "613" HEIGHT = "263" NAME = "WILStatClient" MAYSCRIPT>';
      StoryContent = StoryContent + '<PARAM NAME = "UserName" VALUE ="' + jUserName + '">';
      StoryContent = StoryContent + '<PARAM NAME = "Password" VALUE ="' + jPassword + '">';
      StoryContent = StoryContent + '<PARAM NAME = "GUID" VALUE ="' + jGUID + '">';
      StoryContent = StoryContent + '<PARAM NAME = "Source" VALUE ="Shop">';
      StoryContent = StoryContent + '<B>This application requires a browser that supports Java.</B>';
      StoryContent = StoryContent + '</APPLET>';
    }

}


function loadapplet_AcctAdmin() {

  var StoryContent;
  StoryContent = "";
  	  
    if (IE5 || IE5up || IE5_5 || IE5_5up || IE6up || IE6up) {

      StoryContent = StoryContent + '<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"';
      StoryContent = StoryContent + 'WIDTH = "100%" HEIGHT = "100%" NAME = "WILAcctAdminClient" ALIGN = "left" VSPACE = "0" HSPACE = "0"  codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2_03-windows-i586.cab#version=1,3,1,0">';
      StoryContent = StoryContent + '<PARAM NAME = CODE VALUE = "wilacctadminclient.Applet1" >';
      StoryContent = StoryContent + '<PARAM NAME = CODEBASE VALUE = "." >';
      StoryContent = StoryContent + '<PARAM NAME = ARCHIVE VALUE = "scripts/WILAcctAdminClient.jar,scripts/jdom.jar,scripts/xml-apis.jar,scripts/xercesImpl.jar,scripts/jObjectFactory.jar,scripts/WILFetchers.jar" >';
      StoryContent = StoryContent + '<PARAM NAME = NAME VALUE = "WilAcctAdminClient" >';
      StoryContent = StoryContent + '<PARAM NAME = MAYSCRIPT VALUE = true >';
      StoryContent = StoryContent + '<PARAM NAME = "type" VALUE="application/x-java-applet;version=1.4">';
      StoryContent = StoryContent + '<PARAM NAME = "scriptable" VALUE="false">';
      StoryContent = StoryContent + '<PARAM NAME = "UserName" VALUE ="' + jUserName + '">';
      StoryContent = StoryContent + '<PARAM NAME = "Source" VALUE ="' + jSource + '">';
      StoryContent = StoryContent + '<PARAM NAME = "Password" VALUE ="' + jPassword + '">';
      StoryContent = StoryContent + '<PARAM NAME = "GUID" VALUE ="' + jGUID + '">';
      StoryContent = StoryContent + '<B>This application requires a browser that supports Java.</B>';
      StoryContent = StoryContent + '</OBJECT>';
      
      StoryWindow.innerHTML = StoryContent;
      
    }
 
	else if (NS6 || NS6up) {
	 
	  StoryContent = StoryContent + '<EMBED type="application/x-java-applet;version=1.4" CODE="wilacctadminclient.Applet1" CODEBASE="." ARCHIVE="scripts/WILAcctAdminClient.jar,scripts/jdom.jar,scripts/xml-apis.jar,scripts/xercesImpl.jar,scripts/jObjectFactory.jar,scripts/WILFetchers.jar" NAME="Applet1" WIDTH="613" HEIGHT="263" MAYSCRIPT="true" UserName="' + jUserName + '" Password="' + jPassword + '" GUID="' + jGUID + '" Source = "' + jSource + '" scriptable="false" pluginspage="http://dlres.java.sun.com/PluginBrowserCheck"><NOEMBED>';
	  StoryContent = StoryContent + '<B>This application requires a browser that supports Java.</B>';
	  StoryContent = StoryContent + '</NOEMBED></EMBED>';
	
	  StoryWindow = document.getElementById("StoryWindow")
	  StoryWindow.innerHTML = StoryContent;

    }
  
    else {
      StoryContent = StoryContent + '<APPLET CODE = "wilacctadminclient.Applet1" CODEBASE = "." ARCHIVE = "scripts/WILAcctAdminClient.jar,scripts/jdom.jar,scripts/xml-apis.jar,scripts/xercesImpl.jar,scripts/jObjectFactory.jar,scripts/WILFetchers.jar" WIDTH = "613" HEIGHT = "263" NAME = "Applet1" MAYSCRIPT>';
      StoryContent = StoryContent + '<PARAM NAME = "UserName" VALUE ="' + jUserName + '">';
      StoryContent = StoryContent + '<PARAM NAME = "Password" VALUE ="' + jPassword + '">';
      StoryContent = StoryContent + '<PARAM NAME = "GUID" VALUE ="' + jGUID + '">';
      StoryContent = StoryContent + '<PARAM NAME = "Source" VALUE ="' + jSource + '">';
      StoryContent = StoryContent + '<B>This application requires a browser that supports Java.</B>';
      StoryContent = StoryContent + '</APPLET>';
    }

}


function setFocus() {

  if (IE5 || IE5up || IE5_5 || IE5_5up || IE6 || IE6up) {

    document.all.UserID.select();
    document.all.UserID.focus();

  }

  else if (NS6 || NS6up) {

    document.LoginForm.UserID.focus();
//  document.LoginForm.UserID.tabIndex = 1;
//  document.LoginForm.UserPassword.tabIndex = 2;
//  document.LoginForm.LoginButton.tabIndex = 3;

  }

}


function setFocus_pass() {

  if (document.all.OldPassword){

    document.all.OldPassword.select();
    document.all.OldPassword.focus();

  }

}


function MultiDimensionalArray(iRows,iCols) { 

  var i; 
  var j; 
  var a = new Array(iRows);
  for (i=0; i < iRows; i++) {
    a[i] = new Array(iCols);
    for (j=0; j < iCols; j++) {
      a[i][j] = "";
      
    }
    
  }
   return(a);
 }

function stop_errors(){
  return true;
   
  window.onerror = stopError;
  
  }

