function isIE() {
	return (navigator.appName.toUpperCase().match(/MICROSOFT INTERNET EXPLORER/) != null);
}

function doRedir(loc)
{
    location.href=loc;
    return false;
}

function doAsk(loc, question)
{
    if(question == undefined) {
        question = 'Are you sure?';
    }
    if(confirm(question)) {
        doRedir(loc);
    }
}

function createAjax()
{
    var ajax = null;
    try {
        // Firefox, Opera 8.0+, Safari
        ajax=new XMLHttpRequest();
    } catch (e) {
        // Internet Explorer
        try {
            ajax=new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                ajax=new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    
    return ajax;
}

function requestAjax(ajaxArg)
{
    ajax = createAjax();
    if(ajax == null) return;
    ajax.onreadystatechange = function() {
        if(ajax.readyState == 4) {
            var txt = ajax.responseText;
            ajaxArg.Receive(txt);
        }
    }
    ajax.open('GET', ajaxArg.geturl,true);
    ajax.send(null);
}

function getobj(objid)
{
    return document.getElementById(objid);
}

function findPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent) {
        while(1) {
            curleft += obj.offsetLeft;
            if(!obj.offsetParent) break;
            obj = obj.offsetParent;
        }
    } else if(obj.x) {
        curleft += obj.x;
    }
    return curleft;
}

function findPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent) {
        while(1) {
            curtop += obj.offsetTop;
            if(!obj.offsetParent) break;
            obj = obj.offsetParent;
        }
    } else if(obj.y) {
        curtop += obj.y;
    }
    return curtop;
}


function getScreenWidth()
{
    var myWidth = 800;
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
    } else if( document.body && document.body.clientWidth ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
    }
    return myWidth;
}

function getScreenHeight() {
    var myHeight = 0;
    if( typeof( window.innerHeight ) == 'number' ) {
        //Non-IE
        myHeight = window.innerHeight;
    } else if( document.documentElement && document.documentElement.clientHeight ) {
        //IE 6+ in 'standards compliant mode'
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && document.body.clientHeight ) {
        //IE 4 compatible
        myHeight = document.body.clientHeight;
    }
    return myHeight;
}

function focusDefObj(txt, defval)
{
	if(txt.value == defval) {
		txt.value = '';
		txt.className = '';
	}
}

function blurDefObj(txt, defval)
{
	if(txt.value == '') {
		txt.value = defval;
		txt.className = 'sidef';
	}
}

function showLanguages(aobj)
{
	clearTimeout(hlto);
	
	if(aobj != null) {
		aobj.className = 'alover';
		return;
	}
	
	var obj = getobj('mm_lang');
	var x = findPosX(obj);
	var y = findPosY(obj);
	var off_x = -100;
	var off_y = 48;
	var dd = getobj('chlang');
	dd.style.left = (x+off_x)+'px';
	dd.style.top = (y+off_y)+'px';
	dd.style.display='block';
}

var hlto;

function hideLanguages(aobj)
{
	clearTimeout(hlto);
	if(aobj != null) {
		aobj.className = '';
	}
	hlto = setTimeout('hideDivLanguage()', 1000);
}

function hideDivLanguage()
{
	getobj('chlang').style.display='none';
}


function hideDiv(classToHide)
{
	if(classToHide == "" || classToHide == undefined) return true;
	var divs = document.getElementsByTagName('DIV');
	for(var i=0;i<divs.length;i++) {
		if(divs[i].className == classToHide) divs[i].style.display = 'none';
	}
}

function showDiv(idToShow, classToHide)
{
	try {
		if(classToHide != '') hideDiv(classToHide);
		document.getElementById(idToShow).style.display = 'block';
	} catch(e) { }
}