﻿function menuIn(width, height) {
    var dm = document.getElementById("div_menu");
    dm.style.width=width+"px";
    dm.style.height=height+"px";
}

function openWindow(url) {
     x = window.open(url,'_blank','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=auto,resizable=yes,copyhistory=no');
	 x.focus();
}

function openPopup(_url,_winName,_width,_height,_scroll,_return) {
	var _y = (screen.height - _height) / 2;
	var _x = (screen.width - _width) / 2;
    var x = window.open(_url,_winName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+_scroll+',resizable=no,copyhistory=no,top='+_y+',left='+_x+',screenY='+_y+',screenX='+_x+',width='+_width+',height='+_height);
	x.focus();
	if (_return)
	    return x;
}

function clickButton(e, buttonid) {
	var bt = document.getElementById(buttonid); 

	if(bt.tagName == "A") {
		if (e.keyCode == 13) {
			location.href = bt.href;
			return false;
		}
	}
	else {
		if (typeof bt == 'object') {
			if (e.keyCode == 13) {
				bt.click(); 
				return false; 
			}
		}
	}

}

function handleEnter (field, event) {
       var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        if (keyCode == 13) 
                return false;
    }  

var prev;
function MyTDColor(tableRow, highLight) {
	if (highLight) {
		prev = tableRow.style.backgroundColor;
		tableRow.style.backgroundColor = '#00AEEF';
		tableRow.style.cursor = 'pointer';
	}
	else {
		tableRow.style.backgroundColor = prev;
		tableRow.style.cursor = 'auto';
	}
}

function TDNav(TDUrl) {
	document.location.href = TDUrl;
}

function debug(obj) {
	var msg = "";
	var i = 0;
	for(p in obj) {
		msg += p + " = " + obj[p] + "\n";
		if(++i == 20) {
			alert(msg);
			msg = "";
			i = 0;
		}
	}
	if(msg != "") {
		alert(msg);
	}
}
