function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=475,left = 440,top = 287.5');");
}

function resizeWindow(){this.resizeTo(850, 755); }

function popup4() {
    window.open('gallery.html', '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=350,height=350,left=300,top=300');
    }

function validateField(labelId, BoxId, fieldType, required) {
	label = document.getElementById(labelId);
	inputBox = document.getElementById(BoxId);
	if (fieldType == 'text' || fieldType == 'textarea' || fieldType == 'password' || fieldType == 'file' || fieldType == 'phone' || fieldType == 'website') {
		if (required == 1 && inputBox.value == '') {
			origHTML = label.innerHTML ;
			if(origHTML.indexOf('*',0) ==-1) //only put an * if not already there
				label.innerHTML = "* " + origHTML;
			return false;
		}
		else {
			origValue = inputBox.value;
			origHTML = label.innerHTML;
			label.innerHTML = origHTML.replace(/\* /,'');
			inputBox = document.getElementById(BoxId);
			inputBox.value = origValue;
			return true;
		}
	}
	else if (fieldType == 'email') {
		if ((required == 1 && inputBox.value == '') || (inputBox.value != '' && !validate_email(inputBox.value))) {
			origHTML = label.innerHTML ;
			if(origHTML.indexOf('*',0) ==-1) //only put an * if not already there
				label.innerHTML = "* " + origHTML;
			//inputBox.focus()
			return false;
		}
		else {
			origValue = inputBox.value;
			origHTML = label.innerHTML;
			label.innerHTML = origHTML.replace(/\* /,'');
			inputBox = document.getElementById(BoxId);
			inputBox.value = origValue;
			return true;
		}
	}
}
function validate_email(emailStr) {
	apos = emailStr.indexOf("@");
	dotpos = emailStr.lastIndexOf(".");
	if (apos < 1 || dotpos - apos < 2) {
		return false;
	}
	else {
		return true;
	}
}
