function validateForm(form,fields){
	
	var form;
	var err = "";
	var fields = fields.split(",");
	
	for(i=0;i<fields.length;i++){
		fieldName = fields[i];
		value = form.elements[fieldName].value;
		name  = form.elements[fieldName].id;
		if(value.length<1){err += "" + name + " is required. \n";}
	}
	if(err.length>0){alert(err);return false;}else{return true;}
}

function windowPop(fileSource) {
 	popWin=window.open(fileSource, "popUp","width=512,height=384,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
	popWin.focus();
}

function windowPopSize(fileSource, width, height) {
    cw = Math.floor(((screen.availWidth-width)/2)-100);
    ch = Math.floor(((screen.availHeight-height)/2)-200);
 	popWin=window.open(fileSource, "popUp","width="+width+",height="+height+",toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1,top="+ch+",left="+cw+"");
	popWin.focus();
}

function focusField(fieldName){
	document.forms['f'].elements[fieldName].focus();
}

function toggle(elemName){
	
	var elem = document.getElementById(elemName);
	if(elem.style.display=='none'){ 
		elem.style.display = 'block';
	}else{ 
		elem.style.display = 'none';
	}
}
