// Generic Logon.html form validation V1.0
//Darren Jordan 03/2000

function isOK(msgLangUserID,msgLangPassword) {

// Check the User ID entered is numeric and of six characters
	var userID = document.validate.DBID.value;

	if (((userID.toString()).length <6) || (((userID/userID) != 1) && (userID !=0))) {
		document.validate.DBID.value = "";
		document.validate.DBID.focus();
		alert (msgLangUserID);
		return false;
	}

// Check that a password has been entered
	if ((document.validate.DBPASSWORD.value == "") || (document.validate.DBPASSWORD.value == null)) {
		document.validate.DBPASSWORD.value = "";
		document.validate.DBPASSWORD.focus();
		alert (msgLangPassword);
		return false;
	}

	var tmp,today = new Date(), o = eval("window.navigator");
	if (o != null)
	{
		tmp = ((o.appName)? (o.appName): "") + " -V:";
		tmp+= ((o.appVersion)?(o.appVersion):"") + " -On:";
		tmp+= (o.platform)?(o.platform):"";
		o = eval("window.screen");
		if (o != null)
			tmp += ":::" + o.width + "x" + o.height + ":::" + o.availWidth + "x" + o.availHeight;
	}
	Set_Cookie("log_browser", "yes", (new Date(today.getTime() + 60000)), "/");

	o = eval("document.validate.ProgLangCode");
	if (o!=null) o.value += ":::" + tmp;

	return true;
}

// Code specific to UK-EN and IR-EN logon screens only.  Hyperlink from the 'Info' icon to the help User ID section
var helpURLArray = new Array(1);
helpURLArray[0] = 'help_frame.html?help_userid.html';

function helppopup(info) {
	var helpURL = helpURLArray[info];
	window.open(helpURL , "dbaihelp" , "width=550,height=410,toolbar=no,directories=0,menubar=no,status=no,resizable=0,location=0,scrollbars=0,copyhistory=0");
	return false
}

function disableOLUS()
{
	var olusimg = null, topframe = null;
	if ((parent.frames.length != 0) &&
	   ((typeof parent.frames[0].document.storenewsearch) != "undefined") &&
	   (parent.frames[0].document.images))
	{
		olusimg = eval("parent.frames[0].document.images.go4");
		var s = parent.frames[0].document.location.href;
		s = s.substring(0,s.lastIndexOf("/")+1);
		if (olusimg != null) olusimg.src=s+"images/l4.gif";
		topframe = eval("parent.frames[0].document.storenewsearch");
		if (topframe != null)
		{
			topframe.Group.value = "";
			topframe.Session.value = "";
			topframe.validationid.value = "";
			topframe.ValidationDateTime.value = "";
			topframe.LoginDateTime.value = "";
			topframe.LinkStartDateTime.value = "";
			topframe.ProgLangCode.value = "";
			topframe.ProgCtryCode.value = "";
			topframe.productservices.value = "";
		}
	}
}

function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}
/****************** DBAI-CMIC changes start ********************/
/*
 * These variables are added to make number of Company News
 * retrieved as configurable.
 */
 var DisplayInd = 1;
 var MaxRows  = 30;

 function loadCompNewsParameters(group)
 {
    if(group == "CMIC-EN")
    {
        document.validate.displayind.value = DisplayInd;
        document.validate.maxrows.value = MaxRows;
    }
 }
