function ShowDiv(id){
	//$(id).fadeIn("slow");
	if (navigator.appName == "Opera"){
		document.getElementById(id).style.display = 'block'
	}else{
		
		//$(id).fadeIn("slow");
		$("#"+id).fadeIn("slow");
		
	}
}
function HideDiv(id){
	//$(id).fadeOut("slow");
		if (navigator.appName == "Opera"){
		document.getElementById(id).style.display = 'none'
	}else{
		//$(id).fadeOut("slow");
		$("#"+id).fadeOut("slow");
	}
}
function HideLoad(id){
	document.getElementById(id).style.display = 'none';
}
function LightTr(id){
	document.getElementById(id).className = 'light_but';
}
function DisLightTr(id){
	document.getElementById(id).className = 'dis_light_but';
}
function LightTrT(id){
	document.getElementById(id).className = 'light_tr';
}
function DisLightTrT(id){
	document.getElementById(id).className = 'dis_light_tr';
}
//*обновляем капчу*//
	function image_reload(version){
		document.images[version].src='/captcha.php?rnd='+Math.round(Math.random(0)*1000);
	}
	
//*Проверка на доступность лонгина*//
	function CheckLogin(nId) {
        JsHttpRequest.query(
            '/include/ajax/check_login.php', 
            {

                'str': document.getElementById(nId).value
            },

            function(result, errors) {
            		HideLoad('loadingQuery');

						document.getElementById("loginVal").innerHTML = result["res"];
						
						if (typeof document.attachEvent != 'undefined'){
							document.getElementById(nId).attachEvent('onchange',function (){CheckLogin(nId),false});
						}
						

            },
            false,
            'loadingQuery' 
        );
    }
    	

//*Проверка капчи*//
	function checkCode(nId,sFormName) {
        JsHttpRequest.query(
            '/include/ajax/checkCode.php', 
            {
                'str': document.getElementById(nId).value
            },
            function(result, errors) {
            	if(result["res"] != 'OK'){
            		HideLoad('loadingQuery');
		
						ShowDiv("errDiv");
						document.getElementById("errText").innerHTML=  result["res"];						
            	}else{
            		document.getElementById('check_'+sFormName).submit();
            	}
            },
            false,
            'loadingQuery' 
        );
    }
   
var nTimerId;
function getPageOffset(o){
	var KL_left=0
	var KL_top=0
	do{
		KL_left+=o.offsetLeft     				
		KL_top+=o.offsetTop   				
	}
	while(o = o.offsetParent)   				
	return [KL_left, KL_top] 			
}  			
function getAbsoluteLeft(oObj){   				
	var o = oObj   				
	return getPageOffset(o)[0] 			
} 			 			
function getAbsoluteTop(oObj){   				
	var o = oObj   				
	return getPageOffset(o)[1] 			
} 			 			 			
function setMenuDivPos(oObj, oObjDiv){ 				
	var nleft = getAbsoluteLeft(oObj) 				
	var nTop = 	getAbsoluteTop(oObj) 				 				
	var oDiv = document.getElementById(oObjDiv).style.left = nleft - 300 + 'px' 				
	var oDiv = document.getElementById(oObjDiv).style.top = nTop + 25 + 'px' 				 				
	showDiv(oObjDiv) 			
} 			 			
function showDiv(oObjDiv){ 				
	document.getElementById(oObjDiv).style.display = 'block'	 				 			
} 			 			
function hideDiv(oObjDiv){ 				
	nTimerId = setTimeout('realHideDiv(\'' + oObjDiv + '\')', 1800); 				 			
} 			 			
function realHideDiv(oObjDiv){ 				
	document.getElementById(oObjDiv).style.display = 'none'		 			
} 			 			
function clearTimer(){ 				
	clearTimeout(nTimerId) 			
} 		 		


function BackHover(sId){ 	
	document.getElementById(sId).className = 'hover' 	
	//alert(document.getElementById(sId).className) 
}  
function BackHoverOff(sId){ 	
	document.getElementById(sId).className = 'normal' 	
	//alert(document.getElementById(sId).className) 
}
     
		

