var Hyves=Hyves||{};Hyves.connect=function(){var e=document.getElementsByTagName("script");var r=false;for(var p=0;p<e.length;p++){var m=e[p];if(m.src&&m.src.match(/precompiled\/hyvesconnect\.js(\?.*)?$/)){r=m.src.match(/\?.*env=([a-z,]*)/);var l=m.src.match(/(http:\/\/[a-z0-9\_\-\.]*)\//)[1]}}var t=(r?r[1]:"live");var d=t=="development"?false:true;var q=false;var k=9;var g=11;var o=27;var b=29;var h=43;var u=[];var c=[];var j={debug:function(i){if(q){console.log(i)}}};var n={buildForm:function(y){var x=document.getElementById(v.getDivId());x.innerHTML+='<div style="display: none;"><form method="'+v.getFormMethod()+'" id="'+v.getFormId()+'" action="'+v.getPostUrl()+'" target="targetWindow"></form></div>';var w=document.getElementById(v.getFormId());j.debug(w);var i=u[y];for(property in i){if(i.hasOwnProperty(property)){var s=document.createElement("input");s.type="hidden";s.name=property;s.value=i[property];j.debug(s);w.appendChild(s)}}},getIFrameHeight:function(s){var i=660;switch(s){case k:i=560;break;case g:break;case o:break;case b:i=400;break;case h:i=300;break;default:i=660}return i},insertIFrame:function(A){var w=document.createElement("div");w.innerHTML+=this.buildCloseButton();w.innerHTML+='<iframe id="hyvesconnect_iframe" name="targetWindow" frameborder="0" src=""></iframe>';document.body.appendChild(w);var s=document.getElementById("hyvesconnect_iframe");s.style.backgroundColor="#FFFFFF";s.style.width="515px";s.style.height=n.getIFrameHeight(u[A]["type"])+"px";var i=a.getElementDimensions(s);this.decorateDiv(w);var y=a.getDocumentDimensions();var x=a.getScrollOffset();w.style.left=Math.floor((y.width/2)-(i.width/2)+x.left)+"px";var z=(Math.floor((y.height/2)-(i.height/2)+x.top));w.style.top=z>0?z+"px":0+"px"},insertForm:function(s){var i=document.getElementById(v.getDivId());document.body.appendChild(i);this.buildForm(s);document.getElementById(v.getFormId()).submit()},buildButton:function(s){var i=[16,24].join("|").indexOf(c[s].iconsize)<0?24:c[s].iconsize;return'<a href="javascript:;" onclick="Hyves.connect.submit('+s+');"><img style="border:0px;" src="'+v.getCacheUrl()+"/images/hyvesconnect/favicon_"+i+'_round.png" title="Voeg toe aan Hyves"></a>'},decorateDiv:function(i){i.style.padding="15px";i.style.backgroundColor="rgb(207, 223, 239)";i.id=v.getDivId();i.style.position="absolute"},buildCloseButton:function(){return'<div onclick="Hyves.connect.close();" id="hyvesconnect_close" style="background: transparent url('+v.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;">'}};var a={getScrollOffset:function(){var s=document.body;var i=0,w=0;do{i+=s.scrollTop||0;w+=s.scrollLeft||0;s=s.parentNode}while(s);return{left:w,top:i}},getDocumentDimensions:function(){var s;var i;if(typeof window.innerWidth!="undefined"){s=window.innerWidth,i=window.innerHeight}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){s=document.documentElement.clientWidth,i=document.documentElement.clientHeight}else{s=document.getElementsByTagName("body")[0].clientWidth,i=document.getElementsByTagName("body")[0].clientHeight}}return{width:s,height:i}},getElementDimensions:function(i){return{width:i.clientWidth,height:i.clientHeight}},getElementNode:function(s){var i=false;if(typeof s=="string"){i=document.getElementById(s)}else{if(typeof s=="object"){i=s}}return i},extend:function(i,w){var x={};for(var s in w){x[s]=w[s]}for(var s in i){x[s]=i[s]}return x}};var v={getPostUrl:function(){var i=(d?"http://www.hyves.nl":l)+"/hyvesconnect/smartbutton";return i},getCacheUrl:function(){return d?"http://cache.hyves-static.net":l},getDivId:function(){return"hyvesconnect_div"},getFormId:function(){return"hyvesconnect_form"},defaults:{iconsize:24},getFormMethod:function(){return"get"},getDefaultOptions:function(){return this.defaults},setDefaultOptions:function(i){for(var s in this.defaults){if(i[s]){this.defaults[s]=i[s]}}}};var f={generic:function(i,w,y){u.push(i);c.push(a.extend(w,v.getDefaultOptions()));id=u.length-1;var x=a.getElementNode(y);var s=n.buildButton(id);if(x){x.innerHTML=s}else{document.write(s)}},cleanup:function(){var s=document.getElementById(v.getDivId());if(s){var i=s.parentNode;i.removeChild(s)}}};return{tip:function(i,s,w){i.type=g;f.generic(i,s,w)},blog:function(i,s,w){i.type=k;f.generic(i,s,w)},widget:function(i,s,w){i.type=o;f.generic(i,s,w)},interest:function(i,s,w){i.type=h;f.generic(i,s,w)},hub:function(i,s,w){i.type=b;f.generic(i,s,w)},submit:function(i){f.cleanup();n.insertIFrame(i);n.insertForm(i)},close:function(){f.cleanup()},defaults:function(i){v.setDefaultOptions(i)}}}();
