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(\?.*)?$/)){
_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=[];
var _10=[];
var log={debug:function(obj){
if(_8&&window.console){
console.log(obj);
}
}};
var _13={buildForm:function(id){
var div=document.getElementById(_16.getDivId());
div.innerHTML+="<div style=\"display: none;\"><form method=\""+_16.getFormMethod()+"\" id=\""+_16.getFormId()+"\" action=\""+_16.getPostUrl()+"\" target=\"targetWindow\"></form></div>";
var _17=document.getElementById(_16.getFormId());
log.debug(_17);
var par=_f[id];
for(property in par){
if(par.hasOwnProperty(property)){
_17.appendChild(_13.buildInputElement(property,par[property]));
}
}
},insertIFrame:function(id){
var _1a=document.createElement("div");
_1a.innerHTML+=this.buildCloseButton();
_1a.innerHTML+="<iframe id=\"hyvesconnect_iframe\" name=\"targetWindow\" frameborder=\"0\" src=\"\"></iframe>";
document.body.appendChild(_1a);
_1b.attach(_1a);
var _1c=document.getElementById("hyvesconnect_iframe");
_1c.style.backgroundColor="#FFFFFF";
_1c.style.width="515px";
_1c.style.height=_16.getIFrameHeight(_f[id]["type"])+"px";
this.decorateDiv(_1a,_16.getDivId());
var _1d=_1e.getLeftAndTopOffset(_1c);
_1a.style.left=_1d.left+"px";
var top=_1d.top;
_1a.style.top=top>0?top+"px":0+"px";
},insertForm:function(id){
var div=document.getElementById(_16.getDivId());
document.body.appendChild(div);
this.buildForm(id);
document.getElementById(_16.getFormId()).submit();
},buildButton:function(id){
var _23=[16,24].join("|").indexOf(_10[id].iconsize)<0?24:_10[id].iconsize;
return "<a href=\"javascript:;\" onclick=\"Hyves.connect.submit("+id+");\"><img style=\"border:0px;\" src=\"http://www.hyves.nl/favicon.ico\" title=\"Tip op Hyves\"></a>";
},buildInputElement:function(key,_25){
var _26=document.createElement("input");
_26.type="hidden";
_26.name=key;
_26.value=_25;
log.debug(_26);
return _26;
},decorateDiv:function(_27,id){
_27.style.padding="15px";
_27.style.backgroundColor="rgb(207, 223, 239)";
_27.id=id;
_13.decorateGeneric(_27);
},decoratePreview:function(_29,id){
_29.style.margin="10px";
_29.style.padding="10px";
_29.style.border="1px solid black";
_29.style.backgroundColor="white";
_29.id=id;
_13.decorateGeneric(_29);
},decorateGeneric:function(_2b){
_2b.style.position="absolute";
_2b.style.zIndex="1000";
},buildCloseButton:function(){
return "<div onclick=\"Hyves.connect.close();\" id=\"hyvesconnect_close\" "+"style=\"background: transparent url("+_16.getCacheUrl()+"/images/popupbutton-sprite.gif) no-repeat scroll 0% 0%;"+" overflow: hidden; position: absolute; width: 15px; height: 15px;"+" cursor: pointer; margin-left: 2px; left: 528px; top: 0px;\">";
},buildPreviewCloseButton:function(){
return "<div id=\""+_16.getPreviewCloseButtonId()+"\" "+"style=\"background: transparent url("+_16.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 _2c=document.createElement("div");
_2c.id=_16.getPreviewDivContainerId();
_2c.style.position="absolute";
_2c.innerHTML=_13.buildPreviewCloseButton();
var div=document.createElement("div");
div.style.width=350+"px";
_13.decoratePreview(div,_16.getPreviewDivId());
_2c.appendChild(div);
document.body.appendChild(_2c);
_1b.attach(_2c);
var _2e=_1e.getLeftAndTopOffset(_2c);
log.debug(_2e);
_2c.style.left=_2e.left+"px";
_2c.style.top=(_2e.top-200)+"px";
var _2f=function(){
_1e.cleanup(_1e.getElementNode(_16.getPreviewDivContainerId()));
};
var _30=_1e.getElementNode(_16.getPreviewCloseButtonId());
if(_30.addEventListener){
_30.addEventListener("click",_2f,false);
}else{
_30.attachEvent("onclick",_2f);
}
}};
var _1e={getScrollOffset:function(){
var _31=document.body;
var _32=0,_33=0;
do{
_32+=_31.scrollTop||0;
_33+=_31.scrollLeft||0;
_31=_31.parentNode;
}while(_31);
return {left:_33,top:_32};
},getDocumentDimensions:function(){
var _34;
var _35;
if(typeof window.innerWidth!="undefined"){
_34=window.innerWidth,_35=window.innerHeight;
}else{
if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){
_34=document.documentElement.clientWidth,_35=document.documentElement.clientHeight;
}else{
_34=document.getElementsByTagName("body")[0].clientWidth,_35=document.getElementsByTagName("body")[0].clientHeight;
}
}
return {width:_34,height:_35};
},getLeftAndTopOffset:function(_36){
var _37=_1e.getElementDimensions(_36);
var _38=_1e.getDocumentDimensions();
var _39=_1e.getScrollOffset();
var _3a=Math.floor((_38.width/2)-(_37.width/2)+_39.left);
var top=Math.floor((_38.height/2)-(_37.height/2)+_39.top);
return {left:_3a,top:top};
},getElementDimensions:function(_3c){
return {width:_3c.clientWidth,height:_3c.clientHeight};
},getElementNode:function(_3d){
var _3e=false;
if(typeof _3d=="string"){
_3e=document.getElementById(_3d);
}else{
if(typeof _3d=="object"){
_3e=_3d;
}
}
return _3e;
},getBadgeNode:function(_3f){
log.debug("Looking for node: "+_3f);
return document.getElementById(_3f)||document.body;
},encodeParams:function(_40){
var _41=[];
for(i in _40){
if(_40.hasOwnProperty(i)){
_41.push(encodeURIComponent(i)+"="+encodeURIComponent(_40[i]));
}
}
return _41;
},appendAndEncodeParams:function(url,_43){
var _44=_1e.encodeParams(_43);
if(_44.length>0){
var _45="?";
if(url.indexOf("?")>-1||url.indexOf("#")>-1){
_45="&";
}
url+=_45+_44.join("&");
}
log.debug(url);
return url;
},extend:function(sub,_47){
var _48={};
for(var _49 in _47){
_48[_49]=_47[_49];
}
for(var _49 in sub){
_48[_49]=sub[_49];
}
return _48;
},cleanup:function(id){
var _4b=_1e.getElementNode(id);
if(_4b){
var up=_4b.parentNode;
up.removeChild(_4b);
}
}};
var _16={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(_4d){
for(var _4e in this.defaults){
if(_4d[_4e]){
this.defaults[_4e]=_4d[_4e];
}
}
},getIFrameHeight:function(_4f){
var _50=660;
switch(_4f){
case _a:
_50=560;
break;
case _b:
break;
case _c:
break;
case _d:
_50=400;
break;
case _e:
_50=300;
break;
default:
_50=660;
}
return _50;
}};
var _51=function(){
var _52=[];
return {button:function(_53,_54,_55){
_f.push(_53);
_10.push(_1e.extend(_54,_16.getDefaultOptions()));
id=_f.length-1;
var _56=_1e.getElementNode(_55);
var _57=_13.buildButton(id);
if(_56){
_56.innerHTML=_57;
}else{
document.write(_57);
}
},badge:function(_58,_59,_5a){
var _5b=document.createElement("iframe");
_5b.style.border="0px";
_5b.scrolling="no";
_5b.frameBorder="0";
_52.push(_5b);
var id=_52.length-1;
_5b.id=_16.getIframeIdPrefix()+id;
_5b.src=_1e.appendAndEncodeParams(_16.getBadgeUrl(),_1e.extend({frameId:id,badge_type:_58.type},_59));
var _5d=_1e.getBadgeNode(_5a);
log.debug("Placing in node: "+_5d);
setTimeout(function(){
_5d.appendChild(_5b);
},0);
log.debug("badges array length: "+_52.length);
return {call:function(key,_5f){
Hyves.connect.rpc.call(key,_5f,id);
}};
}};
}();
var rpc=function(){
var _61={};
var _62=[];
var _63="..";
var _64=_16.getRelayUrl();
var _65={parseParams:function(_66){
var obj={};
for(var i=0;i<_66.length;i++){
var _69=_66[i].split("=");
obj[decodeURIComponent(_69[0])]=decodeURIComponent(_69[1]);
}
return obj;
},emitIFrame:function(key,_6b,_6c){
var _6d;
for(var i=_62.length-1;i>=0;--i){
var ifr=_62[i];
try{
if(ifr&&(ifr.recyclable||ifr.readyState==="complete")){
ifr.parentNode.removeChild(ifr);
if(window.ActiveXObject){
_62[i]=ifr=null;
_62.splice(i,1);
}else{
ifr.recyclable=false;
log.debug("reusing iframe");
_6d=ifr;
break;
}
}
}
catch(e){
}
}
if(!_6d){
_6d=document.createElement("iframe");
_6d.style.border=_6d.style.width=_6d.style.height="0px";
_6d.style.visibility="hidden";
_6d.style.position="absolute";
_6d.onload=function(){
this.recyclable=true;
};
_62.push(_6d);
}
log.debug("iframepool size = "+_62.length);
var _6c=(typeof _6c!="undefined")?_6c:_63;
var src=_64+"#"+_6c+"&"+key;
_6d.src=_1e.appendAndEncodeParams(src,_6b);
setTimeout(function(){
document.body.appendChild(_6d);
},0);
},resize:function(_71,_72){
var _71=document.getElementById(_16.getIframeIdPrefix()+_72.frame);
_71.style.width=_72.width+"px";
_71.style.height=_72.height+"px";
},preview:function(_73){
var _74=document.getElementById(_16.getPreviewDivId());
if(!_74){
_13.buildPreview();
}
var _74=document.getElementById(_16.getPreviewDivId());
_74.innerHTML=_73.html;
},closePreview:function(){
_1e.cleanup(_1e.getElementNode(_16.getPreviewDivContainerId()));
}};
return {register:function(key,fn){
_61[key]=fn;
log.debug("registered function "+key);
},receive:function(_77,key,_79){
log.debug("receiving "+key);
try{
var _7a=_65.parseParams(_79);
switch(key){
case "resize":
_65.resize(_77,_7a);
break;
case "preview":
_65.preview(_7a);
break;
case "close_preview":
_65.closePreview();
break;
default:
_61[key](_7a);
}
}
catch(e){
log.debug("Error executing "+key+", "+e.message);
}
},call:function(key,_7c,_7d){
log.debug("called "+key);
_65.emitIFrame(key,_7c,_7d);
},setRelay:function(_7e){
log.debug("setting relay to: "+_7e);
_64=_7e;
},getHeight:function(){
var _7f=(window.ActiveXObject?document.body.scrollHeight+20:document.body.scrollHeight);
return _7f;
}};
}();
var _1b={_oElem:null,attach:function(_80){
_80.onmousedown=_1b._dragBegin;
_80.dragBegin=new Function();
_80.drag=new Function();
_80.dragEnd=new Function();
return _80;
},_dragBegin:function(e){
var _82=_1b._oElem=this;
if(isNaN(parseInt(_82.style.left))){
_82.style.left="0px";
}
if(isNaN(parseInt(_82.style.top))){
_82.style.top="0px";
}
var x=parseInt(_82.style.left);
var y=parseInt(_82.style.top);
e=e?e:window.event;
_82.mouseX=e.clientX;
_82.mouseY=e.clientY;
_82.dragBegin(_82,x,y);
document.onmousemove=_1b._drag;
document.onmouseup=_1b._dragEnd;
return false;
},_drag:function(e){
var _86=_1b._oElem;
var x=parseInt(_86.style.left);
var y=parseInt(_86.style.top);
e=e?e:window.event;
_86.style.left=x+(e.clientX-_86.mouseX)+"px";
_86.style.top=y+(e.clientY-_86.mouseY)+"px";
_86.mouseX=e.clientX;
_86.mouseY=e.clientY;
_86.drag(_86,x,y);
return false;
},_dragEnd:function(){
var _89=_1b._oElem;
var x=parseInt(_89.style.left);
var y=parseInt(_89.style.top);
_89.dragEnd(_89,x,y);
document.onmousemove=null;
document.onmouseup=null;
}};
var _8c={types:{HUB:_d,MEMBER:_9},members:function(_8d,_8e){
if(_8d.hub_id){
_8d["hubId"]=_8d.hub_id;
delete _8d.hub_id;
}
switch(_8d.type){
case _d:
var _8f="showMemberBadgeForHub";
break;
case _9:
var _8f="showMemberBadgeForMember";
break;
default:
return;
}
return _51.badge({type:_8f},_8d,_8e);
},scraps:function(_90,_91){
switch(_90.type){
case _d:
var _92="showScrapsBadgeForHub";
break;
case _9:
var _92="showScrapsBadgeForMember";
break;
default:
return;
}
return _51.badge({type:_92},_90,_91);
}};
return {tip:function(_93,_94,_95){
_93["type"]=_b;
_51.button(_93,_94,_95);
},blog:function(_96,_97,_98){
_96["type"]=_a;
_51.button(_96,_97,_98);
},widget:function(_99,_9a,_9b){
_99["type"]=_c;
_51.button(_99,_9a,_9b);
},interest:function(_9c,_9d,_9e){
_9c["type"]=_e;
_51.button(_9c,_9d,_9e);
},hub:function(_9f,_a0,_a1){
_9f["type"]=_d;
_51.button(_9f,_a0,_a1);
},submit:function(id){
_1e.cleanup(_16.getDivId());
_13.insertIFrame(id);
_13.insertForm(id);
},close:function(){
_1e.cleanup(_16.getDivId());
},defaults:function(_a3){
_16.setDefaultOptions(_a3);
},rpc:rpc,badge:_8c};
}();
try{
if(window.jsloaded){
jsloaded("/statics/hyvesconnect.js");
}
}
catch(e){
}

