var Hyves=Hyves||{};
Hyves.connect=function(){
var aS;
try{
aS=document.getElementsByTagName("script");
}
catch(e){
aS=[];
}
var _2=false;
for(var i=0;i<aS.length;i++){
var s=aS[i];
if(s.src){
if(s.src.match(/precompiled\/hyvesconnect\.js(\?.*)?$/)){
_2=s.src.match(/\?.*env=([a-z,]*)/);
var _5=s.src.match(/(http:\/\/[a-z0-9\_\-\.]*)\//)[1];
}else{
if(s.src.match(/\.vmware\/statics\/hyvesconnect\.js(\?.*)?$/)||s.src.match(/\.dev\/statics\/hyvesconnect\.js(\?.*)?$/)){
_2=[true,"development"];
var _5=s.src.match(/(http:\/\/[a-z0-9\_\-\.]*)\//)[1];
}
}
}
}
var _6=(_2?_2[1]:"live");
var _7=_6=="development"?false:true;
var _8=true;
var _9=6;
var _a=9;
var _b=11;
var _c=27;
var _d=29;
var _e=43;
var _f=34;
var _10=8;
var _11=10001;
var _12=10002;
var _13=10003;
var _14=[];
var _15=[];
var log={debug:function(obj){
if(_8&&window.console){
console.log(obj);
}
}};
var _18={buildPopupUrl:function(id){
var par=_14[id];
var _1b=[];
for(property in par){
if(par.hasOwnProperty(property)){
_1b.push(escape(property)+"="+escape(par[property]));
}
}
var url=_1d.getPostUrl()+"?"+_1b.join("&");
log.debug(url);
return url;
},buildButton:function(id){
var _1f=[16,24].join("|").indexOf(_15[id].iconsize)<0?24:_15[id].iconsize;
return "<a href=\"javascript:;\" onclick=\"Hyves.connect.submit("+id+");\"><img style=\"border:0px;\" src=\"/images/favicon_24_round.png\"></a>";
},decorateDiv:function(_20,id){
_20.style.padding="15px";
_20.style.backgroundColor="rgb(207, 223, 239)";
_20.id=id;
_18.decorateGeneric(_20);
},decoratePreview:function(_22,id){
_22.style.margin="10px";
_22.style.padding="10px";
_22.style.border="1px solid black";
_22.style.backgroundColor="white";
_22.id=id;
_18.decorateGeneric(_22);
},decorateGeneric:function(_24){
_24.style.position="absolute";
_24.style.zIndex="1000";
},buildPreviewCloseButton:function(){
return "<div id=\""+_1d.getPreviewCloseButtonId()+"\" "+"style=\"background: transparent url("+_1d.getCacheUrl()+"/images/redesign/buttons/closebox.png) no-repeat scroll 0% 0%;"+" overflow: hidden; position: absolute; width: 30px; height: 30px;"+" cursor: pointer; z-index: 1010;\">";
},buildPreview:function(){
var _25=document.createElement("div");
_25.id=_1d.getPreviewDivContainerId();
_25.style.position="absolute";
_25.innerHTML=_18.buildPreviewCloseButton();
var div=document.createElement("div");
div.style.width=350+"px";
_18.decoratePreview(div,_1d.getPreviewDivId());
_25.appendChild(div);
document.body.appendChild(_25);
DragHandler.attach(_25);
var _27=helper.getLeftAndTopOffset(_25);
log.debug(_27);
_25.style.left=_27.left+"px";
_25.style.top=(_27.top-200)+"px";
var _28=function(){
_29.cleanup(_29.getElementNode(_1d.getPreviewDivContainerId()));
};
var _2a=_29.getElementNode(_1d.getPreviewCloseButtonId());
if(_2a.addEventListener){
_2a.addEventListener("click",_28,false);
}else{
_2a.attachEvent("onclick",_28);
}
}};
var _29={getScrollOffset:function(){
var _2b=document.body;
var _2c=0,_2d=0;
do{
_2c+=_2b.scrollTop||0;
_2d+=_2b.scrollLeft||0;
_2b=_2b.parentNode;
}while(_2b);
return {left:_2d,top:_2c};
},getDocumentDimensions:function(){
var _2e;
var _2f;
if(typeof window.innerWidth!="undefined"){
_2e=window.innerWidth,_2f=window.innerHeight;
}else{
if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){
_2e=document.documentElement.clientWidth,_2f=document.documentElement.clientHeight;
}else{
_2e=document.getElementsByTagName("body")[0].clientWidth,_2f=document.getElementsByTagName("body")[0].clientHeight;
}
}
return {width:_2e,height:_2f};
},getLeftAndTopOffset:function(_30){
var _31=_29.getElementDimensions(_30);
var _32=_29.getDocumentDimensions();
var _33=_29.getScrollOffset();
var _34=Math.floor((_32.width/2)-(_31.width/2)+_33.left);
var top=Math.floor((_32.height/2)-(_31.height/2)+_33.top);
return {left:_34,top:top};
},getElementDimensions:function(_36){
return {width:_36.clientWidth,height:_36.clientHeight};
},getElementNode:function(_37){
var _38=false;
if(typeof _37=="string"){
_38=document.getElementById(_37);
}else{
if(typeof _37=="object"){
_38=_37;
}
}
return _38;
},getBadgeNode:function(_39){
log.debug("Looking for node: "+_39);
return document.getElementById(_39)||document.body;
},encodeParams:function(_3a){
var _3b=[];
for(i in _3a){
if(_3a.hasOwnProperty(i)){
_3b.push(encodeURIComponent(i)+"="+encodeURIComponent(_3a[i]));
}
}
return _3b;
},appendAndEncodeParams:function(url,_3d){
var _3e=_29.encodeParams(_3d);
if(_3e.length>0){
var _3f="?";
if(url.indexOf("?")>-1||url.indexOf("#")>-1){
_3f="&";
}
url+=_3f+_3e.join("&");
}
log.debug(url);
return url;
},extend:function(sub,_41){
var _42={};
for(var _43 in _41){
_42[_43]=_41[_43];
}
for(var _43 in sub){
_42[_43]=sub[_43];
}
return _42;
},cleanup:function(id){
var _45=_29.getElementNode(id);
if(_45){
var up=_45.parentNode;
up.removeChild(_45);
}
}};
var _1d={getHyvesUrl:function(){
return (_7?"http://www.hyves.nl":_5.replace("cache","www"));
},getPostUrl:function(){
return this.getHyvesUrl()+"/hyvesconnect/smartbutton";
},getBadgeUrl:function(){
return this.getHyvesUrl()+"/hyvesconnect/badge";
},getRelayUrl:function(){
return this.getHyvesUrl()+"/statics/hcrpc_relay.html";
},getCacheUrl:function(){
return _7?"http://cache.hyves-static.net":_5;
},getDivId:function(){
return "hyvesconnect_div";
},getPreviewDivId:function(){
return "hvyesconnect_preview";
},getPreviewDivContainerId:function(){
return "hvyesconnect_preview_container";
},getPreviewCloseButtonId:function(){
return "hyvesconnect_preview_close";
},getFormId:function(){
return "hyvesconnect_form";
},getIframeIdPrefix:function(){
return "hyvesconnect_iframe_";
},defaults:{iconsize:24},getFormMethod:function(){
return "get";
},getDefaultOptions:function(){
return this.defaults;
},setDefaultOptions:function(_47){
for(var _48 in this.defaults){
if(_47[_48]){
this.defaults[_48]=_47[_48];
}
}
},getIFrameHeight:function(_49){
var _4a=660;
switch(_49){
case _a:
case _9:
case _10:
_4a=560;
break;
case _b:
_4a=450;
break;
case _c:
break;
case _d:
_4a=400;
break;
case _e:
_4a=300;
break;
case _11:
_4a=550;
break;
case _f:
_4a=400;
break;
default:
_4a=660;
}
return _4a;
}};
var _4b=function(){
var _4c=[];
return {button:function(_4d,_4e,_4f){
_14.push(_4d);
_15.push(_29.extend(_4e,_1d.getDefaultOptions()));
id=_14.length-1;
var _50=_29.getElementNode(_4f);
var _51=_18.buildButton(id);
if(_50){
_50.innerHTML=_51;
}else{
document.write(_51);
}
},badge:function(_52,_53,_54){
if(_53.style){
var n=0;
for(k in _53.style){
if(_53.style.hasOwnProperty(k)){
_53["pers_item_profile."+k]=_53.style[k];
n++;
}
}
_53.style=n>0?true:false;
}
var _56=document.createElement("iframe");
_56.style.border="0px";
_56.style.width="1px";
_56.scrolling="no";
_56.frameBorder="0";
_4c.push(_56);
var id=_4c.length-1;
_56.id=_1d.getIframeIdPrefix()+id;
_56.src=_29.appendAndEncodeParams(_1d.getBadgeUrl(),_29.extend({frameId:id,badge_type:_52.type},_53));
var _58=_29.getBadgeNode(_54);
log.debug("Placing in node: "+_58);
setTimeout(function(){
_58.appendChild(_56);
},0);
log.debug("badges array length: "+_4c.length);
return {call:function(key,_5a){
Hyves.connect.rpc.call(key,_5a,id);
}};
}};
}();
var rpc=function(){
var _5c={};
var _5d=[];
var _5e="..";
var _5f=_1d.getRelayUrl();
var _60={parseParams:function(_61){
var obj={};
for(var i=0;i<_61.length;i++){
var _64=_61[i].split("=");
obj[decodeURIComponent(_64[0])]=decodeURIComponent(_64[1]);
}
return obj;
},emitIFrame:function(key,_66,_67){
var _68;
for(var i=_5d.length-1;i>=0;--i){
var ifr=_5d[i];
try{
if(ifr&&(ifr.recyclable||ifr.readyState==="complete")){
ifr.parentNode.removeChild(ifr);
if(window.ActiveXObject){
_5d[i]=ifr=null;
_5d.splice(i,1);
}else{
ifr.recyclable=false;
log.debug("reusing iframe");
_68=ifr;
break;
}
}
}
catch(e){
}
}
if(!_68){
_68=document.createElement("iframe");
_68.style.border=_68.style.width=_68.style.height="0px";
_68.style.visibility="hidden";
_68.style.position="absolute";
_68.onload=function(){
this.recyclable=true;
};
_5d.push(_68);
}
log.debug("iframepool size = "+_5d.length);
var _67=(typeof _67!="undefined")?_67:_5e;
var src=_5f+"#"+_67+"&"+key;
_68.src=_29.appendAndEncodeParams(src,_66);
setTimeout(function(){
document.body.appendChild(_68);
},0);
},resize:function(_6c,_6d){
log.debug("Resizing...");
var _6c=document.getElementById(_1d.getIframeIdPrefix()+_6d.frame);
_6c.style.width=_6d.width+"px";
_6c.style.height=_6d.height+"px";
},preview:function(_6e){
var _6f=document.getElementById(_1d.getPreviewDivId());
if(!_6f){
_18.buildPreview();
}
var _6f=document.getElementById(_1d.getPreviewDivId());
_6f.innerHTML=_6e.html;
},closePreview:function(){
_29.cleanup(_29.getElementNode(_1d.getPreviewDivContainerId()));
}};
return {register:function(key,fn){
_5c[key]=fn;
log.debug("registered function "+key);
},receive:function(_72,key,_74){
log.debug("receiving "+key);
try{
var _75=_60.parseParams(_74);
switch(key){
case "resize":
_60.resize(_72,_75);
break;
case "preview":
_60.preview(_75);
break;
case "close_preview":
_60.closePreview();
break;
default:
_5c[key](_75);
}
}
catch(e){
log.debug("Error executing "+key+", "+e.message);
}
},call:function(key,_77,_78){
log.debug("called "+key);
_60.emitIFrame(key,_77,_78);
},setRelay:function(_79){
log.debug("setting relay to: "+_79);
_5f=_79;
},getHeight:function(){
var _7a=document.body.style.display;
if(_7a!="none"&&_7a!=null){
return document.body.offsetHeight;
}
var els=document.body.style;
var _7c=els.visibility;
var _7d=els.position;
var _7e=els.display;
els.visibility="hidden";
els.position="absolute";
els.display="block";
var _7f=document.body.clientHeight;
els.display=_7e;
els.position=_7d;
els.visibility=_7c;
return _7f;
}};
}();
var _80={_oElem:null,attach:function(_81){
_81.onmousedown=_80._dragBegin;
_81.dragBegin=new Function();
_81.drag=new Function();
_81.dragEnd=new Function();
return _81;
},_dragBegin:function(e){
var _83=_80._oElem=this;
if(isNaN(parseInt(_83.style.left))){
_83.style.left="0px";
}
if(isNaN(parseInt(_83.style.top))){
_83.style.top="0px";
}
var x=parseInt(_83.style.left);
var y=parseInt(_83.style.top);
e=e?e:window.event;
_83.mouseX=e.clientX;
_83.mouseY=e.clientY;
_83.dragBegin(_83,x,y);
document.onmousemove=_80._drag;
document.onmouseup=_80._dragEnd;
return false;
},_drag:function(e){
var _87=_80._oElem;
var x=parseInt(_87.style.left);
var y=parseInt(_87.style.top);
e=e?e:window.event;
_87.style.left=x+(e.clientX-_87.mouseX)+"px";
_87.style.top=y+(e.clientY-_87.mouseY)+"px";
_87.mouseX=e.clientX;
_87.mouseY=e.clientY;
_87.drag(_87,x,y);
return false;
},_dragEnd:function(){
var _8a=_80._oElem;
var x=parseInt(_8a.style.left);
var y=parseInt(_8a.style.top);
_8a.dragEnd(_8a,x,y);
document.onmousemove=null;
document.onmouseup=null;
}};
var _8d={types:{HUB:_d,MEMBER:_9},members:function(_8e,_8f){
if(_8e.hub_id){
_8e["hubId"]=_8e.hub_id;
delete _8e.hub_id;
}
switch(_8e.type){
case _d:
var _90="showMemberBadgeForHub";
break;
case _9:
var _90="showMemberBadgeForMember";
break;
default:
return;
}
return _4b.badge({type:_90},_8e,_8f);
},scraps:function(_91,_92){
switch(_91.type){
case _d:
var _93="showScrapsBadgeForHub";
break;
case _9:
var _93="showScrapsBadgeForMember";
break;
default:
return;
}
return _4b.badge({type:_93},_91,_92);
},firehose:function(_94,_95){
return _4b.badge({type:"showPublicWwwMini"},_94,_95);
},poll:function(_96,_97){
return _4b.badge({type:"showPoll"},_96,_97);
}};
return {tip:function(_98,_99,_9a){
_98["type"]=_b;
_4b.button(_98,_99,_9a);
},blog:function(_9b,_9c,_9d){
_9b["type"]=_a;
_4b.button(_9b,_9c,_9d);
},widget:function(_9e,_9f,_a0){
_9e["type"]=_c;
_4b.button(_9e,_9f,_a0);
},interest:function(_a1,_a2,_a3){
_a1["type"]=_e;
_4b.button(_a1,_a2,_a3);
},hub:function(_a4,_a5,_a6){
_a4["type"]=_d;
_4b.button(_a4,_a5,_a6);
},friendinvite:function(_a7,_a8,_a9){
_a7["type"]=_9;
_4b.button(_a7,_a8,_a9);
},presence:function(_aa,_ab,_ac){
_aa["type"]=_f;
_4b.button(_aa,_ab,_ac);
},combo:function(_ad,_ae,_af){
_ad["type"]=_11;
_4b.button(_ad,_ae,_af);
},tellafriend:function(_b0,_b1,_b2){
_b0["type"]=_12;
_4b.button(_b0,_b1,_b2);
},pay:function(_b3,_b4,_b5){
_b3["type"]=_13;
_4b.button(_b3,_b4,_b5);
},media:function(_b6,_b7,_b8){
_b6["type"]=_10;
_4b.button(_b6,_b7,_b8);
},submit:function(id){
var url=_18.buildPopupUrl(id);
window.open(url,"popup","height="+_1d.getIFrameHeight(_14[id]["type"])+",width=520,location=yes");
},close:function(){
_29.cleanup(_1d.getDivId());
},defaults:function(_bb){
_1d.setDefaultOptions(_bb);
},rpc:rpc,badge:_8d};
}();
try{
if(window.jsloaded){
jsloaded("/statics/hyvesconnect.js");
}
}
catch(e){
}
