/* 6. popup function
--------------------------------------------------------------------------  */
function is_opener() {
  var ua = navigator.userAgent
  if(!!window.opener)
    if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1) 
      return !window.opener.closed
    else return typeof window.opener.document  == 'object'
  else return false
}


function setFooter(){
  if(is_opener()){document.write('<ul><li class="btn-close"><a href="#" onclick="window.close();return false;">Close</a></li></ul>');}
  else{document.write('<ul><li class="btn-back"><a href="#" onclick="history.back(-1);return false;">Return to Page</a></li></ul>');}
}


/* 4. Popup window
-------------------------------------------------------------------------- */
function openWin(url,wname,w,h,scroll){
    if(win && ie){w += (scroll)? 16:0;h -= 19;}
    var str = 'width=' + w+ ',height=' + h 
           + ',location=0,toolbar=1,menubar=1,scrollbars=' + scroll + ',resizable=1';
    swin = window.open(url,wname,'width=' + w + ',height=' + h + str);
    swin.focus();
}
function setLogolnk(){
    this.w3c = document.getElementById; if (!this.w3c) return false;
    return this;
}
setLogolnk.prototype = {
    init: function(){
       SL.logolnk = document.getElementById("popuptop");if(!SL.logolnk) return false;
       SL.logolnk.onclick = function(){
            if(is_opener()){
                  window.opener.focus();
                  window.opener.location.href = "/";
                  return false;
            }else{
                  location.href = "/";
            }
       }
    }
}
var SL = new setLogolnk();
window.addOnload(SL.init);
