var w1 = (screen.availWidth === undefined ? screen.availWidth - 10 : (screen.availWidth - 10));
var h1 = (screen.availHeight === undefined ? screen.availHeight - 118 : screen.availHeight - 118);
//...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,'OLB',skWinOptions);
  olb_window.focus();
}                                 

function closepopupOLB() {
   /*if(false == olb_window.closed) {
     olb_window.closeOLB();
   }*/
    var openservices = getServiceData();
    //alert("closepopupOLB() openservices.length=" + openservices.length);
    for (i = 0; i <= openservices.length; i++) {
	    if ( (openservices[i] != String.noSuchProperty) && (openservices[i] != null)) {
        try {
          if ("BROKE" == openservices[i]) {
            w = window.open('https://wtfedssod.wilmingtontrust.com/idp/startSLO.ping', 'BROKE', 'height=1,width=1');
          } else {
    	      w = window.open("",openservices[i],"height=1,width=1");
          }
   	      w.close();
        } catch (e) {
        }
        openservices[i] = null;
	    }
    }
    sendData(openservices);

}

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 popup(url, windowName) {
	window.open(url,windowName,'scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
}

function popupFS(url, windowName) {
  if (windowName == 'COLBFT' || windowName == 'COLB') {
	  window.open(url,windowName,'scrollbars=yes,menubar=yes,height=600,width=800,resizable=yes,toolbar=no,location=no,status=yes');
	} else if (windowName == 'TRUST' || windowName == 'STMTVIEW') {
    var sOptions;
    sOptions = 'scrollbars=yes,menubar=no,resizable=yes,toolbar=no,location=no,status=yes';
    sOptions = sOptions + ',width=' + screen.availWidth.toString();
    sOptions = sOptions + ',height=' + screen.availHeight.toString();
    sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
    window.open( url, windowName, sOptions );
	} else {
	  window.open(url,windowName,'scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=yes');
	}
  addOpenService(windowName);
}

function popupHelp(key) {
	url = "/repositories/wtc_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';
	   }
   }
}


