function popup(url, w ,h){
  	window.open(url+'.htm', url, 'width='+w+',height='+h+',titlebar=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');
}
function validate(formData){
var message = "------------------------------------------------------------------   \n*     Please check the following details and try again    *\n------------------------------------------------------------------   \n\n";
var message01 = "";	
	for (i=0;i<formData.length;i++) {
		temp = formData[i].name.split("-");
	if ((temp[1] != 1)||(temp[1] != 2)){
		if ((temp[2] == 'date')&&(formData[i].value != '')&&(!Date.parse(formData[i].value))){
				message01 = message01 + ' - '+ temp[0] +' is not a valid date.\n\n';
		}else if ((temp[2] == 'num')&&(formData[i].value != '')&&(!parseInt(formData[i].value))){
				message01 = message01 + ' - '+ temp[0] +' is not a valid number.\n\n';
		}else if ((formData[i].type == 'textarea')&&(formData[i].value == '')){
				message01 = message01 + ' - '+ temp[0] +'.\n\n';	
		}else if ((formData[i].type == 'text')&&(formData[i].value == '')){
				message01 = message01 + ' - '+ temp[0] +'.\n\n';	
		}else if ((formData[i].type == 'password')&&(formData[i].value == '')){
				message01 = message01 + ' - '+ temp[0] +'.\n\n';	
		}else if ((formData[i].type == 'select-one')&&(formData[i].value == 0)){
				message01 = message01 + ' - '+ temp[0] +'.\n\n';
		}else if ((formData[i].type == 'text')&&(temp[0] == 'Email Address')&&(formData[i].value != '')){
					var tempArray;
					var check = 0
					tempArray = formData[i].value.split("@");
						if (tempArray.length < 2){
						}else{
							check = check + 1;
							if (tempArray[0].length < 3){
							}else{
								check = check + 1;
								at = tempArray[1].split(".");
								if (at.length < 2){
								}else{
									check = check + 1;
									if(at[0] < 3){
									}else{ 
										check = check + 1;
									}
								}
							}
						}
				if (check != 4){
				message01 = message01 + " - Email Address is not a valid Email Address. \n\n";   
				} 
			}
		}
	}
	if (message01.length != 0){
		alert(message + message01);
		return false;
	}else{	
		return true;
	}
}

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
cntfield.value = maxlimit - field.value.length;
}