function RequiredFieldValidator(controlId, initialValue) {
	res = ValidatorGetValue(controlId) != ValidatorTrim(initialValue);
	return res;
}
function RegularExpressionValidator(controlId, regExp) {
	var value = ValidatorGetValue(controlId);
	var rx = new RegExp(regExp);
	var matches = rx.exec(value);
	res = (matches != null && value == matches[0]);
	return res;
}
function ValidatorGetValue(controlId) {
	var control = document.getElementById(controlId);
	return ValidatorTrim(control.value);
}
function ValidatorTrim(s) {
	var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
	return (m == null) ? "" : m[1];
}
function $(id) {
	var el = document.getElementById(id);
	return el;
}

/* Banners callbacks */
function open_survey() { 
	var win_survey = window.open("../redirector.aspx?redirecturl=http://survey.primehome.com/index.php?sid=53918", 'win_survey', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=870,height=750');
	win_survey.focus();
}

/* form helper */
//helper function to create the form
function getSubmitForm() {
    var submitForm = document.createElement("FORM");
    document.body.appendChild(submitForm);
    submitForm.method = "POST";
    return submitForm;
}

function removeSubmitForm(frmEl) {
    document.body.removeChild(frmEl);
}

//helper function to add elements to the form
function createFieldElement(inputForm, elementName, elementValue) {
    var newEl = document.createElement("input");
        newEl.type = 'hidden';
        newEl.name = elementName;
        newEl.value = elementValue;
    inputForm.appendChild(newEl);
}

function popup_fullscreen(url) {
	params = 'width='+ screen.width +',height='+ screen.height +',top=0,left=0,fullscreen=yes';
	newwin = window.open(url,'windowname4', params);
	if (window.focus) { newwin.focus(); }
	return false;
}
