if(!window.$id){var $id=function(A){return document.getElementById(A);};}document.cookie=["tzoffset="+new Date().getTimezoneOffset()/60*-1,"expires="+new Date(new Date().getTime()+(1000*24*60*60*1000)).toGMTString(),"path=/"].join("; ");var hi5=hi5||{};hi5.Lightbox=function(G,E,I){var C=$id("black-overlay"),B=$id("iframe-overlay"),F=$id("dialog-overlay");var H;$id("dialog-title").innerHTML=G;if(typeof (E)!=="undefined"&&E!==null){$id("dialog-body").innerHTML=E;}for(opt in I){switch(opt){case"acceptText":$id("dialog-accept").innerHTML=I[opt];break;case"onAccept":var A=$id("dialog-accept");A.callback=I[opt];A.onclick=function(){this.callback();F.style.display=B.style.display=C.style.display="none";};break;case"cancelText":$id("dialog-cancel").innerHTML=I[opt];break;case"onCancel":var D=$id("dialog-cancel");D.callback=I[opt];D.onclick=function(){this.callback();F.style.display=B.style.display=C.style.display="none";};break;case"onShow":H=I[opt];break;case"styleClass":F.className=B.className=I[opt];break;}}setTimeout(function(){F.style.display=B.style.display=C.style.display="block";if(!B.currentStyle||B.currentStyle.position==="fixed"){F.style.marginTop=B.style.marginTop=-F.offsetHeight/2+"px";}else{var J=(document.documentElement.clientHeight-F.offsetHeight)/2+document.documentElement.scrollTop;F.style.marginTop=B.style.marginTop=0;F.style.top=B.style.top=J+"px";}B.style.width=F.offsetWidth+"px";B.style.height=F.offsetHeight+"px";if(typeof (H)==="function"){H();}},0);};hi5.Lightbox.prototype.close=function(){var A=$id("black-overlay"),C=$id("iframe-overlay"),B=$id("dialog-overlay");B.style.display=C.style.display=A.style.display="none";};function createCookie(C,D,E){var A="";if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));A="; expires="+B.toGMTString();}document.cookie=C+"="+D+A+"; domain=.hi5.com ;path=/";}function eraseCookie(A){createCookie(A,"",-1);}function readCookie(B){if(document.cookie.length>0){var C=document.cookie.indexOf(B+"=");if(C!=-1){C=C+B.length+1;var A=document.cookie.indexOf(";",C);if(A==-1){A=document.cookie.length;}return unescape(document.cookie.substring(C,A));}}return null;}function appendCookie(B,C){var A=readCookie(B);var D=C.substring(C.indexOf("friend/")+6);D=new Date().getTime()+D;if(A==null||A.length==0){A=D;}else{A=A+"!"+D;}eraseCookie(B);createCookie(B,A,7);if(A.split(",").length>5){return 1;}else{return 0;}}function hasHi5Cookie(){var A=document.cookie.split(";");for(var B=0;B<A.length;B++){var C=A[B];if(C.match(/^hi5*/)){return true;}}return false;}function getViewerSegment(){var A;if(readCookie("hi5loggedIn")!=null){A="4";}else{if((readCookie("Email")!=null)||(readCookie("Userid")!=null)){A="3";}else{if(hasHi5Cookie()){A="2";}else{A="1";}}}return A;}function getViewerId(){var A;A=readCookie("Userid");return A;}function isUserInPopulation(){var A=false;if(readCookie("hi5loggedIn")!=null&&readCookie("hi5loggedIn")=="true"){var C=getViewerId();if((C>0)&&((C%1000)<=9)){createCookie("WSSSampleCookie","Y",30*365);A=true;}else{createCookie("WSSSampleCookie","N",30*365);A=false;}}else{if(readCookie("WSSSampleCookie")==null){var B=readCookie("JSESSIONID");if(B!=null&&(getHashCode(B)%100==0)){createCookie("WSSSampleCookie","Y",30*365);}else{createCookie("WSSSampleCookie","N",30*365);}}A=(readCookie("WSSSampleCookie")=="Y");}return A;}function getHashCode(D){var C=D.length;var B=0;for(var A=0;A<C;A++){B=parseInt(B*31+D.charCodeAt(A));B&=4294967295;}return B;}function getLoginMetrics(){var A=readCookie("LoginInfo");if(A!=null){eraseCookie("LoginInfo");return A;}return null;}function hitServer(B){var A=null;if(window.XMLHttpRequest){A=new XMLHttpRequest();}else{if(window.ActiveXObject){A=new ActiveXObject(Microsoft.XMLHTTP);}}A.open("GET",B,true);A.setRequestHeader("Content-Type","application/x-www-form-urlencoded");A.send(null);}function readCookie2(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length);}if(E.indexOf(D)==0){return E.substring(D.length,E.length);}}return null;}function init(){check_frame();if(window.init_form){init_form();}}function check_frame(){if(top.location!=document.location){}}function getcookie(A){var D=""+document.cookie;var C=D.indexOf(A);if(C==-1||A==""){return"";}var B=D.indexOf(";",C);if(B==-1){B=D.length;}return unescape(D.substring(C+A.length+1,B));}function popup(D,C,B){if(!window.focus){return true;}var A;if(typeof (D)=="string"){A=D;}else{A=D.href;}window.open(A,C,B);return false;}function MM_swapImgRestore(){var C,A,B=document.MM_sr;for(C=0;B&&C<B.length&&(A=B[C])&&A.oSrc;C++){A.src=A.oSrc;}}function MM_preloadImages(){var D=document;if(D.images){if(!D.MM_p){D.MM_p=new Array();}var C,B=D.MM_p.length,A=MM_preloadImages.arguments;for(C=0;C<A.length;C++){if(A[C].indexOf("#")!=0){D.MM_p[B]=new Image;D.MM_p[B++].src=A[C];}}}}function MM_findObj(E,D){var C,B,A;if(!D){D=document;}if((C=E.indexOf("?"))>0&&parent.frames.length){D=parent.frames[E.substring(C+1)].document;E=E.substring(0,C);}if(!(A=D[E])&&D.all){A=D.all[E];}for(B=0;!A&&B<D.forms.length;B++){A=D.forms[B][E];}for(B=0;!A&&D.layers&&B<D.layers.length;B++){A=MM_findObj(E,D.layers[B].document);}if(!A&&D.getElementById){A=D.getElementById(E);}return A;}function MM_swapImage(){var D,C=0,A,B=MM_swapImage.arguments;document.MM_sr=new Array;for(D=0;D<(B.length-2);D+=3){if((A=MM_findObj(B[D]))!=null){document.MM_sr[C++]=A;if(!A.oSrc){A.oSrc=A.src;}A.src=B[D+2];}}}function submitForm(A){if(!A){return false;}A.submit();}function submitFormByName(A){var B=document.getElementById(A);if(!B){return false;}B.submit();}function confirmSubmitForm(B,A){if(confirm(B)){document.forms[A].submit();}}function setSapoWebSearch(A){document.getElementById("PageHeader-Search").className=A?"sapo":"hi5";document.getElementById("PageHeader-Search-Type").value=A?"sapo":"hi5";document.getElementById("PageHeader-Search-Text").select();return false;}function appendSearchText(A){var B=document.getElementById("PageHeader-Search-Text").value.replace(/^\s+|\s$/,"");if(B==""){return true;}A.href+=(A.href.indexOf("?")?"&":"?")+"searchText="+B;return true;}function performSearch(D){var B=document.getElementById("PageHeader-Search-Text");var A=document.getElementById("PageHeader-Search-Type");if(!B){return ;}var E=B.value.replace(/^\s+|\s+$/,"");var C=A?A.value:"hi5";if(E==""||E==D){B.value="";B.focus();return ;}if(C=="sapo"){window.open("/friend/displayWebSearchResults.do?channel=hi5&q="+E,"");}else{if(C=="name"){location.href="/friend/processHeaderNameSearch.do?searchText="+E;}else{location.href="/friend/processBrowseSearch.do?searchText="+E;}}}var languageSelector;function showLanguageMenu(){languageSelector=new hi5.Lightbox("",document.getElementById("outerLang").innerHTML,{styleClass:"langSel"});}function closeLangSelector(){languageSelector.close();}var betaForm;function showBetaForm(){betaForm=new hi5.Lightbox("",document.getElementById("Home-BetaOptInContainer").innerHTML,{styleClass:"betaOptIn"});}function closeBetaForm(){betaForm.close();}var manageAppsLightbox;function showManageAppsLightbox(){manageAppsLightbox=new hi5.Lightbox("",document.getElementById("reorder_apps_lightbox").innerHTML,{styleClass:"manageApps"});}function closeManageAppsLightbox(){manageAppsLightbox.close();}var photoUploader;function showphotoUploader(A,B){if(B==null){window.location="/friend/photos/displayUploadPhotos.do?albumId="+A+"&uploadtool=";}else{window.location="/friend/photos/displayUploadPhotos.do?albumId="+A+"&uploadtool="+B;}}function lightboxphotoUploader(B,C){var A=B.responseText;photoUploader=new hi5.Lightbox("",A,{styleClass:"photoUpload"});}function closephotoUploader(){photoUploader.close();if(document.getElementById("uploadcont")){$("uploadcont").remove();}}selectAlbum=function(){document.getElementById("create-album").style.display="none";document.getElementById("select-album").style.display="";document.upload.type.value="0";};getSelectedAlbum=function(){if(document.getElementById("albumselradio").checked=true){var A=document.getElementById("albumId2");var B=document.getElementById("albumName");B.innerHTML=A.options[A.selectedIndex].text;}};sendForm=function(){document.upload.submit();};showMoreInput=function(){document.getElementById("files_more").style.display="";document.getElementById("file5_more").style.display="none";};getAlbumListJson=function(){var B="friend/photos/displayPhotoAlbumList.do";var A=document.getElementById("jsonlist");new Ajax.Updater("jsonlist",B,{asynchronous:true,evalScripts:false});};browseFiles=function(){var A=new Object();A.description="(*.jpg,*.jpeg,*.gif,*.png,*.bmp)";A.extension="*.jpg;*.jpeg;*.gif;*.png;*.bmp";uploadTool.browseFiles([A]);};uploadFiles=function(){setState(UploadFilesState);};cancelUpload=function(){uploadTool.cancelUploadDownload();setState(FilesListState);};hov=function(B,A){if(B.className){B.className=A;}};function absolutePosition(A){var C=A.offsetLeft;var B=A.offsetTop;while(A=A.offsetParent){C+=A.offsetLeft+(A.clientLeft||0);B+=A.offsetTop+(A.clientTop||0);}return{left:C,top:B};}function LoadingIndicator(E){var D;if(E!=null){D=E;}else{D=$j("body");}var C={"position":"absolute","top":"0","left":"0","z-index":"9999","background":'url("http://images.hi5.com/images/ajax-loader-lrg.gif") 50% 50% no-repeat'};var B={"position":"absolute","top":"0","left":"0","z-index":"9998","background":"#FFF","opacity":".75","filter":"alpha(opacity = 75)"};var F=document.createElement("div");var A=document.createElement("div");$j(F).css(B,"#333").width($j(D).width()).height($j(D).height());$j(A).css(C).width($j(D).width()).height($j(D).height());this.show=function(H){if(H){var I=document.createElement("h3");var G={"text-align":"center","padding":"20px","padding-top":($j(D).height()*0.5+25)+"px","text-transform":"capitalize","font-weight":"bold"};$j(I).css(G).text(H);$j(F).append(I);}$j(D).append(F).append(A).css("display","block");};this.destroy=function(){$j(F).remove();$j(A).remove();};}$j.extend({getUrlVars:function(){var D=[],C;var A=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var B=0;B<A.length;B++){C=A[B].split("=");D.push(C[0]);D[C[0]]=C[1];}return D;},getUrlVar:function(A){return $j.getUrlVars()[A];}});function appsMenu(){var A=this;this.menuTimer=null;this.appsMenu=document.getElementById("header-apps-menu");this.subMenu=document.getElementById("header-apps-submenu");this.appsLink=document.getElementById("header-apps-link");this.appsList=document.getElementById("header-apps-list");this.iframe=document.getElementById("header-apps-iframe");this.appsMenu.onmouseover=function(B){A.showAppsMenu(100);};this.appsMenu.onmouseout=function(B){A.hideAppsMenu(0);};this.appsLink.onmouseover=function(B){A.showAppsMenu(0);};this.appsLink.onmouseout=function(B){A.hideAppsMenu(0);};this.appsList.onmouseover=function(B){A.showAppsMenu(0);};this.appsList.onmouseout=function(B){A.hideAppsMenu(500);};}appsMenu.prototype.showAppsMenu=function(C){clearTimeout(this.menuTimer);var A=this;function B(){var E=absolutePosition(A.appsMenu);var D={x:0,y:0};if(navigator.userAgent.match("MSIE 6")){D={x:-2,y:-2};}if(navigator.userAgent.match("MSIE 7")){D={x:-2,y:-2};}if(navigator.userAgent.match("Firefox/3")){D={x:-1,y:0};}A.subMenu.style.left=E.left+D.x+"px";A.subMenu.style.top=E.top+D.y+"px";A.subMenu.style.visibility="visible";A.iframe.style.height=A.appsList.offsetHeight+"px";A.iframe.style.width=A.appsList.offsetWidth+"px";}if(C>0){this.menuTimer=setTimeout(B,C);}else{B();}};appsMenu.prototype.hideAppsMenu=function(C){clearTimeout(this.menuTimer);var B=this;function A(){B.subMenu.style.visibility="hidden";}if(C>0){this.menuTimer=setTimeout(A,C);}else{A();}};if(typeof (hi5)!=="object"){hi5={};}if(typeof (hi5.cart)!=="object"){hi5.cart={};}if(typeof (hi5.user)!=="object"){hi5.user={};}jQuery(document).ready(function(){hi5.cart.inline={cartURI:"/friend/payments/inlineCart.do",overlay:$j("#black-overlay"),getCart:function(A){hi5.cart.inline.overlay.css("display","block");$j.get(hi5.cart.inline.cartURI,A,function(C){if(!jQuery.browser.msie&&jQuery.browser.version!="6.0"){var B=$j("<link />");B.attr("rel","stylesheet");B.attr("type","text/css");B.attr("href","/friend/styles/cart.css");$j("head").append(B);}else{$j("head").append('<link rel="stylesheet" type="text/css" href="/friend/styles/cart.css" />');}var E=$j('<div id="inlineCart"></div>');E.html(C);hi5.cart.inline.overlay.after(E);if(E.css("position")=="absolute"){E.css("top",$j(document).scrollTop()+100);$j(document).scroll(function(F){E.css("top",$j(this).scrollTop()+100);});$j("#p_container").find("select, input").hide();}$j.getScript("/friend/js/cart/cart.js");E.append('<div id="closeCart">x</div>');var D=E.find("#closeCart");D.click(function(F){hi5.cart.inline.destroy();});E.show();});},destroy:function(){var A=hi5.cart.inline.overlay.next("#inlineCart");A.remove();hi5.cart.inline.overlay.hide();$j("#p_container").find("select, input").show();$j("link[href=/friend/styles/cart.css]").remove();}};});
