/*For li/ul by ie hover supporting*/
function createJSHover() {
  jsHover = function() {
  var hEls = document.getElementsByTagName("LI");
  for (var i=0, len=hEls.length; i<len; i++) {
      hEls[i].onmouseover=function() { this.className+=" jshover"; }
      hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
    }
  }
  if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", jsHover);
}

function openGame(url) {
    var def_w = 800;
    var def_h = 600;
    var sw = screen.width;
    var sh = screen.height;
    var h = Math.max(def_h, sh * 0.9);
     var w = (h / def_h) * def_w;
     // Math.max(def_w, sw * 0.9);
//  var w = (h / def_h) * def_w;
//	var w=def_w;
//	var h=def_h;
    //def_w>sw?sw:def_w;
    //def_h>sh?sh:def_h;
    var x = (sw - w) / 2;
    var y = (sh - h) / 2;
    x = Math.max(0, x);
    //  y=Math.max(0, y - 20);
    y = 0;
    window.open(url, 'game', 'resizable=0, status=0, toolbar=0, location=0, scrollbars=no, width=' + w + ', height=' + h + ', left=' + x + ', top=' + y);
}


function showBlock(id) {
    elementById(id).style.display = "block";
}

function hide(id) {
    elementById(id).style.display = "none";
}

function floor(num) {
    return Math.floor(num*100)/100;
}
function round(num) {
    return Math.round(num*100)/100;
}

function elementById(id) {
    return document.getElementById(id);
}
