// Define browser version.
var ns4 = (document.layers)? true:false;
var ns6 = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;
var ie5 = false; 

if (ie4) { 
	if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) { ie5 = true; }
	if (ns6) { ns6 = false; }
}

// open popup window

function openWin(url,x,y,width,height,id,i_status,i_scroll,i_resizable) {
 var win_status="yes";
 var win_scroll="yes";
 var win_resizable="yes";

 if (i_status) {
  win_status=i_status;
 }
 if (i_scroll) {
  win_scroll=i_scroll;
 }
 if (i_resizable) {
  win_resizable=i_resizable;
 }

 winparams='toolbar=no,location=no,directories=no,menubar=no,status='+win_status+',';
 winparams+='scrollbars='+win_scroll+',resizable='+win_resizable+',';

 if (navigator.appName.indexOf("Microsoft")>=0) {
  winparams+=',left=' + x + ',top=' + y + ',width=' + width + ',height=' + height;
 }
 else {
  winparams+=',screenX=' + x + ',screenY=' + y + ',width=' + width + ',height=' + height;
 }
 if (id == '0') {
  popup=window.open(url,"window",winparams);
 }
 else {
  popup=window.open(url,id,winparams);
 }
 popup.focus();
}

// center popup window

function openWinCenter(url,width1,height1,id,win_stat,win_scroll,win_resizable) {
 if (screen.width <= 800) {
  if((width1 + 10) > screen.availWidth) {
   width1 = screen.availWidth - 10;
  } 
  if((height1 + 29) > screen.availHeight) {
   height1 = screen.availHeight - 29;
  }
  screen_width = (screen.availWidth - width1 - 10) / 2;
  screen_height = (screen.availHeight - height1 - 29) / 2;
 }
 if (screen.width > 800) {
  screen_width = (screen.availWidth - width1 - 10) / 2;
  screen_height = (screen.availHeight - height1 - 29) / 2;
 }
 width=width1;
 height=height1;
 y=screen_height;
 x=screen_width;
 openWin(url,x,y,width,height,id,win_stat,win_scroll,win_resizable)
}
