/*
	Subject		: Check various things on browser
	Author		: YBO 
	Last change	: 01/10/2001
	Last change	: 14/11/2006 Handle ICH

*/

var whitespace = " \t\n\r";
var wndT=null;
var wndP=null;
var wndI=null;
var xusr=null;
loginform.action="customers.asp"

function Check_Browser()
{
var browser=navigator.appName;
var client_os=navigator.platform;
if (client_os.substring(0,3) != "Win")
	{
	alert ("We are sorry, but we support only Windows platform");
	return false;
}

var agt=navigator.userAgent.toLowerCase();
var isNetscape = (agt.indexOf("netscape")!= -1);
var isOpera = (agt.indexOf("opera")!= -1);
var isFirefox = (agt.indexOf("firefox")!= -1);
if (isNetscape || isOpera || isFirefox)
{
	alert ("We are sorry, but we do not support your browser at this time");
	return false;
}
var version=(isNetscape) ? parseFloat(navigator.appVersion) : parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+4, navigator.appVersion.length));
var browserOK=(isNetscape)?(version >= 4.06):(browser.indexOf("Internet Explorer")!= -1)?(version >= 4.0):false;
var browserIE7=(browser.indexOf("Internet Explorer")!= -1)?(version < 7.0):false;

/* if (!browserIE7)	
{
	alert ("Your browser ("+browser+" v."+version+")\nis not yet supported in this application");
	return false;
} */

if (!browserOK)	
{
	alert ("Your browser ("+browser+" v."+version+")\nis too old to use this application");
	return false;
}
return true;
}

function Check_Java()
{
if (!navigator.javaEnabled())
	{
	alert ("In order to use this application,\nyou need to install-enable Java machine on your browser");
	return false;
	}

return true;
}

// Check whether string s is empty.
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
// Returns true if string s is empty or 
// whitespace characters only.
function isWhitespace (s)
{   var i;
    // Is s empty?
    if (isEmpty(s)) return true;
    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }
    // All characters are whitespace.
    return true;
}

function Verif()
{
if (!Check_Browser()) 	return(false);
if (!Check_Java()) 	return(false);

var usr=document.all.Userid.value;
var psw=document.all.Password.value;
if ( isWhitespace(usr) )
{
	alert("You should enter your Userid");
	return(false);
}
if ( usr.length < 6 )
{
	alert("Your userid is not valid");
	return(false);
}
if ( isWhitespace(psw) )
{
	alert("You should enter your Password");
	return(false);
}

loginform.action="customers1.asp"

return(true);
}
