function openImage(img, path){
	try{if(newWin.closed==false) newWin.close();}catch(e){}
	if (path == "" || path == undefined) path = "";
	w=200;
	h=120;
	var left = Math.floor((screen.width-w)/2);
	var top = Math.floor((screen.height-h)/2);
	var setting="location=no,menubar=no,resizable=no,scrollbars=yes,toolbar=no,width="+w+",height="+h+",top="+top+",left="+left;
	newWin=window.open(path + "openimg.php?img="+img, 'popUp', setting);
	newWin.focus();
}

function openPopup(file, w, h){
	try{if(newWin.closed==false) newWin.close();}catch(e){}
	var left = Math.floor((screen.width-w)/2);
	var top = Math.floor((screen.height-h)/2);
	var setting="location=no,menubar=no,resizable=no,scrollbars=yes,toolbar=no,width="+w+",height="+h+",top="+top+",left="+left;
	newWin=window.open(file, 'popUp', setting);
	newWin.focus();
}

function xId(id){return document.getElementById(id)}
function addEvent(elm, evType, fnc, useCapture){if(elm.addEventListener){elm.addEventListener(evType, fnc, useCapture);return true;}else if(elm.attachEvent){var r=elm.attachEvent('on'+evType, fnc);return r;}else{elm['on'+evType]=fnc;}}
