function openPopUp(PageName){
	new_window = window.open(PageName,"new_window","width=400,height=400,location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,left=150,top=50,screenx=150,screeny=50"); 
	if (new_window.opener == null) { 
		new_window.opener = self; 
	} 
	new_window.focus();
}
function openSizedPopUp(PageName, Width, Height){
	new_window = window.open(PageName,"new_window","width="+Width+",height="+Height+",location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,left=150,top=50,screenx=150,screeny=50"); 
	if (new_window.opener == null) { 
		new_window.opener = self; 
	} 
	new_window.focus();
}
function openColorSelector(PageName, Width, Height){
	new_window = window.open(PageName,"new_window","width="+Width+",height="+Height+",location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,left=150,top=50,screenx=150,screeny=50"); 
	if (new_window.opener == null) { 
		new_window.opener = self; 
	} 
	new_window.focus();
}

function formatDate(date,format) {
	format=format+"";
	var result="";
	var i_format=0;
	var c="";
	var token="";
	var y=date.getYear()+"";
	var M=date.getMonth()+1;
	var d=date.getDate();
	var E=date.getDay();
	var H=date.getHours();
	var m=date.getMinutes();
	var s=date.getSeconds();
	var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
	// Convert real date parts into formatted versions
	var value=new Object();
	if (y.length < 4) {y=""+(y-0+1900);}
	value["y"]=""+y;
	value["yyyy"]=y;
	value["yy"]=y.substring(2,4);
	value["M"]=M;
	value["MM"]=LZ(M);
	value["MMM"]=MONTH_NAMES[M-1];
	value["NNN"]=MONTH_NAMES[M+11];
	value["d"]=d;
	value["dd"]=LZ(d);
	value["E"]=DAY_NAMES[E+7];
	value["EE"]=DAY_NAMES[E];
	value["H"]=H;
	value["HH"]=LZ(H);
	if (H==0){value["h"]=12;}
	else if (H>12){value["h"]=H-12;}
	else {value["h"]=H;}
	value["hh"]=LZ(value["h"]);
	if (H>11){value["K"]=H-12;} else {value["K"]=H;}
	value["k"]=H+1;
	value["KK"]=LZ(value["K"]);
	value["kk"]=LZ(value["k"]);
	if (H > 11) { value["a"]="PM"; }
	else { value["a"]="AM"; }
	value["m"]=m;
	value["mm"]=LZ(m);
	value["s"]=s;
	value["ss"]=LZ(s);
	while (i_format < format.length) {
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
			}
		if (value[token] != null) { result=result + value[token]; }
		else { result=result + token; }
		}
	return result;
	}
