<!--	

function verify_browser_type() {	
	
	// start of previous verison 05-31-2001
	// set variables equal to browser
	// name and version and add another equal
	// to the integer portion of version
	
	//var browser=navigator.appName; 
	//var version=navigator.appVersion; 
	//var vnum=version.substring(0,1); 
	
	//if ( (browser == "Microsoft Internet Explorer") && (vnum >= 4))
	//	{			
	//		return true;
	//	}
	//else 
	//	{
	//		alert("This site is optimized for Microsoft Internet Explorer version 4 and above.\nYou are being redirected to the Previous Site. Press ENTER to Continue");
	//		location.replace("http://home.intcomex.com");
	//	}
	// end of previous version

	var bd = new BrowserDetector(navigator.userAgent);

	//  if (bd.browser == "Netscape") {
	//    location = "ns_version.html";
	//  }
	//  else if (bd.browser == "IE") {
	//    location = "ie_version.html";
	//  }

	//alert (bd.browser); "IE" "Netscape" "Opera" "Lynx"
	//alert (bd.platform); "Windows NT 5.0" "Windows 2000"
	//alert (bd.version); "5.5" "5.0" "5.11" 4.76"
	//alert (bd.majorver); "5" "5" "5" "4"
	//alert (bd.minorver); "5" "0" "11" 76"
	
	if 	( ( (bd.browser == "IE") && (bd.majorver >= 4) ) || ( (bd.browser == "Netscape") && (bd.majorver >= 5) ) || ( (bd.browser == "Opera") && (bd.majorver >= 5) ) )
		{				
			return true;
		}
	else 
		{
			alert("This site has been designed only for CSS-compatible browsers. Please update your browser to the latest version.\nYou are going to be redirected to the Previous Site. Press ENTER to Continue");
			location.replace("http://home.intcomex.com");
		}
		
}

var verify_browser = verify_browser_type();


/*
BrowserDetector()
Parses User-Agent string into useful info.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Richard Blaylock
Author Email: blaylock@wired.com

Usage: var bd = new BrowserDetector(navigator.userAgent);
*/


// Utility function to trim spaces from both ends of a string
function Trim(inString) {
  var retVal = "";
  var start = 0;
  while ((start < inString.length) && (inString.charAt(start) == ' ')) {
    ++start;
  }
  var end = inString.length;
  while ((end > 0) && (inString.charAt(end - 1) == ' ')) {
    --end;
  }
  retVal = inString.substring(start, end);
  return retVal;
}

function BrowserDetector(ua) {

// Defaults
  this.browser = "Unknown";
  this.platform = "Unknown";
  this.version = "";
  this.majorver = "";
  this.minorver = "";

  uaLen = ua.length;

// ##### Split into stuff before parens and stuff in parens
  var preparens = "";
  var parenthesized = "";

  i = ua.indexOf("(");
  if (i >= 0) {
    preparens = Trim(ua.substring(0,i));
        parenthesized = ua.substring(i+1, uaLen);
        j = parenthesized.indexOf(")");
        if (j >= 0) {
          parenthesized = parenthesized.substring(0, j);
        }
  }
  else {
    preparens = ua;
  }

// ##### First assume browser and version are in preparens
// ##### override later if we find them in the parenthesized stuff
  var browVer = preparens;

  var tokens = parenthesized.split(";");
  var token = "";
// # Now go through parenthesized tokens
  for (var i=0; i < tokens.length; i++) {
    token = Trim(tokens[i]);
        //## compatible - might want to reset from Netscape
        if (token == "compatible") {
          //## One might want to reset browVer to a null string
          //## here, but instead, we'll assume that if we don't
          //## find out otherwise, then it really is Mozilla
          //## (or whatever showed up before the parens).
        //## browser - try for Opera or IE
    }
        else if (token.indexOf("MSIE") >= 0) {
      browVer = token;
    }
    else if (token.indexOf("Opera") >= 0) {
      browVer = token;
    }
        //'## platform - try for X11, SunOS, Win, Mac, PPC
    else if ((token.indexOf("X11") >= 0) || (token.indexOf("SunOS") >= 0) ||
(token.indexOf("Linux") >= 0)) {
      this.platform = "Unix";
        }
    else if (token.indexOf("Win") >= 0) {
      this.platform = token;
        }
    else if ((token.indexOf("Mac") >= 0) || (token.indexOf("PPC") >= 0)) {
      this.platform = token;
        }
  }

  var msieIndex = browVer.indexOf("MSIE");
  if (msieIndex >= 0) {
    browVer = browVer.substring(msieIndex, browVer.length);
  }

  var leftover = "";
  if (browVer.substring(0, "Mozilla".length) == "Mozilla") {
    this.browser = "Netscape";
        leftover = browVer.substring("Mozilla".length+1, browVer.length);
  }
  else if (browVer.substring(0, "Lynx".length) == "Lynx") {
    this.browser = "Lynx";
        leftover = browVer.substring("Lynx".length+1, browVer.length);
  }
  else if (browVer.substring(0, "MSIE".length) == "MSIE") {
    this.browser = "IE";
    leftover = browVer.substring("MSIE".length+1, browVer.length);
  }
  else if (browVer.substring(0, "Microsoft Internet Explorer".length) ==
"Microsoft Internet Explorer") {
    this.browser = "IE"
        leftover = browVer.substring("Microsoft Internet Explorer".length+1,
browVer.length);
  }
  else if (browVer.substring(0, "Opera".length) == "Opera") {
    this.browser = "Opera"
    leftover = browVer.substring("Opera".length+1, browVer.length);
  }

  leftover = Trim(leftover);

  // # Try to get version info out of leftover stuff
  i = leftover.indexOf(" ");
  if (i >= 0) {
    this.version = leftover.substring(0, i);
  }
  else
  {
    this.version = leftover;
  }
  j = this.version.indexOf(".");
  if (j >= 0) {
    this.majorver = this.version.substring(0,j);
    this.minorver = this.version.substring(j+1, this.version.length);
  }
  else {
    this.majorver = this.version;
  }


} // function BrowserDetector

function validate_login(cur)

	// Make sure that the user has entered values into both
	// the username and password fields.
	// Otherwise, give an error and don't submit the form.

{
		if (cur.elements["username"].value == "") {
			alert("Please fill out the User name field first!!!")
			return false
		}
		if (cur.elements["password"].value == "") {
			alert("Please fill out the Password field first!!!")
			return false
		}
		return true
}

function newwindow(winname,url,varheight,varwidth,varleft,vartop) {
	// msg=window.open("","msg","height=200,width=200,left=80,top=80");
	// msg.document.write("<html><title>Windows!</title>");
	// msg.document.write("<body bgcolor='white' onblur=window.close()>");
	// msg.document.write("<center>page content here</center>");
	// msg.document.write("</body></html><p>");

	// If you just want to open an existing HTML page in the 
	// new window, you can replace win()'s coding above with:
	//window.open(url,winname,"height="+varheight+",width="+varwidth+",left="+varleft+",top="+vartop+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,alwaysRaised=yes,fullscreen=no");
	window.open(url,winname,"height="+varheight+",width="+varwidth+",left="+varleft+",top="+vartop+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,alwaysRaised=yes,fullscreen=no");	
}

function replacewindow(url) {	
		location.href=url;
}

function Refresh_companyid_to_search (callerform) {
	
	var companyid_to_search;
	
	companyid_to_search = "";
	
	for (var i = 0; i < callerform.companyid_temp.options.length; i++) 
	{   
	
		//alert(document.Inventory_Form.companyid_temp.options[i].text);
				
		if (callerform.companyid_temp.options[i].selected)
		{
		
			// ALL
			if (callerform.companyid_temp.options[i].value == "ALL")
			{
				companyid_to_search = "ALL";
				break;
			}
			//			
			else
			// AFFILIATES
			if (callerform.companyid_temp.options[i].value == "AFFILIATES")
			{
				companyid_to_search = "AFFILIATES";
				break;
			}
			//
			else			
			if (companyid_to_search == "")
			{
				companyid_to_search = companyid_to_search + "'" + callerform.companyid_temp.options[i].value + "'" 
			}
			else
			{
				companyid_to_search = companyid_to_search + "," + "'" + callerform.companyid_temp.options[i].value + "'" 
			}			
		}
	} 

	//callerform.promptex-@companyid_to_search.value = companyid_to_search;
	//callerform.prompt0.value = companyid_to_search;
	callerform.elements[0].value = companyid_to_search;

}


/* This function generates a new window which is modal
   Modal means the child window must be closed before 
   the parent window can be accessed again. */
   
//window.showModalDialog('http:\/\/dvlp.intcomex.com/employees/purchasing/inventoryppT.rpt'+'prompt0="'+companyid_to_search+'"&prompt1="%"&prompt2="%"&prompt3="wdcc"', , 'DialogWidth:100em; DialogHeight:100em; resizable:yes; status:no; ');

//Dim NewParamValue, URLline
//This report requires a datetime value, but we've only got Year, Month, and Day,
//so assume the time is Midnight:                                                                    
//NewParamValue = "DateTime(" + request.form.item("prompt2") + "," + request.form.item("prompt0") + "," + request.form.item("prompt1") + ",0,0,0)"
//response.write NewParamValue
//URLline = "PickaDate.rpt?prompt0="+NewParamValue
//response.redirect (URLline)

// -->

