
var powerInfoManager={infoCol:[],isLoopRunning:false,locatePageUrl:null,sep:'|',AddInfo:function(infoID,handler,templateId,handlerParams){var info=null;var nvPairs=infoID.split(';');var infoT='',user='',net='',att='',idMain='';for(i=0;i<nvPairs.length;i++)
{var nvPair=nvPairs[i].split('=');if(nvPairs.length>1)
{var name=nvPair[0];var value=nvPair[1];switch(name)
{case'infoType':infoT=value;break;case'userID':user=value;break;case'network':net=value;break;case'attributeName':att=value;break;case'idMainProcess':idMain=value;break;}}}
var objId={infoType:infoT,userID:user,network:net,attributeName:att,idMainProcess:idMain,value:infoID}
info={id:objId,data:null,trialTimes:4,handlers:[],timeout:powerTemplateManager.GetTemplate(templateId).timeout,startDate:(new Date().getTime()),completed:false,nextRequest:0};this.infoCol.push(info);if((handlerParams==undefined)||(handlerParams==null))
{var params=[];params.push(templateId);info.handlers.push({handler:handler,params:params});}
else
{info.handlers.push({handler:handler,params:handlerParams});}
this.StartLoop(infoID);},StartLoop:function(infoID){if(!this.isLoopRunning)
{this.isLoopRunning=true;setTimeout("powerInfoManager.TryGetFunction()",400);}},TryGetFunction:function(){var info,infoData,retry=true;for(var infoCount=0;infoCount<this.infoCol.length;infoCount++){info=this.infoCol[infoCount];if((info.data==null)&&((info.startDate+info.timeout)>=(new Date().getTime()))){infoData=powerInfoManager.GetInfoArrayData(info);if(infoData!=null&&infoData!=''){for(var handlerCount=0;handlerCount<info.handlers.length;handlerCount++){Evaluate(info.handlers[handlerCount].handler,infoData,info.handlers[handlerCount].params);}
info.data=infoData;info.completed=true;}
else{if((infoData==null||infoData=='')&&info.nextRequest<=(new Date().getTime())){powerInfoManager.RequestData(info);info.nextRequest=((new Date().getTime())+8000);}}}
else{if(info.completed==false&&(info.startDate+info.timeout)<(new Date().getTime())){if(info.handlers!=null&&info.handlers[0].params!=null&&GetElement(info.handlers[0].params[0])!=null)
GetElement(info.handlers[0].params[0]).innerHTML="";}
info.completed=true;}}
powerInfoManager.KillCompleteProcess();setTimeout("powerInfoManager.TryGetFunction()",1000);},KillCompleteProcess:function(){var num=0;var info=null;var completeInfoIds='';var processes=[];var mainObj=null;while(num<this.infoCol.length)
{info=this.infoCol[num];if(info.completed==true&&(info.id.idMainProcess==null||info.id.idMainProcess==''))
{this.infoCol.splice(num,1);}
else
{if(info.id.idMainProcess!=null&&info.id.idMainProcess!='')
{mainObj=null;for(var x=0;x<processes.length;x++)
if(processes[x].id==info.id.idMainProcess)
mainObj=processes[x];if(mainObj==null)
{mainObj={id:info.id.idMainProcess,completed:true};processes.push(mainObj);}
if(!info.completed)
mainObj.completed=false;else
{this.infoCol.splice(num,1);continue;}}
num++;}}
for(var x=0;x<processes.length;x++)
if(processes[x].completed)
completeInfoIds+=processes[x].id+'|';if(completeInfoIds!=''){var url=this.locatePageUrl+(this.locatePageUrl.indexOf('?')==-1?'?':'&')+'clearInfoId='+completeInfoIds+'&v='+new Date().getTime();powerXMLRequest.Get(url,false);}},ConvertInfoIdToUrl:function(infoID){return'infoType%3d'+infoID.infoType+'%3buserID%3d'+infoID.userID+'%3battributeName%3d'+infoID.attributeName+'%3bnetwork%3d'+infoID.network;},RequestData:function(info){var url=this.locatePageUrl+(this.locatePageUrl.indexOf('?')==-1?'?':'&')+'infoId='+powerInfoManager.ConvertInfoIdToUrl(info.id);var infoID=Replace(info.id.value,';','');infoID=Replace(infoID,'=','');var includeJS=GetElement(infoID);if(includeJS!=null)
{var divBody=includeJS.parentNode;var divBodyChild;for(var divBodyChildCount=0;divBodyChildCount<divBody.childNodes.length;divBodyChildCount++){divBodyChild=divBody.childNodes[divBodyChildCount];if(divBodyChild.id&&divBodyChild.id==infoID){divBody.removeChild(divBody.childNodes[divBodyChildCount]);}}}
includeJS=createObject("script",infoID);includeJS.setAttribute('type','text/javascript');includeJS.setAttribute('src',url);AppendToBody(includeJS);},GetInfoArrayData:function(info){var infoValue=null;if(info.data==null||info.data==''){var infoData=window[info.id.infoType+info.id.userID+info.id.network+info.id.attributeName];if(infoData){switch(infoData){case'':case'ERROR':{infoValue=infoData;break;}
default:{infoValue=Evaluate(infoData);break;}}}}
if(infoValue!=null)
{window[info.id.infoType+info.id.userID+info.id.network+info.id.attributeName]=null;}
return infoValue;},GetData:function(infoID){var info=this.GetInfo(infoID);if(info!=-1){return info.data;}
return null;},GetInfo:function(infoID){for(var infoCount=0;infoCount<this.infoCol.length;infoCount++){if(this.infoCol[infoCount].id.value==infoID){return this.infoCol[infoCount];}}
return-1;}};function PowerInfoPanelManager(){}
PowerInfoPanelManager.prototype.AddPanel=function(infoId,panelId){PowerInfoPanel.SetUp(panelId);powerInfoManager.AddInfo(infoId,PowerInfoPanel.Bind,panelId);};var powerInfoPanelManager=new PowerInfoPanelManager();var powerTemplateManager={templatesHTML:[],GetTemplate:function(templateId){for(var tempCount=0;tempCount<this.templatesHTML.length;tempCount++){if(this.templatesHTML[tempCount].id==templateId)
return this.templatesHTML[tempCount];}},SetTemplate:function(templateId,templateText,numRows,timeOut,messageText,messageError){this.templatesHTML.push({id:templateId,text:templateText,rows:numRows,timeout:timeOut,message:messageText,errorMessage:messageError});}}
var PowerInfoPanel={SetUp:function(panelId,template,infoCount){writeLoading(panelId);},Bind:function(params){var data=params[0];var itemCount=0,htmlBindText='',htmlText,propStart,propEnd,propName;var panel=GetElement(params[1][0]);var template=powerTemplateManager.GetTemplate(params[1][0]);if(data=='WARNING'){panel.innerHTML="<div class=\"pw_cont_fw clear\" style=\"padding:8px 0 8px 0;\"><div class=\"pw_cont_bx\"><div align=\"right\"></div><div><div style=\"width:290px;float:left;\" >"+template.message+"</div><div class=\"pw_msg_bxsc_sp\" style=\"max-width:290px;\"></div></div></div></div>";}
else{if(data=='ERROR'){panel.innerHTML="<div class=\"pw_cont_fw clear\" style=\"padding:8px 0 8px 0;\"><div class=\"pw_cont_bx\"><div align=\"right\"></div><div><div style=\"width:290px;float:left;\" >"+template.errorMessage+"</div><div class=\"pw_msg_bxsc_sp\" style=\"max-width:290px;\"></div></div></div></div>";}
else{for(var dataCount=0;dataCount<data.length;dataCount++){data[dataCount]['MODLINE']=dataCount%2;data[dataCount]['DATACOUNT']=dataCount;htmlText=template.text;propStart=htmlText.indexOf('#!',0);while(propStart!=-1){propEnd=htmlText.indexOf('#!',propStart+2);propName=htmlText.substr(propStart+2,propEnd-propStart-2);htmlText=htmlText.substr(0,propStart)+data[dataCount][propName.toUpperCase()]+htmlText.substr(propEnd+2);propStart=htmlText.indexOf('#!',propStart);}
htmlText=adjustLinks(htmlText);htmlBindText+=htmlText;if(dataCount>=template.rows-1){break;}
itemCount++;}
if(htmlBindText!==''){try{panel.innerHTML=htmlBindText;try{genereteDHtmlMenu();}catch(e){}
resizeElements.usingParameters(panel,'paramSize');}catch(e){}}}}}};function writeLoading(divId){RenderEmbed('<object codebase=\'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\' width=\'25\' height=\'25\' align=\'middle\' id=\'flash_navLogo\' name=\'flash_navLogo\' classid=\'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\' ><param name=\'movie\' value=\'http://static.power.com/swf/loader.swf\' /> <param name=\'quality\' value=\'best\' /> <param name=\'play\' value=\'true\' /> <param name=\'loop\' value=\'true\' /> <param name=\'scale\' value=\'showall\' /> <param name=\'wmode\' value=\'transparent\' /> <param name=\'devicefont\' value=\'false\' /> <param name=\'bgcolor\' value=\'#b4c8ed\' /> <param name=\'menu\' value=\'true\' /> <param name=\'allowScriptAccess\' value=\'sameDomain\' /> <param name=\'salign\' value=\'\' /> <embed width=\'25\' height=\'25\' src=\'http://static.power.com/swf/loader.swf\' quality=\'best\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\' align=\'middle\' play=\'true\' loop=\'true\' scale=\'showall\' wmode=\'transparent\' devicefont=\'false\' id=\'flash_navLogo\' bgcolor=\'#b4c8ed\' name=\'flash_navLogo\' menu=\'true\' allowScriptAccess=\'sameDomain\' salign=\'\' type=\'application/x-shockwave-flash\'  ></embed></object>',divId);}
var templateLinkOrkut=window.top.powerHostName+'nav/powerkut/';var templateLinkMySpace=window.top.powerHostName+'Pub/Main.aspx?PowerSite=MYSPACE&powerurl=';var templateLinkHi5=window.top.powerHostName+'nav/power5/';var templateLinkFlogao=window.top.powerHostName+'Priv/GetToken.aspx?type=B&PowerSite=FLOGAO&urlDestin='+escape(window.top.flogaoHostName);var templateLinkVoteme=window.top.powerHostName+'Priv/GetToken.aspx?type=B&PowerSite=VOTEME&urlDestin='+escape(window.top.votemeHostName)+'MatchData.aspx?id=';var templateLinkLinkedIn=window.top.powerHostName+'nav/powerin/';var templateLinkTwitter=window.top.powerHostName+'nav/powertwt/';function adjustLinks(htmlText)
{var adjustLink=htmlText.indexOf('#$lnkOKT#$',0);while(adjustLink!=-1)
{htmlText=htmlText.replace('#$lnkOKT#$',templateLinkOrkut);adjustLink=htmlText.indexOf('#$lnkOKT#$',0);}
adjustLink=htmlText.indexOf('#$lnkMSP#$',0);while(adjustLink!=-1)
{htmlText=htmlText.replace('#$lnkMSP#$',templateLinkMySpace);adjustLink=htmlText.indexOf('#$lnkMSP#$',0);}
adjustLink=htmlText.indexOf('#$lnkHI5#$',0);while(adjustLink!=-1)
{htmlText=htmlText.replace('#$lnkHI5#$',templateLinkHi5);adjustLink=htmlText.indexOf('#$lnkHI5#$',0);}
adjustLink=htmlText.indexOf('#$lnkFLG#$',0);while(adjustLink!=-1)
{htmlText=htmlText.replace('#$lnkFLG#$',templateLinkFlogao);adjustLink=htmlText.indexOf('#$lnkFLG#$',0);}
adjustLink=htmlText.indexOf('#$lnkVTM#$',0);while(adjustLink!=-1)
{htmlText=htmlText.replace('#$lnkVTM#$',templateLinkVoteme);adjustLink=htmlText.indexOf('#$lnkVTM#$',0);}
adjustLink=htmlText.indexOf('#$lnkLIN#$',0);while(adjustLink!=-1)
{htmlText=htmlText.replace('#$lnkLIN#$',templateLinkLinkedIn);adjustLink=htmlText.indexOf('#$lnkLIN#$',0);}
adjustLink=htmlText.indexOf('#$lnkTWT#$',0);while(adjustLink!=-1)
{htmlText=htmlText.replace('#$lnkTWT#$',templateLinkTwitter);adjustLink=htmlText.indexOf('#$lnkTWT#$',0);}
return htmlText;}