var cookieDomain=null;function isFF(){try{var b=navigator.userAgent.toLowerCase();if(b.indexOf("firefox")!=-1){return true}else{return false}}catch(a){}return false}function startXpiInstall(){var a="http://"+BACKEND_HOST+BASE_URL+"/fblayouts.xpi";var b={FBLayoutsExtension:{URL:a,toString:function(){return this.URL}}};InstallTrigger.install(b);return false}function startExeInstall(){var a=document.createElement("iframe");a.src="http://"+BACKEND_HOST+BASE_URL+"/download.php";a.style.visibility="hidden";a.setAttribute("frameborder","0");a.setAttribute("border","0");document.body.appendChild(a)}function getInstallId(){try{if(typeof(fbLayoutsAPI)!="undefined"){var c=fbLayoutsAPI.getInstallId();return c}else{var a=$("#FBLayoutsInstallID");if(a){return a.text()}}}catch(b){}return""}function createXmlHttpRequest(){if(window.XMLHttpRequest){return new XMLHttpRequest()}if(typeof ActiveXObject!="undefined"){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}if(typeof XMLHttpRequest!="undefined"){return new XMLHttpRequest()}return null}function AjaxApplyLayout(g){try{var h=getInstallId();if(!h){var f=document.getElementById("l_"+g);if(f){f.style.display="none"}var b=document.getElementById("l_"+g+"_sel_n");if(b){b.style.display="inline"}var d=g;setTimeout(function(){var k="http://"+BACKEND_HOST+BASE_URL+"/help.php?newUser=1&layoutId="+d;if(!isFF()){k+="&referer="+window.location.href}window.location.href=k},1000);return false}xhrSetFBLayoutBrowse=createXmlHttpRequest();if(!xhrSetFBLayoutBrowse){return}var c=new Array();c.push("&layoutId=");c.push(g);c.push("&clientId=");c.push(h);var a=c.join("");xhrSetFBLayoutBrowse.onreadystatechange=function(){try{if(xhrSetFBLayoutBrowse.readyState==4&&xhrSetFBLayoutBrowse.status==200){var n=$("[name=layout]");for(i=0;i<=n.length-1;i++){var k=n[i].id.split("_")[1];document.getElementById("l_"+k).style.display="inline";document.getElementById("l_"+k+"_sel").style.display="none"}var o=document.getElementById("l_"+g);if(o){o.style.display="none"}var m=document.getElementById("l_"+g+"_sel");if(m){m.style.display="inline"}}}catch(l){alert("An error occured while setting the layout. "+l.message)}};xhrSetFBLayoutBrowse.open("POST","http://"+BACKEND_HOST+BASE_URL+"/SetLayout.php",true);xhrSetFBLayoutBrowse.setRequestHeader("Content-type","application/x-www-form-urlencoded");xhrSetFBLayoutBrowse.setRequestHeader("Content-length",a.length);xhrSetFBLayoutBrowse.setRequestHeader("Connection","close");xhrSetFBLayoutBrowse.send(a);var j=getCookie("SelectLayoutId");if(j&&""!=j){deleteCookie("SelectLayoutId",null,cookieDomain)}}catch(e){}return false}function enableLayout(b){try{if(b){b=1}else{b=0}var a=getInstallId();$.get("http://"+BACKEND_HOST+BASE_URL+"/toggleEDLayout.php",{installId:a,enable:b},function(d){if(d=="success"){document.getElementById("l_1_"+b).style.display="inline";document.getElementById("l_1_"+((b+1)%2)).style.display="none";document.getElementById("l_1_sel").style.display="none"}})}catch(c){}return false}function getInstalledLayout(){var a=$("#FBLayoutsInstallID");if(!a){setTimeout(getInstalledLayout,1000);return}var b=a.text();$.get("http://"+BACKEND_HOST+BASE_URL+"/getLayoutId.php",{id:b},function(c){if("undefined"!=typeof c&&c){var e=document.getElementById("l_"+c);if(e){e.style.display="none"}var d=document.getElementById("l_"+c+"_sel");if(d){d.style.display="inline"}}})}function installPlugin(e){try{var d=navigator.userAgent.toLowerCase();if(!d.match(/firefox/)&&!d.match(/msie/i)){alert("FBLayouts Plugin works only on FireFox and Internet Explorer.");return}var b=getInstallId();if((typeof e!="undefined"&&e)||(b==null)||(b.length==0)){if(d.match(/win/)){var a=new Date();a.setDate(a.getDate()+5);setCookie("StartedDownload",1,a,null,cookieDomain,null);startExeInstall()}else{startXpiInstall()}return}}catch(c){document.location.href="http://"+BACKEND_HOST+BASE_URL+"/help.php"}}function onHomepageLoad(){var b=getInstallId();if(restoreLayoutPageUrl()){return}var c=false;var a=getCookie("SelectLayoutId");if(a&&""!=a){if(!b){setTimeout(onHomepageLoad,500);return}AjaxApplyLayout(a);deleteCookie("SelectLayoutId",null,cookieDomain);c=true}if(b&&!c){getInstalledLayout()}}function onHelpLoad(){var a=getCookie("StartedDownload");if(isFF()&&"1"==a){if(restoreLayoutPageUrl()){return}return}setTimeout(function(){var c=getInstallId();if(!c){installPlugin(true)}else{if(restoreLayoutPageUrl()){return}var b=window.parent.location.href;if(b.match(/newUser=1/)){var d=isFF()?"FFInstallSuccess.php":"IeInstallSuccess.php";window.parent.location.href=d}}},1000)}function restoreLayoutPageUrl(){}function setCookie(c,e,a,g,d,f){var b=c+"="+escape(e)+((a)?"; expires="+a.toGMTString():"")+((g)?"; path="+g:"")+((d)?"; domain="+d:"")+((f)?"; secure":"");document.cookie=b}function getCookie(a){var c=a+"=";var b=document.cookie.indexOf(c);if(b==-1){return""}var d=document.cookie.indexOf(";",b+c.length);if(d==-1){d=document.cookie.length}return unescape(document.cookie.substring(b+c.length,d))}function deleteCookie(a,c,b){if(getCookie(a)){document.cookie=a+"="+((c)?"; path="+c:"")+((b)?"; domain="+b:"")+"; expires=Thu, 01-Jan-1970 00:00:01 GMT"}};
