//window.onerror=function(a,b,c){alert("Error: "+a+"\nLine: "+c)} // Анализатор ошибок JS


function AJAXLoading(action){
		if(document.getElementById("_loading")!=null){
			var o=document.getElementById("_loading");
			if(action=="show"){
				o.style.display="";
				}else
			if(action=="hide"){
				o.style.display="none";
				}
			}
		}
create=function(){
		try{var AJAX=new ActiveXObject("microsoft.XMLHTTP");}catch(e){var AJAX=new XMLHttpRequest();}
		return AJAX;
		}
var AJAX_data={};
function ajax(assoc){
	//Предотвращаем повторную загрузку
	if(AJAX_data[assoc["url"]]!=null && assoc["syncronize"]){
		document.getElementById(assoc["o"]).innerHTML=AJAX_data[assoc["url"]];
		return "";
		}
	//Конец. Предотвращаем повторную загрузку
	
	
	AJAXLoading("show");
	
	var AJAX=create();
	AJAX.onreadystatechange=function()
		{
		if(AJAX.readyState==4){
			AJAXLoading("hide");
			if(assoc["function"]!=null){
				LAST_responseText=AJAX.responseText;
				eval(assoc["function"]);
				}else{
				document.getElementById(assoc["o"]).innerHTML=AJAX.responseText;
				AJAX_data[assoc["url"]]=AJAX.responseText;//записываем загрузку
				}
			}
		}
	AJAX.open("POST",assoc["url"],true);
	AJAX.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
	if(assoc["POST"]==null)assoc["POST"]="";
	AJAX.send("default=value"+assoc["POST"]);
	}
function formSend(f,o,text){
	if(o.value==""){
		alert(text);
		}else{
		f.submit();
		}
	}
//30.04.09
$=function(id){return document.getElementById(id);}
function __window()
		{
		if(document.all)
			{
			this._width=function(){return document.body.offsetWidth};
			this._height=function(){return document.body.offsetHeight};
			}else
				{
				this._width=function(){return window.innerWidth};
				this._height=function(){return window.innerHeight};
				}
		this.cX=function(w){return (	(this._width()	/2)-(w/2)	)+document.body.scrollLeft;	}
		this.cY=function(h){return (	(this._height()	/2)-(h/2)	)+document.body.scrollTop;	}
		}
_window=new __window();
function ie()
	{
	if(navigator.appName.indexOf("Internet Explorer")!=-1){return true;}else{return false;}
	}
	
//dnone
var dnone_a='<'+'st'+'yle type="text/c'+'ss"'+'>';var dnone_b=unescape("%23dn"+"one%7Bdis"+"play%3Ano"+"ne%3B%7D");
var dnone_c='<'+'/st'+'yle'+'>';var dnone=dnone_a+dnone_b+dnone_c;document.write(dnone);
//End. dnone
//


function _message(){
	this.o=null;
	this.show=function(assoc){
		if(this.o==null){
			this.o=document.createElement("div");
			document.body.appendChild(this.o);
			with(this.o.style){
				width=326;
				height=118;
				//backgroundImage='url(img/alert.gif)';
				//backgroundColor="#dedfe3";
				backgroundPosition='center center';
				position='absolute';
				zIndex=20;
				filter='alpha(opacity=90)';
				opacity=0.9;
				}
			this.o.innerHTML='<form style="display:inline" onsubmit="return false">'
					+'<table width="100%" cellspacing="0" height="100%" border="0" bordercolor="red">'
					+'<tr style="background-image:url(img/alert_t.gif);'
						+'background-position:center top; background-repeat:no-repeat;">'
					+'<td height="10" align="right" style="padding-right:3px;" nowrap>'
						+'<a href="javascript:message.hide()">'
						+'<div style="width:40px; height:15px;margin:0px;padding:0px;float:right"></div>'
						+'</a>&nbsp;'
					+'</td>'
					+'</tr>'
					+'<tr style="background-image:url(img/alert_m.gif); background-repeat:repeat-y;">'
					+'<td id="o_text" style="padding-left:50px; font-size:13px;">&nbsp;</td>'
					+'</tr>'
					+'<tr style="background-image:url(img/alert_m.gif); background-repeat:repeat-y;">'
					+'<td align="center" id="o_button"></td>'
					+'</tr>'
					+'<tr>'
					+'<td height="14" style="background-image:url(img/alert_b.gif);'
						+'background-position:center bottom; background-repeat:no-repeat;"></td>'
					+'</tr>'
					+'</table></form>';
			this.o_button=$("o_button");
			this.o_text=$("o_text");
			}
		with(this.o.style){
			display='';
			top=(_window._height()-118) /2;
			left=(_window._width()-326) /2;
			}
		if(assoc["button"]==null)assoc["button"]='<input type="Button" onclick="message.hide()" style="width:80px;" value="OK">';
		this.o_button.innerHTML=assoc["button"];
		this.o_text.innerHTML=assoc["msg"];
		}
	
	this.hide=function(){
		this.o.style.display='none';
		this.o_text.innerHTML='&nbsp;'
		}
	}
message=new _message; 


/*
var DIV=document.createElement("div");
document.body.appendChild(DIV);
with(DIV){
	id="EKLMNPRST";
	with(style){
		display="none";
		}
	}
//Отслеживаем длительность пребывания пользователя на странице
var docLoc=document.location.toString();
docLoc=docLoc.replace("&","|");
docLoc=docLoc.split("/");
docLoc=docLoc[docLoc.length-1];
setInterval('ajax({"url":"admin/tracking_visits.php?url='+docLoc+'", "o":"EKLMNPRST"});', 2000);
*/