var popNameWindow = null;  // This must be declared as a global
function MakePop(width,height) {
	closePop();
	var features = 'width=' + width + ',height=' + height;
 }

function openNewWindow(URLtoOpen, windowName, windowFeatures)
{
	function image_load() {
	    var container = document.getElementById('img_container');
	    container.innerHTML = '';
    	    container.appendChild(this);
	}
	
	var img = document.createElement('img');
	img.src = URLtoOpen;
	img.onload = image_load;

 }

function closePop() {
 
}

var newwindow = '';
function ImagePopUp(url, width, height) {
	if (!newwindow.closed && newwindow.location)	{
		newwindow.location.href = url; 
	}	else	{
		newwindow=window.open(url, 'imgwin', 'Width='+width+', Height='+height+', Scrollbars=no',0);
		if (!newwindow.opener) newwindow.opener = self;
	}
	
	if (window.focus) {newwindow.focus()}
}

function checkaddr(email)
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(email))
		return 1
	else
		return 0;
}

function Send()
{
	if( document.mailing["mailing[sender]"].value=="" ||
	    document.mailing["mailing[from]"].value=="" ||
	    document.mailing["mailing[subject]"].value=="" ||
	    !checkaddr(document.mailing["mailing[sender]"].value))
			window.alert(mailing_error);
	else {
		document.mailing.submit();
		window.alert(mailing_ok);
	};
}
