function menu(menu){
	var src = document.getElementById(menu);
	src.bgColor = (src.bgColor=="#8b9399")? "#e00066":"#8b9399";
}

function menuOver(imgName,menuName){
	if(document.images){
		eval('document.menu' + imgName + '.src="pictures/menu' + menuName + '.gif"');
	}
}

function new_win(url,w,h) {
var w1=window.open('','zoom_window','resizable=no,menubar=no,status=no,scrollbars=no,width=1,height=1');
w1.close();
ScrWindow=window.open('zoom.html','zoom_window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=15,top=15,width='+w+',height='+h);
if (ScrWindow != null && ScrWindow.opener == null) ScrWindow.opener=window;
	ScrWindow.document.open();
	ScrWindow.document.writeln ("<html><head><title></title></head><meta HTTP-EQUIV='Content-Type' content='text/html; charset=windows-1251'><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>"+
	"<a href='javascript:window.close()'><img src='"+url+"' alt='CLose' border='0'></a>"+
	"</body></html>");
	ScrWindow.document.close();
ScrWindow.onload=ScrWindow.focus;
ScrWindow.focus();
}

var isNN6=(navigator.appName=="Netscape" && parseFloat(navigator.appVersion)>=5)?true:false;
var mozilla=(navigator.appName=="Netscape" && parseFloat(navigator.appVersion)>=5)?true:false;
var timeout;
var DivSet="div0";

function ShowIt (parametr,div,div2) {
	if (parametr == true) {
		clearTimeout(timeout);hide();
		x=getDivX(div);
		setDivX(div2,x);
		DivSet=div2;
	}
	if (parametr == false) {
		timeout=setTimeout('hide()',500);
	}
}

function getDivX( szDivName ){
	if(isNN6 || mozilla){
		return document.getElementById( szDivName ).offsetLeft;
		return 0;
	} else{
		var nPos = 0;
		objCurrent = document.all[ szDivName ];
		while( objCurrent != null )
		{
			nPos += objCurrent.offsetLeft;
			objCurrent = objCurrent.offsetParent;
		}
		return nPos;
	}
}

function setDivX(DivName,x){
	if(isNN6 || mozilla){
		document.getElementById(DivName).style.left=x;
		document.getElementById(DivName).style.visibility="visible";
	} else {
		document.all[DivName].style.left=x+"px";
		document.all[DivName].style.visibility="visible";
	}
}

function hide(){
	if(isNN6 || mozilla){
		document.getElementById(DivSet).style.visibility="hidden";
	} else {
	document.all[DivSet].style.visibility="hidden";
	}
}

function string_Trim(str,l)
{
	var re;
	if (l==null)
		re=/(^\s*)|(\s*$)/gi
	else
		re=(l)?/^\s*/:/\s*$/
	return (new String(str)).replace(re,'');
}


function checkEmail (sEmail) {
	var BAD = "\\`~!#$%^&*()+|{}[]:=;'\"<>,/?";
	sEmail = string_Trim(sEmail)
	if ((sEmail.lastIndexOf ('.') == (sEmail.length - 1)) ||
		(sEmail.lastIndexOf ('.') < sEmail.lastIndexOf ('@')) ||
		(sEmail.indexOf ('.') == -1) ||
		(sEmail.substr (0, 1) == '@') ||
		(sEmail.length < 6) ||
		(sEmail.indexOf (' ') != -1) ||
		(sEmail.indexOf (' @ . ') != -1) ||
		(sEmail.indexOf (' . ') != -1) ||
		(sEmail.indexOf (' @') != -1) ||
		(sEmail.indexOf ('. ') != -1) ||
		(sEmail.indexOf (' .') != -1) ||
		(sEmail.indexOf ('_@') != -1) ||
		(sEmail.indexOf ('@_') != -1) ||
		(sEmail.indexOf ('_.') != -1) ||
		(sEmail.indexOf ('._') != -1) ||
		(sEmail.indexOf ('_@_') != -1) ||
		(sEmail.indexOf ('..') != -1) ||
		(sEmail.indexOf ('@@') != -1) ||
		(sEmail.indexOf ('@.') != -1) ||
		(sEmail.indexOf ('.@') != -1) ||
		(sEmail.substr (sEmail.length - 1, 1) == '_') ||
		(sEmail.indexOf ('@') == -1 ))
		return false ;

	var symbol ;
	var l = sEmail.length ;
	for (var i = 0 ; i < l ; i++) {
		symbol = sEmail.substr (0, 1) ;

		if (BAD.indexOf (symbol) > 0) return false ;
		if (escape (symbol) == "%5C") return false ;
		if (escape (symbol) == "%A0") return false ;
		if (escape (symbol) == "%u044F") return false ;
		sEmail = sEmail.substr (1) ;
	}
	return true ;
}

function checkEmails(sEmail)
{
	var i;
	aEmails = sEmail.split(";");
	for (i in aEmails)
	{
		if (!checkEmail(aEmails[i]))
		{
			return false;
		}

	}
	return true;

}

function win_open (file, name, win_width, win_height, string_param)
{
   xx = (screen.width - win_width -10) / 2 ;
   yy = (screen.height - win_height - 32) / 2 ;

   w_name =  window.open (file, name, string_param + ',width=' + win_width + ',height=' + win_height + ',left=' + xx + ',top=' + yy) ;
   return w_name ;
}
