var WD_CURRPG_SID="root_pressa_analitika_infrastruktura-dorogovato-budet-";
var WD_CURRPG_DIRSID="root_pressa_analitika";
var WD_CURRPG_UID="uid_4742ccb9d1934";
var WD_CURRPG_DIRUID="uid_46fb7341c571d";
var WD_CURRPG_TPL="template.html";
var WDLBL_REQFORMFIELDS="заполните все обязательные поля формы";
var WDLBL_POSTFREQRESTRICT="извините, политика сайта не позволяет отправлять сообщения чаще, чем через %restrictperiod% секунд";
var WDLBL_POSTIDENTRESTRICT="было передано сообщение, идентичное предыдущему;\nочевидно, это ошибка;\nсообщение не было принято";
var WDLBL_POSTSTRLENRESTRICT="извините, политика сайта не позволяет отправлять сообщения длиной более %restrictlen% символов;\nнекоторые сообщения были обрезаны";

var _CURSOR_HAND="pointer";
var _BR_VER=wd_detVer();
function wd_detVer() {
	if (window.opera) {
		_BR_VER="OPR";
		return _BR_VER;
	} else if (document.attachEvent) {
		if (document.execCommand) {
			if (document.createComment) {
				_BR_VER="IEN";
				return _BR_VER;
			} else {
				_BR_VER="IEN";
				return _BR_VER;
			}
		} else {
			_BR_VER="OPR";
			return _BR_VER;
		}
	} else if (document.addEventListener) {
		_BR_VER="NNN";
		return _BR_VER;
	} else {
		_BR_VER="OLD";
		return _BR_VER;
	}
}
function wd_retScrSizes(){var answer=new Array();if (_BR_VER=="NNN"){answer[0]=window.innerWidth;answer[1]=window.innerHeight;answer[2]=window.pageXOffset;answer[3]=window.pageYOffset;}else{answer[0]=document.body.clientWidth;answer[1]=document.body.clientHeight;answer[2]=document.body.scrollLeft;answer[3]=document.body.scrollTop;}return answer;}
//==============================================================================
function amg_ModalWin(sSrc, iWidth, iHeight, sWinName, iXOffset) {
	if (!iXOffset) iXOffset=0; iXOffset=parseInt(iXOffset);
	if (!sWinName) var sWinName=null;
	iWidth=parseInt(iWidth);
	iHeight=parseInt(iHeight);
	var sw=screen.availWidth; var sh=screen.availHeight;
	if ((iWidth+20)>sw) iWidth=sw-20;
	if ((iHeight+24)>sh) iHeight=sh-24;
	var ww=iWidth+20; var wh=iHeight+24;
	// ====
	var sResize="no";
	if (ww>800) {
		ww=800; sResize="yes";
	}
	if (wh>600) {
		wh=600; sResize="yes";
	}
	// ====
	var wx=(sw-ww)/2; if (wx<0) wx=0;
	var wy=(sh-wh)/2; if (wy<0) wy=0;
	wx+=iXOffset;
	// ================================
	var sFlusher=""; while (sFlusher.length<12) sFlusher+="&nbsp;";
	// ================================
	var bu=window.open("about:blank", sWinName, "left="+wx+",top="+wy+",width="+ww+",height="+wh+",location=no,menubar=no,resizable="+sResize+",status=no,titlebar=yes,toolbar=no");
	bu.focus();
	if (sSrc!=="about:blank") {
		var sExtntn=sSrc.substr(sSrc.lastIndexOf(".")).toUpperCase();
		if (sExtntn==".GIF"||sExtntn==".PNG"||sExtntn==".JPG"||sExtntn==".GPEG"||sExtntn==".BMP") {
			bu.document.open();
			bu.document.write("<HTML><HEAD><TITLE>&nbsp;"+"site image viewer"+sFlusher+"</TITLE></HEAD><BODY SCROLL='"+sResize+"' ONSELECTSTART='return false;' ONSELECT='return false;' ONCONTEXTMENU='return false;' ONCLICK='self.close();' ONBLUR='self.close();'><IMG SRC='"+sSrc+"' BORDER='0'></BODY></HTML>");
			bu.document.close();
		} else {
			bu.document.location.href=sSrc;
		}
	}
	return false;
}

function wd_ChPgSearch(sSrchStr) {
	var sPath=document.location.pathname;
	if (sPath.substr(0, 1)=="/") sPath=sPath.substr(1);
	var sNewHref="http://";
	sNewHref+=document.location.hostname+"/";
	sNewHref+=sPath+"?";
	sNewHref+=sSrchStr;
	document.location.href=sNewHref;
	return false;
}

function wd_TimeUTC() {
	var theDate=new Date();
	var iDate=Date.UTC(theDate.getYear(), theDate.getMonth(), theDate.getDate(), theDate.getHours(), theDate.getMinutes(), theDate.getSeconds());
	return iDate;
}
function wd_TimeLc() {
	var theDate=new Date();
	var iDate=theDate.getTime();
	return iDate;
}

function wd_ClientInfoStr(bArray) {
	if (!bArray) bArray=false;
	var sAnswer="";
	//
	var theDate=new Date();
	var theClient=window.navigator;
	var theScreen=window.screen;
		sAnswer+="clnt[js_ver_ms]=-";//+JS_VER_MS;
		//sAnswer+="&clnt[appCodeName]="+theClient.appCodeName;
		//sAnswer+="&clnt[appMinorVersion]="+theClient.appMinorVersion;
		//sAnswer+="&clnt[appName]="+theClient.appName;
		//sAnswer+="&clnt[appVersion]="+theClient.appVersion;
		sAnswer+="&clnt[brwsLang]="+(typeof(theClient.browserLanguage)==="undefined"?"-":theClient.browserLanguage); // current browser language
		sAnswer+="&clnt[ckEnbl]="+(typeof(theClient.cookieEnabled)==="undefined"?"-":theClient.cookieEnabled);
		sAnswer+="&clnt[cpuClass]="+(typeof(theClient.cpuClass)==="undefined"?"-":theClient.cpuClass);
		//sAnswer+="&clnt[onLine]="+theClient.onLine;
		sAnswer+="&clnt[pltfrm]="+(typeof(theClient.platform)==="undefined"?"-":theClient.platform);
		sAnswer+="&clnt[sysLang]="+(typeof(theClient.systemLanguage)==="undefined"?"-":theClient.systemLanguage); // default language used by the operating system
		//sAnswer+="&clnt[uAgent]="+theClient.userAgent;
		sAnswer+="&clnt[uLang]="+(typeof(theClient.userLanguage)==="undefined"?"-":theClient.userLanguage); // operating system's natural language setting
		sAnswer+="&clnt[scrAvW]="+(typeof(theScreen.availWidth)==="undefined"?"-":theScreen.availWidth);
		sAnswer+="&clnt[scrAvH]="+(typeof(theScreen.availHeight)==="undefined"?"-":theScreen.availHeight);
		sAnswer+="&clnt[scrClrs]="+(typeof(theScreen.colorDepth)==="undefined"?"-":theScreen.colorDepth);
		//sAnswer+="&clnt[screenUpdateInterval]="+theScreen.updateInterval;
		sAnswer+="&clnt[scrW]="+(typeof(theScreen.width)==="undefined"?"-":theScreen.width);
		sAnswer+="&clnt[scrH]="+(typeof(theScreen.height)==="undefined"?"-":theScreen.height);
		sAnswer+="&clnt[lctime]="+theDate.getTime();
		sAnswer+="&clnt[lctzn]="+theDate.getTimezoneOffset();
	//
	return sAnswer
}
function wd_FormValid(sFormName, sWinName, iWinW, iWinH) {
	var bAnswer=true;
	//
	var theForm=document.forms[sFormName];
	var theReqsArr=eval("arrReqs"+sFormName);
	if (theForm && theReqsArr) {
		var iRequired=0;
		for (iRequired=0; iRequired<theReqsArr.length; iRequired++) {
			var theEl=theForm.elements[theReqsArr[iRequired]];
			if (theEl && !theEl.value) {
				bAnswer=false;
				alert(WDLBL_REQFORMFIELDS);
				break;
			}
		}
	}
	//
	if (bAnswer && sWinName.length && iWinW && iWinH) {
		var bFalse=amg_ModalWin("about:blank", iWinW, iWinH, sWinName, 0);
	}
	//
	return bAnswer;
}
//==============================================================================
var theWdBigImgLayer = null;
function wd_BigImgLayer(sImgSrc, iImgW, iImgH, sLayerStyle, sTitleStyle, sCloseCode) {
	if (document.body) {
		if (theWdBigImgLayer && theWdBigImgLayer.tagName && theWdBigImgLayer.tagName.toUpperCase()==='DIV') {
			try {
				document.body.removeChild(theWdBigImgLayer);
			} catch (theError) {
				void(0);
			}
		}
		//
		if (sImgSrc) {
			var iR=0; var iN=0;
			//
			var arrLayerRules=new Array();
			if (!sLayerStyle) sLayerStyle="";
			var arrLayerStyle=sLayerStyle.split(";");
			for (iR=0; iR<arrLayerStyle.length; iR++) {
				arrRule=arrLayerStyle[iR].split(':');
				if (arrRule.length>1) {
					var sRuleName=arrRule[0];
					var sRuleVal=arrRule[1];
					for (iN=2; iN<arrRule.length; arrRule++) sRuleVal+=(":"+arrRule[iN]);
					arrLayerRules[sRuleName]=sRuleVal
				}
			}
			//
			var arrTitleRules=new Array();
			if (!sTitleStyle) sTitleStyle="";
			var arrTitleStyle=sTitleStyle.split(";");
			for (iR=0; iR<arrTitleStyle.length; iR++) {
				arrRule=arrTitleStyle[iR].split(':');
				if (arrRule.length>1) {
					var sRuleName=arrRule[0];
					var sRuleVal=arrRule[1];
					for (iN=2; iN<arrRule.length; arrRule++) sRuleVal+=(":"+arrRule[iN]);
					arrTitleRules[sRuleName]=sRuleVal
				}
			}
			//
			var theImg=document.createElement('IMG');
			theImg.src=sImgSrc;
			theImg.border=0;
			//
			var arrScrSizes=wd_retScrSizes();
			//
			theWdBigImgLayer = document.createElement('DIV');
			theWdBigImgLayer.style.display='none';
			document.body.appendChild(theWdBigImgLayer);
			//
			theWdBigImgLayer.style.position='absolute';
			theWdBigImgLayer.style.zIndex=101;
			theWdBigImgLayer.style.left='0px';
			theWdBigImgLayer.style.top='0px';
			//
			if (typeof(arrLayerRules['padding'])!=='undefined') theWdBigImgLayer.style.padding=arrLayerRules['padding'];
			if (typeof(arrLayerRules['padding-right'])!=='undefined') theWdBigImgLayer.style.paddingRight=arrLayerRules['padding-right'];
			if (typeof(arrLayerRules['padding-left'])!=='undefined') theWdBigImgLayer.style.paddingLeft=arrLayerRules['padding-left'];
			if (typeof(arrLayerRules['padding-top'])!=='undefined') theWdBigImgLayer.style.paddingTop=arrLayerRules['padding-top'];
			if (typeof(arrLayerRules['padding-bottom'])!=='undefined') theWdBigImgLayer.style.paddingBottom=arrLayerRules['padding-bottom'];
			if (typeof(arrLayerRules['background-color'])!=='undefined') theWdBigImgLayer.style.backgroundColor=arrLayerRules['background-color'];
			if (typeof(arrLayerRules['background-image'])!=='undefined') theWdBigImgLayer.style.backgroundImage=arrLayerRules['background-image'];
			if (typeof(arrLayerRules['background-position'])!=='undefined') theWdBigImgLayer.style.backgroundPosition=arrLayerRules['background-position'];
			if (typeof(arrLayerRules['background-repeat'])!=='undefined') theWdBigImgLayer.style.backgroundrepeat=arrLayerRules['background-repeat'];
			if (typeof(arrLayerRules['border-style'])!=='undefined') theWdBigImgLayer.style.borderStyle=arrLayerRules['border-style'];
			if (typeof(arrLayerRules['border-width'])!=='undefined') theWdBigImgLayer.style.borderWidth=arrLayerRules['border-width'];
			if (typeof(arrLayerRules['border-color'])!=='undefined') theWdBigImgLayer.style.borderColor=arrLayerRules['border-color'];
			//
			var theTable=document.createElement('TABLE');
			theTable.cellPadding=0;
			theTable.cellSpacing=0;
			theTable.border=0;
			if (_BR_VER==="IEN") {
				var theRow1=theTable.insertRow();
				var theCell1=theRow1.insertCell();
				var theRow2=theTable.insertRow();
				var theCell2=theRow2.insertCell();
			} else {
				var theRow1=document.createElement('TR');
				theTable.appendChild(theRow1);
				var theCell1=document.createElement('TD');
				theRow1.appendChild(theCell1);
				var theRow2=document.createElement('TR');
				theTable.appendChild(theRow2);
				var theCell2=document.createElement('TD');
				theRow2.appendChild(theCell2);
			}
			theWdBigImgLayer.appendChild(theTable);
			//
			if (typeof(arrTitleRules['padding'])!=='undefined') theCell1.style.padding=arrTitleRules['padding'];
			if (typeof(arrTitleRules['padding-right'])!=='undefined') theCell1.style.paddingRight=arrTitleRules['padding-right'];
			if (typeof(arrTitleRules['padding-left'])!=='undefined') theCell1.style.paddingLeft=arrTitleRules['padding-left'];
			if (typeof(arrTitleRules['padding-top'])!=='undefined') theCell1.style.paddingTop=arrTitleRules['padding-top'];
			if (typeof(arrTitleRules['padding-bottom'])!=='undefined') theCell1.style.paddingBottom=arrTitleRules['padding-bottom'];
			if (typeof(arrTitleRules['background-color'])!=='undefined') theCell1.style.backgroundColor=arrTitleRules['background-color'];
			if (typeof(arrTitleRules['background-image'])!=='undefined') theCell1.style.backgroundImage=arrTitleRules['background-image'];
			if (typeof(arrTitleRules['background-position'])!=='undefined') theCell1.style.backgroundPosition=arrTitleRules['background-position'];
			if (typeof(arrTitleRules['background-repeat'])!=='undefined') theCell1.style.backgroundrepeat=arrTitleRules['background-repeat'];
			if (typeof(arrTitleRules['color'])!=='undefined') theCell1.style.color=arrTitleRules['color'];
			if (typeof(arrTitleRules['text-align'])!=='undefined') theCell1.style.textAlign=arrTitleRules['text-align'];
			if (typeof(arrTitleRules['height'])!=='undefined') theCell1.style.height=arrTitleRules['height'];
			//
			var theDiv2=document.createElement('DIV');
			theDiv2.style.padding="0px";
			theDiv2.style.margin="0px";
			theDiv2.style.width=iImgW+'px';
			theDiv2.style.height=iImgH+'px';
			theDiv2.appendChild(theImg);
			theCell2.appendChild(theDiv2);
			//
			theCell1.innerHTML="<span onclick=\"wd_BigImgLayer('');\" style=\"cursor:"+_CURSOR_HAND+";\">"+sCloseCode+"</span>";
			theWdBigImgLayer.style.display='block';
			//
			var iLeft=((arrScrSizes[0]-parseInt(theWdBigImgLayer.offsetWidth))/2+arrScrSizes[2]);
			if (!iLeft) iLeft=0;
			while (iLeft<0) iLeft+=5;
			theWdBigImgLayer.style.left=iLeft+'px';
			var iTop=((arrScrSizes[1]-parseInt(theWdBigImgLayer.offsetHeight))/2+arrScrSizes[3]);
			if (!iTop) iLeft=0;
			while (iTop<0) iTop+=5;
			theWdBigImgLayer.style.top=iTop+'px';
		}
	}
}