var CSoraXP = Class.create();
CSoraXP.prototype = {

	_sxp_osmsmod : 0, // 0 none 1 adm 2 overlay
	_sxp_osmson : -1, // which osms module is being used?
	_sxp_osmsonLOCK : false, // rotator shown, ignore mouseout
	_sxp_osmsrotatorpos : -1, // where are the mouse on the rotator menu?
	_sxp_adminon : -1, // admin div is loaded?
	_sxp_osmsareas : new Array(), // osms div to module conversion
	_sxp_osmsadminaba : 0, // admin tab
	_sxp_btnadm : null,
	_sxp_btnov : null,
	_sxp_btnrt : null,
	_sxp_btncms : null,
	_sxp_page: '',
	_sxp_pagenoseo: '',
	_sxp_lang: '',
	_sxp_zindex: 1000,
	_sxp_transparencylevel: 0.6,
	_sxp_preventunload: false,
	_sxp_id: null, // the loaded page has an ID 
	_sxp_statsloaded: false, // stats for this page loaded (ajax)
	initialize: function(page,page_noseo,lang,position,id) {
		this._sxp_page = page;
		this._sxp_pagenoseo = page_noseo;
		this._sxp_lang = lang;
		this._sxp_id = id;
		el = $('divsxp_stage');
		el.style.position = "fixed";
		el.style.top = "0px";
		el.style.left = "0px";
		el.style.width = "100%";
		el.style.height = "100%";
		el.style.display = "none";
		el.style.zIndex = this._sxp_zindex-1;
		el = $('divsxp_overlay');
		el.style.position = "fixed";
		el.style.top = "0px";
		el.style.left = "0px";
		el.style.width = "100%";
		el.style.height = "100%";
		el.style.background = "#000033";
		el.style.zIndex = this._sxp_zindex-1;
		$('divsxp_admin').style.zIndex = this._sxp_zindex+1;
		el.onclick = this.Fsxp_overlayclick.bind(this);
		Element.setOpacity(el, this._sxp_transparencylevel/4);
		
		this._sxp_btnadm = document.createElement('img');
		this._sxp_btnadm.setAttribute('id',"divsxp_btnadm");
		this._sxp_btnadm.src = '/pages/default/images/adm/osms/osms_options_up.gif';
		this._sxp_btnadm.style.width = '50px';
		this._sxp_btnadm.style.height = '50px';
		if (position==0||position==3)
			this._sxp_btnadm.style.left = '10px';
		else
			this._sxp_btnadm.style.right = '10px';
		if (position<2) 
			this._sxp_btnadm.style.top = '10px';
		else
			this._sxp_btnadm.style.bottom = '10px';
		this._sxp_btnadm.style.cursor = 'pointer';
		this._sxp_btnadm.style.position = 'fixed';
		this._sxp_btnadm.style.zIndex = this._sxp_zindex;
		this._sxp_btnadm.onmouseover = Function("Element.setOpacity(this, 1);");
		this._sxp_btnadm.onmouseout = Function("Element.setOpacity(this, "+this._sxp_transparencylevel+");");
		this._sxp_btnadm.onclick = this.Fsxpb_adminmode.bind(this);
		node = document.body.appendChild(this._sxp_btnadm);
		Element.setOpacity(node,0.7);
		
		this._sxp_btnov = document.createElement('img');
		this._sxp_btnov.setAttribute('id',"divsxp_btnov");
		this._sxp_btnov.src = '/pages/default/images/adm/osms/osms_overlay_up.gif';
		this._sxp_btnov.style.width = '50px';
		this._sxp_btnov.style.height = '50px';
		if (position==0||position==3)
			this._sxp_btnov.style.left = '10px';
		else
			this._sxp_btnov.style.right = '10px';
		if (position<2) 
			this._sxp_btnov.style.top = '70px';
		else
			this._sxp_btnov.style.bottom = '70px';
		this._sxp_btnov.style.cursor = 'pointer';
		this._sxp_btnov.style.position = 'fixed';
		this._sxp_btnov.style.zIndex = this._sxp_zindex;
		this._sxp_btnov.onmouseover = Function("Element.setOpacity(this, 1);");
		this._sxp_btnov.onmouseout = Function("Element.setOpacity(this, "+this._sxp_transparencylevel+");");
		this._sxp_btnov.onclick = this.Fsxpb_osmsmode.bind(this);
		node = document.body.appendChild(this._sxp_btnov);
		Element.setOpacity(node,0.7);
		
		this._sxp_btnrt = document.createElement('img');
		this._sxp_btnrt.setAttribute('id',"divsxp_btnrot");
		this._sxp_btnrt.src = '/pages/default/images/adm/osms/rotatorl.png';
		this._sxp_btnrt.style.width = '90px';
		this._sxp_btnrt.style.height = '90px';
		this._sxp_btnrt.style.left = "45%";
		this._sxp_btnrt.style.top = "5%";
		this._sxp_btnrt.style.position = 'absolute';
		this._sxp_btnrt.style.zIndex = this._sxp_zindex;
		this._sxp_btnrt.style.display = 'none';
		this._sxp_btnrt.onmousemove = this.Fsxp_rotatorover.bind(this);
		this._sxp_btnrt.onmouseout = this.Fsxp_rotatorout.bind(this);
		this._sxp_btnrt.onclick = this.Fsxp_rotatorclick.bind(this);
		node = document.body.appendChild(this._sxp_btnrt);
		
		this._sxp_btncms = document.createElement('img');
		this._sxp_btncms.setAttribute('id',"divsxp_btnrot");
		this._sxp_btncms.src = '/pages/default/images/adm/osms/cmsoff.png';
		this._sxp_btncms.style.width = '90px';
		this._sxp_btncms.style.height = '90px';
		this._sxp_btncms.style.left = "45%";
		this._sxp_btncms.style.top = "5%";
		this._sxp_btncms.style.position = 'absolute';
		this._sxp_btncms.style.zIndex = this._sxp_zindex;
		this._sxp_btncms.style.display = 'none';
		this._sxp_btncms.onmousemove = Function("this.src = '/pages/default/images/adm/osms/cmson.png'");
		this._sxp_btncms.onmouseout = Function("this.src = '/pages/default/images/adm/osms/cmsoff.png'");
		this._sxp_btncms.onclick = this.Fsxp_cmsclick.bind(this);
		node = document.body.appendChild(this._sxp_btncms);
		window.onbeforeunload = this.Fsxp_canUnload.bind(this);
	},
	Fsxp_canUnload: function() {
		if (this._sxp_preventunload)
			return "Você deseja sair da página (seguir o link clicado)?";
	},
	Fsxp_osmsaba: function(aba) {
		if (this._sxp_osmsadminaba == aba) return;
		$('divsxp_admin_aba' + this._sxp_osmsadminaba).style.display = 'none';
		$('divsxp_admin_aba' + this._sxp_osmsadminaba + 't').style.background = '#eeeeee';
		this._sxp_osmsadminaba = aba;
		new Effect.BlindDown('divsxp_admin_aba'+this._sxp_osmsadminaba);
		$('divsxp_admin_aba' + this._sxp_osmsadminaba + 't').style.background = '#ffffff';
		if (aba == 3 && !this._sxp_statsloaded) {
			new Ajax.Updater('divsxp_stats','/ajaxstatpush.ajas?page='+this._sxp_pagenoseo+'&id='+this._sxp_id+'&height=200&color=111144',{ asynchronous:true});
			this._sxp_statsloaded = true;
		}
	},
	Fsxp_rotatorover:function(e) {
		if (!e) e = window.event;
		if (e.offsetX) {
			l = e.offsetX;
			t = e.offsetY;
		} else {
			l = e.pageX - findPosX(e.target);
			t = e.pageY - findPosY(e.target);
		}
		this._sxp_osmsrotatorpos = l<45?(t<45?3:2):(t<45?0:1);
		this._sxp_btnrt.src = '/pages/default/images/adm/osms/rotatorl'+this._sxp_osmsrotatorpos+'.png';
		switch (this._sxp_osmsrotatorpos) {
			case 0:
				this._sxp_btnrt.title = "Listar";
			break;
			case 1:
				this._sxp_btnrt.title = "Configurar";
			break;
			case 2:
				this._sxp_btnrt.title = "Histórico";
			break;
			case 3:
				this._sxp_btnrt.title = "Novo";
			break;
		}
	},
	Fsxp_cmsclick:function(e) {
		osmsdata = this.Fsxp_getosmsdata(this._sxp_osmson);
		if (osmsdata[1] == 2)
			this.startCMS(osmsdata[2]);
		else {
			this._sxp_preventunload = false;
			document.location = '/adm/edit.php?module=' + osmsdata[2] + '&id=' + this._sxp_id + "&returnToPublic=true";
		}
	},
	Fsxp_rotatorclick:function(e) {
		try {
			if (!e) e = window.event;
			if (e.offsetX) {
				l = e.offsetX;
				t = e.offsetY;
			} else {
				l = e.pageX - findPosX(e.target);
				t = e.pageY - findPosY(e.target);
			}
			sxp_osmsrotatorpos = l<45?(t<45?3:2):(t<45?0:1);
		} catch (ee) {
			sxp_osmsrotatorpos = 0;
		}
		osmsdata = this.Fsxp_getosmsdata(this._sxp_osmson);
		this._sxp_btnrt.style.display = 'none';
		switch (sxp_osmsrotatorpos) {
			case 0:
				openList('/adm/list.ajax?returnToPublic=true&module='+osmsdata[2],'Listar',false);
			break;
			case 1:
				alert('(BETA) Configurações ainda em construção');
			break;
			case 2:
				openOutput('/adm/history.ajax?module='+osmsdata[2],'Histórico',true,0,400);
			break;
			case 3:	
				this._sxp_preventunload = false;
				document.location = "/adm/edit.php?returnToPublic=true&module=" + osmsdata[2];
			break;
		}
		this._sxp_osmsonLOCK = false;
	},
	Fsxp_rotatorout:function() {
		this._sxp_btnrt.src = '/pages/default/images/adm/osms/rotatorl.png';
		this._sxp_osmsrotatorpos = -1;
	},
	fixosms:function(id,mode,cms) {
		if (!mode) mode = 0; // 0 = normal, 1 = edit by query, 2 = cms/module
		oldel=$('osms'+id); // get the osms element
		ref=$('osmsREF'+id);
		tref = $('osmsTAB'+id);
		if (!oldel && !ref && !tref) return;
		if (oldel) {
			par = oldel.parentNode; // get it's parent
		} else if (ref)
			par = ref.parentNode;
		else
			par = tref.parentNode;
		el = document.createElement('div'); // create a new div (this will float)
		el.setAttribute('id',"osms"+id); // set it's ID (the same as the osms, which will be further removed)
		el.style.position = "absolute";
		if (oldel) {
			el.style.left = findPosX(oldel)  + "px";
			el.style.top= findPosY(oldel)  + "px";
			par.removeChild(oldel); // remove from parent scope (thus removes the duplicated ID)
		}
		if (par.style.position == '')
			par.style.position = 'relative';
		el.style.background = "#7777ff";
		el.style.color = "#000000";
		el.style.margin = '0px';
		el.style.padding = '0px';
		el.style.zIndex = mode!=2?this._sxp_zindex-3:this._sxp_zindex-2;
		ref=$('osmsREF'+id);
		if (ref) {
			ref.style.position = 'relative';
			ref.style.margin = '0px';
			ref.style.padding = '0px';
			/*if (is_ie6) {	
				this.reposition(ref,id,el);
			} else {*/
				el.style.left = findPosX(ref)  + "px";
				el.style.top= findPosY(ref)  + "px";
				w = (ref.offsetWidth<=100?100:par.offsetWidth);
				if (w > screen.width - findPosX(ref)) w =  screen.width - findPosX(ref);
				el.style.width = w + "px";
				el.style.height = (ref.offsetHeight<=100?100:par.offsetHeight) + "px";
//			}
		} else {
			ref = $('osmsTAB'+id);
			if (ref) {
				/*if (is_ie6) {
					this.reposition(ref,id,el);
				} else {*/
					el.style.left = findPosX(ref)  + "px";
					el.style.top= findPosY(ref)  + "px";
					el.style.width = (ref.offsetWidth<=100?100:par.offsetWidth) + "px";
					el.style.height = (ref.offsetHeight<=100?100:par.offsetHeight) + "px";
				//}
			} else {
				el.style.width = (par.offsetWidth<=100?100:par.offsetWidth) + "px";
				el.style.height = (par.offsetHeight<=100?100:par.offsetHeight) + "px";
			}
		} 
		el.onmouseover = this.Fsxp_onmouseover.bind(this,id);
		el.onmouseout = this.Fsxp_onmouseout.bind(this);
		el.onclick = this.Fsxp_onclick.bind(this,id);
		el.style.display = 'none';
		node = document.body.appendChild(el); // add to parent
		this._sxp_osmsareas.push([id,mode,cms]);
	},
	reposition: function(ref,id,el) {
		tablefixer = document.createElement('div'); // create a DIV 
		tablefixer.setAttribute('id','osmsREF'+id);
		tablefixer.style.position = 'relative';
		tablefixer.style.margin = '0px';
		tablefixer.style.padding = '0px';
		nextref = ref.nextSibling; // to properly position the div
		refpar = ref.parentNode; // get whoever have the table
		refpar.removeChild(ref); // and remove the table
		tablefixer.appendChild(ref); // add the table to the div
		if (nextref)
			refpar.insertBefore(tablefixer,nextref); // add the div on the same location the table was
		else
			refpar.appendChild(tablefixer); // add the div to the original table owner at the end
		el.style.left = findPosX(tablefixer) + "px"; // now we are fine with metrics!
		el.style.top= findPosY(tablefixer) + "px";
		el.style.width = tablefixer.offsetWidth + "px";
		el.style.height = tablefixer.offsetHeight + "px";

	},
	Fsxp_getosmsdata:function(id) { // for OSMS only, not for OSMS-CMS
		for (c=0;c<this._sxp_osmsareas.length;c++) {
			if (this._sxp_osmsareas[c][0] == id)
				return this._sxp_osmsareas[c];
		}
		return false;
	},
	Fsxp_onmouseover:function(id)  {
		if (this._sxp_osmsonLOCK) return;
		if (this._sxp_osmson != 0)
			this.Fsxp_onmouseout();
		this._sxp_osmson = id;
		el=$('osms'+id);
		Element.setOpacity(el, this._sxp_transparencylevel);
	},
	Fsxp_onmouseout:function() {
		if (this._sxp_osmsonLOCK) return;
		if (this._sxp_osmson==0) return;
		el=$('osms'+this._sxp_osmson);
		Element.setOpacity(el, this._sxp_transparencylevel/2);
		this._sxp_osmson = 0;
	},
	Fsxp_onclick:function(e) {
		this._sxp_osmsonLOCK = true;
		el = $('divsxp_stage');
		el.style.display = '';
		osmsdata = this.Fsxp_getosmsdata(this._sxp_osmson);
		if (osmsdata[1] == 0) { // this is a list
			this._sxp_btnrt.style.left = (findPosX($('osms'+this._sxp_osmson)) + 5) + "px";
			this._sxp_btnrt.style.top = (findPosY($('osms'+this._sxp_osmson)) + 5) + "px";
			this._sxp_btnrt.style.display = '';
		} else { // this is an item or a cms
			this._sxp_btncms.style.left = (findPosX($('osms'+this._sxp_osmson)) + 5 )+ "px";
			this._sxp_btncms.style.top = (findPosY($('osms'+this._sxp_osmson)) + 5 )+ "px";
			this._sxp_btncms.src = '/pages/default/images/adm/osms/cmsoff.png';
			this._sxp_btncms.style.display = '';
		}
		this._sxp_preventunload = true; // USE FORCE!
		return false;
	},
	Fsxp_overlayclick:function() {
		this._sxp_preventunload = false;
		if (this._sxp_osmsmod!=1) {
			el = $('divsxp_stage');
			el.style.display = 'none';
			this._sxp_btnrt.style.display = 'none';
			this._sxp_btncms.style.display = 'none';
			this.Fsxp_onmouseout();
			this._sxp_osmsrotatorpos = -1;
			this._sxp_osmsonLOCK = false;
		}
		return false;
	},
	Fsxpb_adminmode:function() {
		if (this._sxp_osmsmod==2) this.Fsxpb_osmsmode();
		if (this._sxp_osmsmod==1) { // disable adminmode
			this._sxp_osmsmod = 0;
			this._sxp_btnadm.src = '/pages/default/images/adm/osms/osms_options_up.gif';
			$('divsxp_stage').style.display = 'none';
			$('divsxp_admin').style.display = 'none';
		} else { // enable adminmode
			this._sxp_osmsmod = 1;
			this._sxp_btnadm.src = '/pages/default/images/adm/osms/osms_options_down.gif';
			el = $('divsxp_stage');
			el.style.display = '';
			if (this._sxp_adminon==-1) {
				this._sxp_adminon = dragwindows.makeDraggable('divsxp_admin',{
										dragArea: 60,
										canClose: true,
										canResize: true,
										useEffects: false,
										minSize: 350,
										fallback: this.Fsxpb_adminmodefb.bind(this),
										canMinimize: false,
										windowName: 'Administrativo'
												 });
			} else
				$('divsxp_admin').style.display = '';
		}
	},
	Fsxpb_adminmodefb:function(div,whnd,mode) {
		if (mode == 0 && this._sxp_osmsmod == 1) this.Fsxpb_adminmode();
	},
	Fsxpb_osmsmode:function() {
		if (this._sxp_osmsmod==1) this.Fsxpb_adminmode();
		if (this._sxp_osmsmod==2) { // disable overlayymode
			this._sxp_osmsmod = 0;
			this._sxp_btnov.src = '/pages/default/images/adm/osms/osms_overlay_up.gif';
			for (c=0;c<this._sxp_osmsareas.length;c++) {
				$('osms'+this._sxp_osmsareas[c][0]).style.display = 'none';
			}
			this.Fsxp_overlayclick();
		} else { // enable overlaymode
			this._sxp_osmsmod = 2;
			this._sxp_btnov.src = '/pages/default/images/adm/osms/osms_overlay_down.gif';
			for (c=0;c<this._sxp_osmsareas.length;c++) {
				new Effect.Appear('osms'+this._sxp_osmsareas[c][0], {to:this._sxp_transparencylevel/2
														   });
			}
		}
		this._sxp_osmson = 0;
	},
	startCMS: function (code) {
		osmscode = -1;
		for (c=0;c<this._sxp_osmsareas.length;c++) {
			if (this._sxp_osmsareas[c][1] == 2 && this._sxp_osmsareas[c][2] == code)
				osmscode= this._sxp_osmsareas[c];
		}
		if (osmscode != -1) {
			if (this._sxp_osmsmod!=1) this.Fsxpb_adminmode();
			this.Fsxp_osmsaba(2);
			new Ajax.Request('/adm/osmsaction.ajax?osmsaction=get&mode=cms&code='+code+'&page='+this._sxp_pagenoseo+'&lang='+this._sxp_lang,{asynchronous:true,
	                                    onComplete:this.Fsxpb_cmsret.bind(this)});
			$('akrdbgdiv_code').value = code;
			$('akrdbgdiv_cmsdiv').style.display='none';
			$('akrdbgdiv_cmsdivwait').style.display='';
		} else
			alert("CMS container not found");
	},
	Fsxpb_cmsret: function(data) {
		mycms=data.responseText;
		mycms=mycms.replace(/\+/g," ");
		$('akrdbgfck').value = mycms;
		var oEditor = FCKeditorAPI.GetInstance('akrdbgfck') ;
	  	oEditor.EditorDocument.body.innerHTML = mycms;
		$('akrdbgdiv_cmsdiv').style.display='';
		$('akrdbgdiv_cmsdivwait').style.display='none';
	}
}
// admin.js simplified:

function openList(url,title,resizable,insideThisDIV,paging,whnd) {
	if (!paging)
		paging = 17;
	hasParameters = url.indexOf("?") != -1;
	if (!insideThisDIV) {
		var arrayPageScroll = document.viewport.getScrollOffsets(); // Prototype
		id = dragwindows.writewindow(false,32+arrayPageScroll[1]+(dragwindows.dgwc*10),800,420,'divsxp_stage',!resizable,false,setcontentsize);
		$('dgw_'+id).innerHTML = "<div style='height:18px;' id='dgwt_"+id+"'>&nbsp;"+title+"</div><div id='dgwc_"+id+"'>Carregando...</div>";
		if (resizable) $('dgwc_'+id).style.overflow='auto';
		new Ajax.Updater('dgwc_'+id,url+(hasParameters?'&':'?')+'p_fim='+paging+'&cellwidth=70&whnd='+id,{asynchronous:true,
														   onComplete:parseajax});
		return id;
	} else {
		new Ajax.Updater(insideThisDIV,url+(hasParameters?'&':'?')+'p_fim='+paging+'&whnd='+whnd,{asynchronous:true,
														   onComplete:parseajax});
		if (whnd >= dragwindows.dgwc)
			dragwindows.dgwc = whnd+1;
		return whnd;
	}

}
function setcontentsize(hnd,id,mode) {
	width = parseInt($('dgw_'+id).style.width);
	height = parseInt($('dgw_'+id).style.height);
	try {
		$('dgwc_'+id).style.width = width+"px";
		$('dgwc_'+id).style.height = (height-18)+"px";
	} catch (e) {
	}
}
function startpreview(skeys,module,isUndo) {
	dragwindows.Cdragarea = 25;
	var arrayPageScroll = document.viewport.getScrollOffsets(); // Prototype
	id = dragwindows.writewindow(false,32+arrayPageScroll[1]+(dragwindows.dgwc*10),800,420,'divsxp_stage',true,false,setcontentsize);
	dragwindows.Cdragarea = 0;
	$('dgw_'+id).innerHTML = "<div style='height:18px;' id='dgwt_"+id+"'></div><div id='dgwc_"+id+"'>Loading...</div>";
	$('dgwc_'+id).style.overflow='auto';
	url = isUndo?'/adm/undosee.ajax':'/adm/preview.ajax';
	new Ajax.Updater('dgwc_'+id,url+'?module='+module+'&'+skeys+'&whnd='+id,{asynchronous:true,
													   onComplete:parseajax});
	return id;
}
function setloadingmode(){
}

function openOutput(url,title,resizable,Hport,height) {
	if (!Hport) Hport = 0;
	if (!height) height = 400;
	dragwindows.Cdragarea = Hport;
	var arrayPageScroll = document.viewport.getScrollOffsets(); // Prototype
	id = dragwindows.writewindow(false,32+arrayPageScroll[1]+(dragwindows.dgwc*10),560,height,'divsxp_stage',!resizable,false,setcontentsize);
	$('dgw_'+id).innerHTML = "<div style='height:18px;' id='dgwt_"+id+"'>"+title+"</div><div id='dgwc_"+id+"'>Carregando...</div>";
	if (resizable) $('dgwc_'+id).style.overflow='auto';
	hasParameters = url.indexOf("?") != -1;
	new Ajax.Updater('dgwc_'+id,url+(hasParameters?'&':'?')+'wnhd='+id,{asynchronous:true
													  });
	dragwindows.Cdragarea = 0;
	return id;
}

function gofilter(query,whnd) {
	if (whnd && whnd != "" && whnd != 0)
		new Ajax.Updater('dgwc_'+whnd,"/adm/list.ajax?"+query,{asynchronous:true,
													   onComplete:parseajax});
	else
		document.location = "/adm/list.php?"+query;
}



// --- FUNCOES DE LOGIN (_osms_login.html) ----

function dgstartlg(position) {
	el = $('divsxp_stage');
	el.style.position = "fixed";
	el.style.top = "0px";
	el.style.left = "0px";
	el.style.width = "100%";
	el.style.height = "100%";
	el.style.display = "none";
	el.style.zIndex = 999;
	
	sxp_btnadm = document.createElement('img');
	sxp_btnadm.setAttribute('id',"divsxp_btnadm");
	sxp_btnadm.src = '/pages/default/images/adm/osms/login.png';
	sxp_btnadm.title = "Acesso Restrito";
	sxp_btnadm.style.width = '16px';
	sxp_btnadm.style.height = '16px';
	if (position==0||position==3)
		sxp_btnadm.style.left = '1px';
	else
		sxp_btnadm.style.right = '1px';
	if (position<2) 
		sxp_btnadm.style.top = '1px';
	else
		sxp_btnadm.style.bottom = '1px';
	sxp_btnadm.style.cursor = 'pointer';
	sxp_btnadm.style.position = 'fixed';
	sxp_btnadm.style.zIndex = 1000;
	sxp_btnadm.onclick = ShowAdmin;
	node = document.body.appendChild(sxp_btnadm);
	Element.setOpacity(node,0.7);
	
}
function ShowAdmin() {
	el = $('divsxp_stage');
	if (el.style.display == 'none') {
		el.style.display = '';
		el = $('divlogin');
		el.style.left = parseInt((parseInt(el.parentNode.offsetWidth) / 2) - 160)+"px";
		el.style.top = parseInt((parseInt(el.parentNode.offsetHeight) / 2) - 120)+"px";
		
		el = $('divlogin');
		try {
			Effect.Appear(el);
		} catch (ee) {
			el.style.display = '';
		}
	} else {
		el.style.display = 'none';
		el = $('divlogin');
		el.style.display = 'none';
	}
}