var InternetExplorer=navigator.appName.indexOf("Microsoft")!=-1;if(site_www=='undefined'){var site_www=BASEURL + '';}
if(playing=='undefined'){var playing=false;}
if(wizardplaying=='undefined'){var wizardplaying=false;}
function isInternal(){if(!window.parent.document.getElementById('body_home')){if(window.location.href.indexOf("\?")==-1){add='?overload=1';}
else{add='&overload=1';}
window.parent.location.href=window.location.href+add}}
function loadComponent(component,url,module){if(!site_www){site_www=BASEURL + '';}
if(url){site_home=site_www+url;}
if(!module){module='user.php';}
if(document.getElementById('xpg_main_iframe')){loadUrl(site_home+module+'?onlycontent=1&component='+component);}
else{document.location.href=site_home+module+'?component='+component;}}
function getMainDocument(){if(parent.document.getElementById('body_home')){main=parent.document;}
else{main=document;}
return main;}
function loadingInCenter(){var loadingTop=0;main=getMainDocument();var x,y;if(self.pageYOffset)
{x=self.pageXOffset;y=self.pageYOffset;}
else if(document.documentElement&&document.documentElement.scrollTop)
{x=document.documentElement.scrollLeft;y=document.documentElement.scrollTop;}
else if(document.body)
{x=document.body.scrollLeft;y=document.body.scrollTop;}
position=y;currentdiv=parseInt(main.getElementById('xpgMessagesLoading').style.top.replace("px",""));posdiv=position+loadingTop;if(currentdiv<posdiv){k=0;for(var i=currentdiv;i<posdiv;i++){setTimeout("gotoLoading("+i+")",k++*0);}}
else
if(currentdiv>posdiv){k=0;for(var i=currentdiv;i>posdiv;i--){setTimeout("gotoLoading("+i+")",k++*2);}}}
function gotoTop(){scroll(0,0);return true;var x,y;if(self.pageYOffset)
{x=self.pageXOffset;y=self.pageYOffset;}
else if(document.documentElement&&document.documentElement.scrollTop)
{x=document.documentElement.scrollLeft;y=document.documentElement.scrollTop;}
else if(document.body)
{x=document.body.scrollLeft;y=document.body.scrollTop;}
position=y;k=0;for(var i=position;i>0;i--){if(i%2==0){setTimeout("scroll(0, "+i+")",k++);}
i--;k++;}}
function gotoLoading(position){main=getMainDocument();main.getElementById('xpgMessagesLoading').style.top=position+'px';main.getElementById('xpgMessagesReturnMsg').style.top=position+'px';}
function xpgMessagesLoading(){if(InternetExplorer){main=getMainDocument();startLoader();main.getElementById('xpgMessagesLoading').style.visibility='visible';main.getElementById('xpgMessagesReturnMsg').style.visibility='hidden';main.getElementById('xpgMessagesWizardLoader').style.visibility='hidden';}}
function xpgMessagesWizardLoader(){main=getMainDocument();startWizardLoader();main.getElementById('xpgMessagesWizardLoader').style.visibility='visible';main.getElementById('xpgMessagesLoading').style.visibility='hidden';main.getElementById('xpgMessagesReturnMsg').style.visibility='hidden';}
function xpgMessagesReturn(msg){main=getMainDocument();xpgMessagesHideAll();startReturnMsg();main.getElementById('xpgMessagesLoading').style.visibility='hidden';main.getElementById('xpgMessagesReturnMsg').style.visibility='visible';setTimeout("xpgMessagesHideAll()",3500);}
function xpgMessagesReturnError(msg){main=getMainDocument();xpgMessagesHideAll();if(main.getElementById('xpgMessagesReturnError')!=null){main.getElementById('xpgMessagesReturnMsg').style.visibility='hidden';_rebuildIframe('xpgMessagesReturnError');}
else{oldAlert(msg.replace(/|/g,'\n'));}}
function xpgMessagesHideAll(showerror){setTimeout('endLoader()',1000);setTimeout('endReturnMsg()',2000);gotoTop();}
function endLoader()
{main=getMainDocument();if(main.loader&&InternetExplorer)
{main.loader.Play();playing=false;}}
function closeLoader()
{setTimeout('endLoader()',1000);}
function startWizardLoader()
{main=getMainDocument();if(main.wizardloader&&InternetExplorer&&!wizardplaying)
{main.wizardloader.Rewind();main.wizardloader.Play();wizardplaying=true;}}
function startLoader()
{main=getMainDocument();if(main.loader&&InternetExplorer&&!playing)
{main.loader.Rewind();main.loader.Play();playing=true;}}
function endReturnMsg()
{main=getMainDocument();if(main.loader&&InternetExplorer)
{main.ReturnMsg.Play();playing=false;}}
function startReturnMsg()
{main=getMainDocument();if(main.loader&&InternetExplorer)
{main.ReturnMsg.Rewind();main.ReturnMsg.Play();playingReturnMsg=true;}}
function _rebuildIframe(DivRefName){main=getMainDocument();var DivRef=main.getElementById(DivRefName);var IfrRef=main.getElementById('DivMestra');IfrRef.style.height=DivRef.offsetHeight;IfrRef.style.width=DivRef.offsetWidth;IfrRef.style.top=DivRef.style.top;IfrRef.style.left=DivRef.style.left;IfrRef.style.zIndex=DivRef.style.zIndex-1;IfrRef.style.display="block";}
function getURLParam(strParamName){var strReturn="";var strHref=window.location.href;if(strHref.indexOf("&")>-1){var strQueryString=strHref.substr(strHref.indexOf("&")).toLowerCase();var aQueryString=strQueryString.split("&");for(var iParam=0;iParam<aQueryString.length;iParam++){if(aQueryString[iParam].indexOf(strParamName+"=")>-1){var aParam=aQueryString[iParam].split("=");strReturn=aParam[1];break;}}}
return strReturn;}
var oldAlert=window.alert;var iframeids=["xpg_main_iframe"]
var iframehide="yes"
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1?16:0
function resizeCaller(){var dyniframe=new Array()
for(i=0;i<iframeids.length;i++){if(document.getElementById)
resizeIframe(iframeids[i])
if((document.all||document.getElementById)&&iframehide=="no"){var tempobj=document.all?document.all[iframeids[i]]:document.getElementById(iframeids[i])
tempobj.style.display="block"}}}
function resizeCaller2(){var dyniframe=new Array()
for(i=0;i<iframeids.length;i++){if(document.getElementById)
resizeIframe2(iframeids[i])
if((document.all||document.getElementById)&&iframehide=="no"){var tempobj=document.all?document.all[iframeids[i]]:document.getElementById(iframeids[i])
tempobj.style.display="block"}}}
function delay(gap){var then,now;then=new Date().getTime();now=then;while((now-then)<gap)
{now=new Date().getTime();}}
function resizeIframe(frameid){var currentfr=document.getElementById(frameid)
if(currentfr&&!window.opera){currentfr.style.display="block"
if(currentfr.contentDocument&&currentfr.contentDocument.body.offsetHeight){currentfr.height=500;if(currentfr.contentDocument.body.offsetHeight>10)
currentfr.height=currentfr.contentDocument.body.offsetHeight;}
else if(currentfr.Document&&currentfr.Document.body.scrollHeight){currentfr.height=500;if(currentfr.Document.body.scrollHeight>10)
currentfr.height=currentfr.Document.body.scrollHeight;}
if(currentfr.addEventListener){currentfr.addEventListener("load",readjustIframe,false)}
else if(currentfr.attachEvent){currentfr.detachEvent("onload",readjustIframe)
currentfr.attachEvent("onload",readjustIframe)}
xpgMessagesHideAll(false);}}
function resizeIframe2(frameid){var currentfr=document.getElementById(frameid)
if(currentfr&&!window.opera){currentfr.style.display="block"
if(currentfr.contentDocument&&currentfr.contentDocument.body.offsetHeight){if(currentfr.contentDocument.body.offsetHeight>0)
currentfr.height=currentfr.contentDocument.body.offsetHeight;currentfr.width=currentfr.contentDocument.body.offsetWidth;}
else if(currentfr.Document&&currentfr.Document.body.scrollHeight){if(currentfr.Document.body.scrollHeight>0)
currentfr.width=currentfr.Document.body.scrollWidth;currentfr.height=currentfr.Document.body.scrollHeight;}
if(currentfr.addEventListener){currentfr.addEventListener("load",readjustIframe2,true)}
else if(currentfr.attachEvent){currentfr.detachEvent("onload",readjustIframe2)
currentfr.attachEvent("onload",readjustIframe2)}
xpgMessagesHideAll(false);}}
function readjustIframe(loadevt){var crossevt=(window.event)?event:loadevt
var iframeroot=(crossevt.currentTarget)?crossevt.currentTarget:crossevt.srcElement
if(iframeroot)
resizeIframe(iframeroot.id);}
function readjustIframe2(loadevt){var crossevt=(window.event)?event:loadevt
var iframeroot=(crossevt.currentTarget)?crossevt.currentTarget:crossevt.srcElement
if(iframeroot)
resizeIframe2(iframeroot.id);}
function loadintoIframe(iframeid,url){if(document.getElementById){document.getElementById(iframeid).src=url}}
function chgImg(imgField,newImg){document[imgField].src=eval(newImg+".src")}