function wndWidth()
{
    if( typeof( window.innerWidth ) == 'number' ) //Non-IE
        return window.innerWidth;
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) //IE 6+ in 'standards compliant mode'
        return document.documentElement.clientWidth;
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) //IE 4 compatible
        return document.body.clientWidth;
}

function wndHeight()
{
    if( typeof( window.innerWidth ) == 'number' ) //Non-IE
        return window.innerHeight;
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) //IE 6+ in 'standards compliant mode'
        return document.documentElement.clientHeight;
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) //IE 4 compatible
        return document.body.clientHeight;
}

//change the opacity for different browsers
function changeOpac(opacity, obj)
{
    if (opacity < 0) opacity = 0;
    if (opacity > 100) opacity = 100;
    obj.style.opacity = (opacity / 100);
    obj.style.MozOpacity = (opacity / 100);
    obj.style.KhtmlOpacity = (opacity / 100);
    obj.style.filter = "alpha(opacity=" + opacity + ")";
}

function AddEventHandler (event, handler, obj)
{
    var tasktype=(window.addEventListener)? event : "on"+event;
    if (obj.addEventListener)
        obj.addEventListener(tasktype, handler, false);
    else if (obj.attachEvent)
        obj.attachEvent(tasktype, handler);
}

function SetEventHandler (event, handler, obj)
{
    switch (event)
    {
      case "click" :
        obj.onclick = handler;
        break;
      case "load" :
        obj.onload = handler;
        break;
      default :
        alert("SetEventHandler does not manage the "+event+" event.");
        break;
    }
}

