popOut.prototype.popOutSB = function (){
   // only create and load IF needed
    if (this.podiv == undefined){
      this.podiv = document.createElement("iframe");
      this.podiv.id='podiv';
      this.podiv.scrolling='no';
      this.podiv.frameBorder=0;
      this.podiv.className="sbclosed";
      this.podiv.src=this.src;
      document.body.appendChild(this.podiv);
    }

    if (this.podiv.className == "sbclosed"){
      this.podiv.style.display="block";
      this.intab.style.display="block";
      this.tab.style.display="none";
      this.podiv.className = "sbopen";
    }
}
popOut.prototype.popInSB = function (){
    if (this.podiv.className == "sbopen"){        
      this.podiv.className = "sbclosed";
      this.podiv.style.display="none";
      this.intab.style.display="none";
      this.tab.style.display="block";
    }
      
}

popOut.prototype.setStyle=function( object, styleText ) { 
    if (object == undefined)
      return;
    if( object.style.setAttribute ) { 
      object.style.setAttribute("cssText", styleText ); 
    } else { 
      object.setAttribute("style", styleText ); 
    } 
}

var gIDRs=0;

function initAtDRs(func){
    fn = function(){if (!gIDRs){gIDRs=1;func()}};
    if (document.addEventListener)
      document.addEventListener("DOMContentLoaded",fn, false);
    else if ((top.location != self.location) && document.all && !window.opera){
      document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>');
      document.getElementById("contentloadtag").onreadystatechange=function(){if (this.readyState=="complete"){fn();}}
    }else if (window.addEventListener){
       window.addEventListener("load", fn, false);
    } else if (window.attachEvent){
       window.attachEvent("onload", fn);
    } 
}

popOut.prototype.setupPopout = function(){
  this.tab = document.getElementById("poptab");
  this.intab = document.getElementById("popintab");
  this.src = "http://creative-cruising.com/social-popout.html";
  if (this.tab != undefined){
     this.tab.onmouseover=this.bind(this.popOutSB);
  }
  if (this.intab != undefined){
     this.intab.onmouseover=this.bind(this.popInSB);
  }
}

function popOut(opts){
  //this.isIE = 0;
  //this.isFramed = (top.location != self.location) ? true : false;
  //this.isNavUA = navigator.userAgent.toLowerCase();
  //if ((this.isNavUA.indexOf('Opera') < 0) && (this.isNavUA.indexOf('MSIE') != -1)) this.isIE = 1;
  initAtDRs(this.bind(this.setupPopout));
}

popOut.prototype.bind = function(method) {
    var self = this;
    var opt_args = [].slice.call(arguments, 1);
    return function() {
      var args = opt_args.concat([].slice.call(arguments));
      return method.apply(self, args);
    }
}
new popOut();


