function popup_window(winFile, winHost, winWidth, winHeight, winTitle) 
{
	var LeftPosition = (screen.width) ? (screen.width-winWidth)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-winHeight)/2 : 0;
	var w = window.open('', '','width='+winWidth+',height='+winHeight+',resizable=no,top='+TopPosition+',left='+LeftPosition+'');
	var d = w.document;
	d.open();
	d.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" "+"\"http://www.w3.org/TR/html4/strict.dtd\">");
	d.writeln("<html><head><title>" +winTitle+ "<\/title>");
	d.writeln("<meta http-equiv=\"Content-Script-Type\" ","content=\"text/javascript\"><\/head>");
	d.writeln("<body style='margin:0px;padding:0px;'>")
	d.writeln("<div><img src='"+winHost+"/phpThumb/phpThumb.php?src="+winFile+"&w="+winWidth+"&f=jpg&far=B&q=100' onclick='window.close();' /><\/div>");
	d.writeln("<\/body><\/html>");
	d.close();
}

function getCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
//----------------------------------------------------------

function setCookie (name, value, days) {
	var expireDate = new Date();
	var expstring = expireDate.setDate(expireDate.getDate()+parseInt(days));
	document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
}
//----------------------------------------------------------

function deleteCookie(name) {
	setCookie(name,"",-1);
}
