function popup( url, w, h, windowName, res, scr ) {
	win = window.open(url, windowName, 'height=' +h+ ', width=' +w+ ', resizable=' +res+ ', status=no, scrollbars=' +scr+ ', location=no, menubar=no, toolbar=no, left=50, top=50');
	win.focus();
}

function popContact(){
	popup('/addons/contact/index.php', 575, 450, 0, 0);
}

//form validation
function isEmail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}
function isFieldEmpty(string) {
	if ((string != "") && (string != null)) // just check that it's not empty
        return true;
    else
        return false;
}   
function isFieldProper(string) {
    if (string.search(/^\w+( \w+)?$/) != -1) // check for illegal characters
        return true;
    else
        return false;
}   

function validate(form){
	var listerrors = "";
	if (isFieldEmpty(form.email.value) == false) {
        listerrors += "- Email Address\n";
    }
	if (isFieldEmpty(form.user_subject.value) == false) {
		listerrors += "- Subject\n";
	}
	if (isFieldEmpty(form.user_message.value) == false) {
        listerrors += "- Message\n";
    }
	if (isFieldEmpty(form.security_check.value) == false) {
        listerrors += "- Please enter the security code\n";
    }
	
    if (listerrors != "")	{
		alert("Please complete the following:\n\n" + listerrors);
		return false;
	} else	{
		return true;
	}
}