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;}}
function preloadImages(){var d=document;if(d.images){d.tmp = new Array();for(i=0; i<arguments.length; i++){d.tmp[i]=new Image;d.tmp[i].src="images/"+arguments[i];}}}
function imgOver(obj){img=obj.src;ext=img.substring(img.lastIndexOf(".")+1,img.length);imgOn=img.replace("."+ext,"_on."+ext);obj.src=imgOn;}
function imgOut(obj){img=obj.src;ext=img.substring(img.lastIndexOf(".")+1,img.length);imgOff=img.replace("_on."+ext,"."+ext);obj.src=imgOff;}

