var IE6=navigator.appVersion.indexOf("MSIE 6")!=-1 && navigator.appVersion.indexOf("MSIE 6")<10;

function init_panels(){
	if(IE6 && document.getElementById("panel_left"))
		window.onscroll=function (){
			obj1=document.getElementById("panel_left");
			obj2=document.getElementById("panel_right");
			status=document.documentElement.scrollTop;
			obj1.style.top=obj2.style.top=document.documentElement.scrollTop+"px";
		}
}

/*
function showAdminPanel() {
	_obj = document.getElementById('admin_panel').parentNode.parentNode.parentNode;
	_obj.style.top=Number(50)+"px";
	_obj.style.left=Number(100)+"px";
	_obj.style.visibility = "visible";
}
*/

function showAdminPanel() {
     ie=(document.all && !window.opera?1:0);
     _obj = document.getElementById('admin_panel').parentNode.parentNode.parentNode;
	 set_width('admin_panel')
     document.body.style.height="100%";
	_scrTop=document.documentElement.scrollTop;
	if(ie) document.body.style.overflow="hidden";
	_t=Math.round((document.body.offsetHeight-_obj.offsetHeight)/2);
	_l=Math.round((document.body.offsetWidth-_obj.offsetWidth)/2);
	_obj.style.top=Number((_t<5?5:_t)+_scrTop)+"px";
	_obj.style.left=_l+"px";
	document.body.style.height="auto";
	if(ie){
		document.body.style.overflow="visible";
		window.scrollTo(0, _scrTop)
	}
     _obj.style.visibility = "visible";
}

/*

function showAdminPanel() {
       ie=(document.all && !window.opera?1:0);
       _obj = document.getElementById('admin_panel').parentNode.parentNode.parentNode;
       document.body.style.height="100%";
       if(ie)document.body.style.overflow="hidden";
       document.body.style.height="auto";
       if(ie)document.body.style.overflow="visible";
       _obj.style.top=Math.round((document.body.offsetHeight-_obj.offsetHeight)/2)+"px";
       _obj.style.left=Math.round((document.body.offsetWidth-_obj.offsetWidth)/2)+"px";
       _obj.style.visibility = "visible";
}

*/


function fillAdminPanel( text ) {
	document.getElementById('admin_panel').innerHTML = text;
}


function ProceedResponce ( responseJS, responseText ) {

	if ( responseJS.failed == true  ) {
		alert( responseJS.message );
	} else {
		fillAdminPanel(  responseText );
		set_width('admin_panel');
		showAdminPanel();
 		if ( responseJS.change_title == true ) {
			d = document.getElementById('admin_panel_title');
			if ( d != null )  {
				d.innerHTML = responseJS.dialog_title; 
			}		
 		}

	}

}

function LoadByID( _task, _id ) {
	JsHttpRequest.query(
        'module.php',
		{
			module: 11,
			task: _task,
			id: _id
		}, 
		ProceedResponce,
        true 
    );
	return false;
}



function DoDelete(_task, _id) {
	
	if ( ! confirm( _ADMIN_CONFIRM_DELETE_ ) )
		return false;

	JsHttpRequest.query(
        'module.php',
		{
			module: 11,
			task: _task,
			id: _id
		}, 
		ProceedResponce,
        true 
    );
	return false;
}



function Load(_task) {
	
	JsHttpRequest.query(
        'module.php',
		{
			module: 11,
			task: _task
		}, 
		ProceedResponce,
        true 
    );
	return false;
}





