function validateSubmit() {
	if ( document.getElementById('eT1_qformst1')['email'].value=='' || document.getElementById('eT1_qformst1')['npa'].value=='' || document.getElementById('eT1_qformst1')['nxx'].value=='' || document.getElementById('eT1_qformst1')['line'].value=='') {
		
		alert('Please fill all fields.');
	
	} else if (!isContactPhone(document.getElementById('eT1_qformst1')['npa'].value+document.getElementById('eT1_qformst1')['nxx'].value+document.getElementById('eT1_qformst1')['line'].value)) {
		
		alert('Invalid contact phone.');
		
	} else if(!isEmail(document.getElementById('eT1_qformst1')['email'].value)) {
		
		alert('Invalid e-mail.');		
	
	} else {
		document.getElementById('eT1_qformst1').submit();
	}
	
	return false;
}
	
function isEmail(str) {
	var supported = 0;
	
	if (window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}

	if (!supported) 
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");

	return (!r1.test(str) && r2.test(str));
}
	
function isContactPhone(str) {
	  var r1 = new RegExp("^[0-9]{10,16}$");
	  return r1.test(str);
}

function hideLayer(whichLayer) {
	if (document.getElementById) {
		document.getElementById(whichLayer).style.visibility = "hidden";
	}
	
	else if (document.all) {
		document.all[whichlayer].style.visibility = "hidden";
	}
	
	else if (document.layers) {
		document.layers[whichLayer].visibility = "hidden";
	}
}

function showLayer(whichLayer) {

if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "visible";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "visible";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "visible";
}

}

function handleClick(whichClick) {
	hideLayer('submit_button_l0');
	showLayer('submit_button_l1');
}

function change_service_class(obj, item_no)
{
	if (obj.className == 'service')
		obj.className = 'service_active';
	else
		if (activeService != ('bs'+item_no))
			obj.className = 'service';
}

function active_service_class(obj, item_no)
{
	if (activeService != ('bs'+item_no))
	{
		obj.className = 'service_active';
		obj1 = document.getElementById('td'+activeService);
		obj1.className = 'service';
		activeService = ('bs'+item_no)
		obj2 = document.getElementById(activeService);
		obj2.checked = true;
	}
	
}
