doc=document;
function getMovie(id){var M$=navigator.appName.indexOf("Microsoft")!=-1;return(M$ ? window : document)[id]}
function getClientWidth() {return doc.compatMode=='CSS1Compat' && !window.opera?doc.documentElement.clientWidth:doc.body.clientWidth;} 
function getClientHeight() {return doc.compatMode=='CSS1Compat' && !window.opera?doc.documentElement.clientHeight:doc.body.clientHeight;} 
function getCookie(name) {var cookie=" "+doc.cookie; var search=" "+name+"="; var setStr=null; var offset=0; var end=0; if (cookie.length > 0) {offset=cookie.indexOf(search); if (offset !=-1) {offset+=search.length; end=cookie.indexOf(";", offset); if (end==-1) {end=cookie.length; } setStr=unescape(cookie.substring(offset, end)); }} return(setStr);}
function getAbsolutePosition(el) {var r={ x: el.offsetLeft, y: el.offsetTop }; if (el.offsetParent) {var tmp=getAbsolutePosition(el.offsetParent); r.x+=tmp.x;	r.y+=tmp.y;} return r;}
function setCookie (name, value, expires, path, domain, secure) {doc.cookie=name+"="+escape(value)+((expires) ? "; expires="+expires : "")+((path) ? "; path="+path : "")+((domain) ? "; domain="+domain : "")+((secure) ? "; secure" : "");}
function parseCookies(){var cookieList=doc.cookie.split(";");var cookieArray=new Array();for(var i=0;i < cookieList.length;i++){var name=cookieList[i].split("=");cookieArray[unescape(name[0])]=unescape(name[1]);}return cookieArray;}
function addEvent(elem,evType,fn){if(elem.addEventListener)elem.addEventListener(evType,fn,false);else if(elem.attachEvent)elem.attachEvent('on' + evType,fn);else elem['on' + evType]=fn;}
function str_replace(search,replace,subject){return subject.split(search).join(replace);}
function reloadCaptcha () {var rndval=new Date().getTime(); 
	doc.getElementById("captcha").innerHTML='Введите код с картинки:<br> <img style="border: 1px solid #222222;" src="/captcha?rndval='+rndval+'" width="120" height="34" alt="Код" />&nbsp;';
	doc.getElementById("captchaReset").innerHTML='<br><a class="light_a" onclick="reloadCaptcha(); return false;" href="#">не вижу код</a>';	
};
function correctPNG() {
	for (var i=0; i<doc.images.length; i++) { 
		var img = doc.images[i];	
		var imgName = img.src.toUpperCase(); 
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
			var imgID = (img.id) ? "id=\"" + img.id + "\" " : ""; var imgClass = (img.className) ? "class=\""+img.className+"\" " : ""; 
			var imgTitle = (img.title) ? "title=\""+img.title+"\" " : "title=\"" + img.alt + "\" "; var imgStyle = "display:inline-block;"+img.style.cssText; 
			if (img.align == "left") imgStyle = "float:left;" + imgStyle; if (img.align == "right") imgStyle = "float:right;" + imgStyle; 
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle; 
			
			var strNewHTML = "<span "+
			imgID+imgClass+imgTitle+
			" style=\"width: "+img.width+"px; height: "+img.height+"px;"+
			imgStyle+";"+
			"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'"+img.src+"\', sizingMethod='scale');\"><img src=\"\/img\/blank.gif\" width=\"1\" height=\"1\" /></span>"; 
			if (img.src=='/img/anchor_u.png') alert(strNewHTML);
			img.outerHTML = strNewHTML;	i = i-1;
		}
	}
} 
function str_replace(search, replace, subject) {return subject.split(search).join(replace);} 
function login(id) {location.href='/login';} function logout() {location.href='/logout';}
function disableSelection(target){if (typeof target.onselectstart!="undefined") target.onselectstart=function(){return false;}; else {if (typeof target.style.MozUserSelect!="undefined") target.style.MozUserSelect="none"; else target.onmousedown=function(){return false}}} 
function enableSelection(target){if (typeof target.onselectstart!="undefined") target.onselectstart=function(){}; else {if (typeof target.style.MozUserSelect!="undefined") target.style.MozUserSelect=""; else target.onmousedown=function(){}}} 
function mousePageXY(e) {var x=0, y=0;if (!e) e = window.event;	if (e.pageX || e.pageY)	{x = e.pageX; y = e.pageY;} else if (e.clientX || e.clientY) {x = e.clientX + (doc.documentElement.scrollLeft || doc.body.scrollLeft) - doc.documentElement.clientLeft; y = e.clientY + (doc.documentElement.scrollTop || doc.body.scrollTop) - doc.documentElement.clientTop;} return {"x":x, "y":y};}

function sendLog() {//v:11.11.21
	window.setTimeout(function(){
		var p = new Array();
		p[0] = "siteid=8";
		p[1] = "x="+screen.width;p[2] = "y="+screen.height;
		p[3] = "source="+escape(doc.referrer);p[4] = "host="+escape(window.location.host);
		p[5] = "browser="+escape(navigator.appName);p[6] = "os="+escape(navigator.platform);
		var urlAnch=location.hash.substring(1,location.hash.length);if (urlAnch.length>0) var page = urlAnch; else var page = window.location.href;
		p[7]="page="+page.replace('http://'+escape(window.location.host)+'/','');
		p[8]="rnd="+Math.random();
		var logUrl="http://log.websyndicate.ru/log?"+p.join("&");
		logScriptEl = doc.createElement("script");logScriptEl.type = "text/javascript";logScriptEl.src = logUrl;
		doc.getElementById('logCont').appendChild(logScriptEl);
	},3000);
}
