function sfConnect(type){this.popupWindow=null;this.popupWatch=null;this.getWindowInnerSize=function(){var width=0;var height=0;var elem=null;if('innerWidth'in window){width=window.innerWidth;height=window.innerHeight;}else{if(('BackCompat'===window.document.compatMode)&&('body'in window.document)){elem=window.document.body;}else if('documentElement'in window.document){elem=window.document.documentElement;}
if(elem!==null){width=elem.offsetWidth;height=elem.offsetHeight;}}
return[width,height];}
this.getParentCoords=function(){var width=0;var height=0;if('screenLeft'in window){width=window.screenLeft;height=window.screenTop;}else if('screenX'in window){width=window.screenX;height=window.screenY;}
return[width,height];}
this.popupClose=function(){if(!sfConnect.popupWindow||sfConnect.popupWindow.closed){sfConnect.popupWindow=null;window.clearInterval(sfConnect.popupWatch);window.parent.location.reload();}}
this.initPopup=function(){var parentSize=this.getWindowInnerSize();var parentPos=this.getParentCoords();if(type=='facebook2'){var wid=950;var hei=700;}
else{var wid=500;var hei=500;}
var xPos=parentPos[0]
+Math.max(0,Math.floor((parentSize[0]-wid)/2));var yPos=parentPos[1]
+Math.max(0,Math.floor((parentSize[1]-hei)/2));var url=$('a.'+type+'_connect').attr('href');sfConnect.popupWindow=window.open(url,"","width="+wid+",height="+hei+",status=1,location=1,resizable=yes,left="
+xPos+",top="+yPos);sfConnect.popupWatch=window.setInterval(this.popupClose,80);}}
