// Main menu format script

var env = getENV();

function getENV(){   // get OS ans Browser version.
  var ua = navigator.userAgent.toLowerCase();
  var env = new Object;
  env.ie = (!window.opera && $m('msie') != -1)? $c($m('msie ')+5): 0;
  env.fx = ($m('firefox/') != -1)? $c($m('firefox/')+8): 0;
  env.nn = ($m('netscape/') != -1)? $c($m('netscape/')+9): 0;
  env.op = ($m('opera/') != -1)? $c($m('opera/')+6): 0;
  env.sa = ($m('safari') != -1 && $m('version/') != -1)? $c($m('version/')+8): 0;
  env.win = ($m('windows') != -1)? 1: 0;
  env.mac = ($m('mac') != -1)? 1: 0;
  env.std = (document.compatMode == 'CSS1Compat')? 1: 0;
  return env;
  function $m(str){
    return Number(ua.indexOf(str));
  };
  function $c(num){
    return Number(ua.charAt(num));
  };
}

function popWin(URL,w,h){
  w += 40;
  h += 60;
  var x = Math.floor(screen.width/2 - w/2);
  var y = Math.floor(screen.height/2 - h/2) - 100;
  var pos = 'left=' + x + ',top=' + y + ',screenX=' + x + ',screenY=' + y + ',';
  var opt = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0," + pos + "width=" + w + ",height=" + h;
  var win = window.open(URL,'',opt);
  win.focus();
}


function imgWin(url,w,h,bg){
  var x = Math.floor(screen.width/2 - w/2);
  var y = Math.floor(screen.height/2 - h/2) - 200;
  if(!w) w = 100;
  if(!h) h = 100;
  if(!bg) bg = '#fff';
//  if(env.fx == 2) w += 62;
  var pos = 'left=' + x + ',top=' + y + ',screenX=' + x + ',screenY=' + y + ',';
  var opt = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0," + pos + "width=" + w + ",height=" + h;
  img = window.open(url,"img",opt);
  img.document.open();
  var html = '';
  html += '<html>\n<head>\n<title>IMAGE</title>\n</head>\n';
  html += '<body style="margin:0;padding:0;background:' + bg + ';">\n<div>\n';
  html += '<img id="image" src="' + url + '" galleryimg="no" title="CLOSE" onclick="window.close();" style="cursor:pointer;"><br>\n';
  html += '</div>\n</body>\n</html>\n';
  img.document.write(html);
  img.document.close();
  img.focus();
}

function dispChg(id,value){
  obj = (document.getElementById)? document.getElementById(id).style: document.all[id].style;
  if(obj.display == 'none'){ obj.display = value; }
  else{ obj.display = 'none'; }
}
