
var visiblePopup=[];var hiddenObjects=[];var handle;var ShowPopupOnErrorHandler=null;function ShowPopup(topDivId,url){topDivId=topDivId||'TextDialog';if(topDivId==visiblePopup[0]){alert('cannot show the same dialog twice');return;}
var textdialog=$(topDivId);if(!textdialog){textdialog=DOM.cex('div',{id:topDivId,style:{position:'absolute',zIndex:Veil.veilZ+1,border:0},innerHTML:'<iframe id="frmFlag" scrolling="no" frameborder="0" allowTransparency="true" onload="IframeOnload(this)" style="display:none;border:0;" ></iframe>'});document.body.insertBefore(textdialog,document.body.firstChild);}
textdialog.style.display="block";CenterBox(textdialog);textdialog.style.visibility="hidden";var ifr=textdialog.getElementsByTagName('iframe');if(ifr.length==1)
{url=urlrn(url);ifr[0].setAttribute('onload','IframeOnload(this)');ifr[0].src=url;ifr[0].style.width='100%';}
Veil.show(topDivId);textdialog=ifr=null;if(visiblePopup[0])$(visiblePopup[0]).style.zIndex=Veil.veilZ-1;else{addListener(document,"keyup",AP_onInputKeyUp);}
visiblePopup.unshift(topDivId);return false;}
function ShowAjaxDialog(backDivId,topDivId,frmId,url)
{ShowPopup(topDivId,url);}
function IframeResize(ifr)
{if(!ifr&&visiblePopup[0]){var div=$(visiblePopup[0]);ifr=div.getElementsByTagName('iframe')[0];}
var doc=DOM.ifdoc(ifr);var width=200,height=50;var cs=doc.body.childNodes;for(var i=0,e=cs.length;i<e;i++){if(cs[i].nodeType!=3&&cs[i].id!='logmessages'){width=Math.max(width,cs[i].offsetWidth);height=Math.max(height,cs[i].offsetHeight);}}
var content=doc.getElementById('scrollable');if(height>DOM.getViewportHeight()-100||(content&&content.getAttribute('scroll')=='1')){if(!content){doc.body.style.height=height+'px';}else{content.style.height=DOM.getViewportHeight()-100-(height-content.offsetHeight)+'px';content.style.overflowY='auto';height=DOM.getViewportHeight()-100;doc.body.style.height=height+'px';doc.body.style.overflowY='auto';}
content=null;}
ifr.style.width=width+'px';ifr.style.height=height+'px';return{width:width,height:height};}
function IframeOnload(ifr){if(ifr.src&&(ifr.src!="about:blank")){var dialog=DOM.fp(ifr,'div');dialog.style.visibility='hidden';ifr.style.display='block';var doc=DOM.ifdoc(ifr);if(!doc&&ShowPopupOnErrorHandler){return ShowPopupOnErrorHandler(ifr);}
var size=IframeResize(ifr);CenterBox(dialog,size.width,size.height);dialog.style.visibility="visible";var topDivId=dialog.id;addListener(doc,"keyup",AP_onInputKeyUp);var _followme=function(){var pY=document.documentElement.scrollTop||document.body.scrollTop;var floatDiv=$(topDivId);if(!floatDiv||!floatDiv.offsetWidth){return;}
var h=Math.floor((document.documentElement.clientHeight-floatDiv.offsetHeight)/2);if(h<0){var sh=20;}else{var sh=pY+h;}
var lastsh=parseInt(floatDiv.style.top);var dy=.2*(sh-lastsh);if(dy>0)dy=Math.ceil(dy);else dy=Math.floor(dy);sh=lastsh+dy;floatDiv.style.top=sh+"px";window.setTimeout(_followme,20);}
_followme();var inputs=doc.getElementsByTagName('input');for(var i=0,e=inputs.length;i<e;i++){addListener(inputs[i],"focus",AP_onInputFocus);addListener(inputs[i],"blur",AP_onInputBlur);}
inputs=null;var textareas=doc.getElementsByTagName('textarea');for(var i=0,e=textareas.length;i<e;i++){addListener(textareas[i],"focus",AP_onInputFocus);addListener(textareas[i],"blur",AP_onInputBlur);}
textareas=null;if(doc.ondisplay){doc.ondisplay();}
doc=dialog=cs=ifr=null;}}
function CenterBox(box,width,height)
{if(width>0){var msgWidth=width;box.style.width=msgWidth+'px';}else{var msgWidth=box.offsetWidth;}
var msgLeft=(document.documentElement.clientWidth-msgWidth)/2;if(width>0){var msgHeight=height;box.style.height=msgHeight+'px';}else{var msgHeight=box.offsetHeight;}
var msgHeight=box.offsetHeight;var msgTop=(document.documentElement.clientHeight-msgHeight)/2+(document.documentElement.scrollTop||document.body.scrollTop);box.style.left=msgLeft+'px';box.style.top=msgTop+'px';}
function HidePopup(topDivId,goReload,keep)
{topDivId=topDivId||visiblePopup[0];var textdialog=$(topDivId);if(textdialog){textdialog.style.visibility="hidden";if(textdialog.TimeoutId)clearTimeout(textdialog.TimeoutId);textdialog.TimeoutId=0;textdialog.style.display="none";if(!keep){var ifr=textdialog.getElementsByTagName('iframe')[0];ifr.src="about:blank";}
if(topDivId==visiblePopup[0])visiblePopup.shift();if(visiblePopup[0])$(visiblePopup[0]).style.zIndex=Veil.veilZ+1;else{removeListener(document,"keyup",AP_onInputKeyUp);}
if(goReload)reload();}
Veil.hide();}
function KillPopup(topDivId){var textdialog=$(topDivId);if(textdialog){var ifr=textdialog.getElementsByTagName('iframe')[0];ifr.src="about:blank";DOM.rn(textdialog);}}
function parentHidePopup(topDivId)
{parent?parent.HidePopup(topDivId):HidePopup(topDivId);}
function urlrn(url)
{url=url.replace(/rn=[.0-9]+/,'rn='+Math.random());url=url+(/rn=[.0-9]+/.test(url)?'':(/\?/.test(url)?'&':'?')+'rn='+(Math.random()*100000));return url;}
function parentReload(url)
{parent?reload(url,'_top'):reload(url);}
function reload(url,target){if(!url)url=document.location.href;url=urlrn(url);window.open(url,target||'_self');}
function delayHidePopup(topDivId,timeout,goReload)
{topDivId=topDivId||visiblePopup[0];var textdialog=$(topDivId);if(textdialog){textdialog.TimeoutId=setTimeout(function(){HidePopup(topDivId,goReload);},timeout||5000);}
textdialog=null;}
function delayParentHidePopup(topDivId,timeout,goReload)
{parent.delayHidePopup(topDivId,timeout,goReload);}
var Veil={overlay:null,veilZ:2000000,stack:[],setVeilSize:function(){Veil.overlay.style.width=DOM.getDocumentWidth()+'px';Veil.overlay.style.height=DOM.getDocumentHeight()+'px';},show:function(div){var _this=Veil;if(div&&(_this.stack[0]==div))return;if(_this.overlay==null){_this.overlay=$('HiddenBack');if(!_this.overlay){_this.overlay=DOM.cex('div',{style:{zIndex:_this.veilZ,width:0,height:0},id:"HiddenBack",innerHTML:"<!--[if lte IE 6.5]><iframe></iframe><![endif]-->"});}
document.body.insertBefore(_this.overlay,document.body.firstChild);}
if(!_this.stack.length){_this.setVeilSize();addListener(window,"resize",_this.setVeilSize);_this.overlay.style.display="block";hiddenObjects=DOM.fc(document.body,'object');for(var i=0;i<hiddenObjects.length;i++){hiddenObjects[i].style.visibility='hidden';}}else{_this.setVeilSize();}
_this.stack.unshift(div);},hide:function(){var _this=Veil;_this.stack.shift();if(!_this.stack.length){removeListener(window,"resize",_this.setVeilSize);if(_this.overlay)_this.overlay.style.display='none';if(hiddenObjects.length>0){for(var i=0;i<hiddenObjects.length;i++){hiddenObjects[i].style.visibility='visible';}
hiddenObjects=[];}}}}
var AP_isInputFocus=false;function AP_onInputFocus(e){AP_isInputFocus=true;}
function AP_onInputBlur(e){AP_isInputFocus=false;}
function AP_onInputKeyUp(e){e=e||window.event;var ek=e.keyCode;if(ek==27&&!AP_isInputFocus){HidePopup();cancelReturn(e);}}
function PopupLogin(a,url,guest)
{var url=url||(a&&a.href)||(parent&&parent.location.href)||'';if(parent&&(parent!=window)){window.open('/memberLogin/userlogin.htm?loginurl='+escape(urlrn(url)),'_top');return false;}else{if(guest)return ShowPopup('LoginDialog','/memberLogin/poplogin.htm?loginurl='+escape(urlrn(url)));else return ShowPopup('LoginDialog','/memberLogin/popuserlogin.htm?loginurl='+escape(urlrn(url)));}}
function Logout(a,url)
{var url=url||(a&&a.href)||(parent&&parent.location.href)||'';if(parent&&(parent!=window)){window.open('/memberLogin/logout.htm?logouturl='+escape(urlrn(url)),'_top');return false;}
else{return true;}}
function VotePopupLogin(a,url,guest)
{var url=url||(a&&a.href)||(parent&&parent.location.href)||'';if(parent&&(parent!=window)){window.open('/Award/voting.htm','_top');return false;}else{return ShowPopup('LoginDialog','/Award/popuplogin.htm?loginurl='+escape(urlrn(url)));}}
function fbs_click(e){u=e.href;t=e.getAttribute('t');window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}