//var w1 = (screen.availWidth === undefined ? screen.availWidth - 10 : (screen.availWidth - 10));
//var h1 = (screen.availHeight === undefined ? screen.availHeight - 118 : screen.availHeight - 118);
var w1 = 800;
var h1 = 600;
//...OLB popup window style (same as wt.com)
var skWinOptions="'directories=0,toolbar=0,status=1,";
skWinOptions += "resizable=1,menubar=1,scrollbars=1,location=0,left=0,top=15,";
skWinOptions += "width=" + w1 + ",height=" + h1 + "'";

function flipLayer(id){
       var obj = document.getElementById(id);
	   //alert(obj.className);
       if(obj.className == 'hiddenLayer') {
		  //alert("Changing to visible");
	      obj.className ='visibleLayer';
       }
       else {
		  //alert("Changing to hidden");
	      obj.className = 'hiddenLayer';		  
       }
}

var olb_window = '';

function popupOLB(url) {
  olb_window = window.open(url,'OLBDB',skWinOptions);
  olb_window.focus();
}                                 

function closepopupOLB() {
	 /*
   if(false == olb_window.closed) {
     olb_window.closeOLB();
   } 
   */
   
   try {
		var w = window.open('', 'OLBDB', 'height=1,width=1');
		w.close();
	}
	catch (e) {
		alert(e.message);
	}
}

function popupContent(url) {
  var w = window.open(url,'content','scrollbars=yes,menubar=no,height=400,width=500,resizable=yes,toolbar=no,location=no,status=no');
  w.focus();
}

function popup(url) {
  window.open(url,'','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
}

function popupHelp(key) {
	url = "/repositories/wtd_popup/help/contextHelp.html#" + key;
	popupContent(url);
}

function jump(s){       
   var d = s.options[s.selectedIndex].value;
   window.top.location.href = d;
   s.selectedIndex=0;
}

function refreshform(){
    document.refresh.submit();
}

function opnenLayer(id) {
   var obj = document.getElementById(id);	   
   for(i=0; i < 7; i++){
	  var ob = document.getElementById(i);
      if(i == id) {
	     obj.className ='visibleLayer';
       } else {
         ob.className = 'hiddenLayer';
	   }
   }
}

function showLightbox(which, s, rep) {
  if ("popups" == rep) {
    which.href="/wtdirect/common/layouts/wtdredesign/lightbox.jsp?lightboxfile=" + encodeURI(s + "&rep=" + rep) + "&smp;height=450&amp;width=796";
  } else {
    which.href="/wtdirect/common/layouts/wtdredesign/lightbox.jsp?lightboxfile=" + s + "&smp;height=450&amp;width=796";
  }
}

function showErrorMessage(which, s) {
  which.href="/wtdirect/common/layouts/wtdredesign/lightbox.jsp?lightboxmsg=" + encodeURI(s) + "&smp;height=320&amp;width=796";
}
