function dialog(url,windowname,width,height)
{
width=(width)?width:screen.width/2;
height=(height)?height:screen.height/2;
var screenX = (screen.width/2 - width/2);
var screenY = (screen.height/2 - height/2);
var features= "width=" + width + ",height=" + height +"toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,location=no,directories=no,copyhistory=no=no";
features += ",screenX=" + screenX + ",left=" + screenX;
features += ",screenY=" + screenY + ",top=" + screenY;
 
var mywin=window.open(url, windowname, features);
if (mywin)
mywin.focus();
return false;
}

function generate_address( username, domain) {
        var atsign = "&#64;";
        var addr = username + atsign + domain;
        document.write(
          "<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" +
          addr +
          "<\/a>");
}

function gallery_image(url,windowname)
{
width= screen.width;
height= screen.height;
var screenX = 1;
var screenY = 1;
var features= "width=" + width + ",height=" + height +"toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,location=no,directories=no,copyhistory=no,fullscreen=yes";
features += ",screenX=" + screenX + ",left=" + screenX;
features += ",screenY=" + screenY + ",top=" + screenY;
 
var mywin=window.open(url, windowname, features);
if (mywin)
mywin.focus();
return false;
}

function gallery_slideshow(urlparam,windowname)
{
width= screen.width;
height= screen.height;
var screenX = 1;
var screenY = 1;

if (width > 1000 && height > 750) {
	url = "/Gallery/slideshow.html?" + urlparam;
} else {
	url = "/slideshow.html?small=1&" + urlparam
}
var features= "width=" + width + ",height=" + height +"toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,location=no,directories=no,copyhistory=no,fullscreen=yes";
features += ",screenX=" + screenX + ",left=" + screenX;
features += ",screenY=" + screenY + ",top=" + screenY;
 
var mywin=window.open(url, windowname, features);
if (mywin)
mywin.focus();
return false;
}



function hide_div(name) {
	var id = document.getElementById(name);
	if (!id) return false;
	id.style.visibility = "hidden";
	return false;
}



function display_div(name) {
	var id = document.getElementById(name);
	if (!id) return false;
	id.style.visibility = "visible";
	return false;

}



function readCookie(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;
}
