function Go2CO(form){   
	SubmitForm(this.form, 'https://www.2checkout.com/cgi-bin/sbuyers/purchase.2c', true) 
}
function EvalLogPass(ctrl) {
    S= Trim(ctrl.value);
    len= S.length;

	latlet="0123456789_-qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
    for( i=0; i< len; i++) {
        if (latlet.indexOf( S.charAt(i))< 1) {
   	    alert("Login and password must consist\r  of latin letters and numbers only"); ctrl.focus();
   		break;
        }
    }
    if (len== 0)	{
        alert ("Blank login or password");
    } else {
        if (len< 4 || len> 16) 
		alert("Login and password must  consist of 4-16 characters");
    }

//	if err==true { ctrl.focus();}
}

//== Запустить скрипт, описанный в sAction от имени формы form ===
function SubmitForm(form, sAction, addWidth) { 
    if (addWidth) sAction= sAction+ "&wid="+ window.screen.width;
    form.action= sAction;
    form.submit();
}
//================================
function Trim(s) {
  while (s.substring(0,1) == ' ') {
    s= s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0, s.length-1);
  }
  return s;
}
// Не используется
function EvalLogin(name) {
nam= Trim(name.value);
if (nam== '')	{ 
	alert ("Incorect (blank) Login or Password");
	name.focus();
} else {
	len=  nam.length;
	if (len< 6 || len> 12) {
		alert("Both Login and Password must\n consist of 6..12 letters/digits"); name.focus();
	}
 }
}

function RunDemo(form, S)
{
form.hdLogin.value= "demo";
form.hdPass.value= "demo";
RunReport(form, S)
}

//===================
// Запустить рипорт от имени формы form
//===================
function RunReport(form, S)
{ 
 var ScrWid= window.screen.width;
 S= "cgi-bin/dispatch.exe?"+S+ "&wid="+ ScrWid;
 form.action= S;
 form.submit();
 }

function RunScript(form, S)
{ 
 form.action= S+ "&wid="+ window.screen.width;
 form.submit();
}

function RunURL( S)
{ 
	var ScrWid= window.screen.width;
	S= "cgi-bin/dispatch.exe?"+ S+ "&wid="+ ScrWid;
	window.navigate(S);
 }

function HideStatus(msg){
 window.status=msg;
return true;
}
function ShowImg(fn, wid, hei){
 wid= wid+ 10; hei=hei+15;
 window.open(fn, 'myWin', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=no, scrollbars=no,width='+ wid+', height='+hei);
}
//==========================================
function CreateCookie(doc, name, value, days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	doc.cookie = name+"="+ value+ expires+"; path=/";
}

function EraseCookie(doc, name) {
    CreateCookie(doc, name,"",-1); 
}

function SaveCookie(doc, cname, cvalue) {    
    CreateCookie(doc, cname, cvalue, 360);
}

function RememberTZ(doc, RES_TZ) {    
    CreateCookie(doc, "RES_TZ", RES_TZ, 360);
}

//=======================================
stuHover = function() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
	var getElm = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<getElm.length; i++) {
		getElm[i].onmouseover=function() {
			this.className+=" iehover";
		}
		getElm[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", stuHover);


