function openPopupWindow(p_url, p_width, p_hight){

	window.name = 'opener';
	var previewWinParams = "width="+p_width+",height="+p_hight+",status=no,location=no,toolbar=no,resizable=no,scrollbars=yes,menubar=no";
	//alert(p_url);
	var newwinname = 'popupwin';
	var newwin = window.open(p_url,newwinname,previewWinParams);
	newwin.focus();
}

function updateCounterField(formName, textName, counterName) {
	L = eval("window.document."+formName+"."+textName+".value.length");
	eval("window.document."+formName+"."+counterName).value = L;
	return;
}

function checkLength(input, maxlen){

	inputstr = input.value;
	strlen = inputstr.length;
	if (strlen > maxlen){
		input.value = inputstr.substring(0, maxlen);
	}
	return true;
}


function trim(variable) {
    reg = new RegExp("","i");
    reg = /^\s*/;
    reg.exec(variable);
    variable=variable.replace(reg,"");//drop start spaces
    reg = /\s*$/;
    reg.exec(variable);
    variable = variable.replace(reg,"");//drop end spaces
    return variable;
}


function isEmpty(varForCheck) {
    if (trim(varForCheck) == "") {
        return true;
    } else {
        return false;
    }
}