SKYPE.namespace("www");SKYPE.www.PublicChatJoinPage=function(){var b={encode:function(c){return escape(b._utf8_encode(c)).replace(/\+/g,"%2B")},decode:function(c){return b._utf8_decode(unescape(c.replace(/\+/g,"%20")))},_utf8_encode:function(e){var d="",h,f;e=e.replace(/\r\n/g,"\n");for(var g=0;g<e.length;g++){h=e.charCodeAt(g);f=e.charAt(g);if(h<128){d+=String.fromCharCode(h)}else{if((h>127)&&(h<2048)){d+=String.fromCharCode((h>>6)|192);d+=String.fromCharCode((h&63)|128)}else{d+=String.fromCharCode((h>>12)|224);d+=String.fromCharCode(((h>>6)&63)|128);d+=String.fromCharCode((h&63)|128)}}}return d},_utf8_decode:function(d){var e="";var f=0;var g=c1=c2=0;while(f<d.length){g=d.charCodeAt(f);ch=d.charAt(f);if(g<128){e+=String.fromCharCode(g);f++}else{if((g>191)&&(g<224)){c2=d.charCodeAt(f+1);e+=String.fromCharCode(((g&31)<<6)|(c2&63));f+=2}else{c2=d.charCodeAt(f+1);c3=d.charCodeAt(f+2);e+=String.fromCharCode(((g&15)<<12)|((c2&63)<<6)|(c3&63));f+=3}}}return e},splitQueryParams:function(h){var d=h||location.search.substring(1),c={},g,f;g=d.split("&");for(var e=0;e<g.length;e++){f=g[e].split("=");if(f.length!=2){continue}c[b.decode(f[0])]=b.decode(f[1])}return c}};YAHOO.util.Event.addListener(window,"load",function(){SKYPE.www.PublicChatJoinPage.loadDetection()});var a=b.splitQueryParams();return{loadDetection:function(){if(!SKYPE.util.ClientDetection.isReady()){SKYPE.util.ClientDetection.subscribe(SKYPE.www.PublicChatJoinPage.detectionSuccess,null,false,SKYPE.www.PublicChatJoinPage.detectionFailure);SKYPE.www.PublicChatJoinPage.switchContent("loading")}else{SKYPE.www.PublicChatJoinPage.detectionSuccess()}},detectionSuccess:function(){var c=SKYPE.www.PublicChatJoinPage.getPrefPlatform(),d=SKYPE.www.PublicChatJoinPage.getPrefVersion();if(SKYPE.util.ClientDetection.isInstalled()){d=SKYPE.util.ClientDetection.getVersion();c=SKYPE.util.ClientDetection.getPlatform()}SKYPE.www.PublicChatJoinPage.decideContentSwitch(c,d)},detectionFailure:function(){var c=SKYPE.www.PublicChatJoinPage.getPrefPlatform(),d=SKYPE.www.PublicChatJoinPage.getPrefVersion();SKYPE.www.PublicChatJoinPage.decideContentSwitch(c,d)},decideContentSwitch:function(c,d){var e=SKYPE.www.PublicChatJoinPage.isPublicChatSupported(c,d);switch(e){case"supported":SKYPE.www.PublicChatJoinPage.switchContent("success");break;case"unsupported":SKYPE.www.PublicChatJoinPage.switchContent("unsupported");break;case"unsupported-win4":SKYPE.www.PublicChatJoinPage.switchContent("unsupported-win4");break;case"upgrade":SKYPE.www.PublicChatJoinPage.switchContent("error");break;default:SKYPE.www.PublicChatJoinPage.switchContent("default")}},getPrefVersion:function(){if(SKYPE.user&&SKYPE.user.Preferences){var c=SKYPE.user.Preferences.getParsedVersion();return c.version}return null},getPrefPlatform:function(){if(SKYPE.user&&SKYPE.user.Preferences){var c=SKYPE.user.Preferences.getParsedVersion();return c.platform}return null},isPublicChatSupported:function(c,d){if(c=="windows"||c=="0"){if(d){if(SKYPE.util.ClientDetection.isQualifiedVersion("4.0.0.0",d)){return"unsupported-win4"}else{if(SKYPE.util.ClientDetection.isQualifiedVersion("3.0.0.106",d)){return"supported"}}return"upgrade"}}else{if(c.indexOf("mac")>-1||c=="3"){if(d&&SKYPE.util.ClientDetection.isQualifiedVersion("2.6.0.72",d)){return"supported"}return"upgrade"}else{if(c.indexOf("linux")>-1||c=="2"){return"unsupported"}}}return"unknown"},getChatBlob:function(){return a.blob||""},getChatTopic:function(){return a.topic||""},switchContent:function(d){var f=YAHOO.util.Dom,g=f.getElementsByClassName("publicchat-content-variant","div");f.setStyle(g,"display","none");switch(d){case"loading":f.setStyle("publicchat-message-loading","display","block");break;case"success":var e=SKYPE.www.PublicChatJoinPage.getPublicChatUri(),c=SKYPE.www.PublicChatJoinPage.getChatTopic();f.setStyle("publicchat-message-success","display","block");c=c.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;");f.getElementsByClassName("publicchat-title","span",null,function(h){h.innerHTML=c});f.get("chat-link-reopen").href=e;location.href=e;break;case"error":f.setStyle("publicchat-message-error","display","block");break;case"unsupported-win4":if(!f.get("publicchat-message-unsupported-win4")){f.setStyle("publicchat-message-unsupported","display","block")}else{f.setStyle("publicchat-message-unsupported-win4","display","block")}break;default:f.setStyle("publicchat-message-default","display","block");break}},getPublicChatUri:function(c){return"skype:?chat&blob="+b.encode(c||SKYPE.www.PublicChatJoinPage.getChatBlob())}}}();