document.tom = 0;
document.hbh = null;
document.pp = null;
document.cp = null;
document.hbh = null;
document.stim = null;

document.counter=0;

function prepmenu(i){
	clearTimeout(document.tom);
	xx = $('#'+i).position().left + 455;
	yy = 119;
	$('#extendmenu').css({left:xx,top:yy}).show();
	$("#servicespagemenu").hide();
	$('#'+i+"menu").show();
}

function prepoff(){
	clearTimeout(document.tom);
	document.tom = setTimeout("closemenu()",200);
}

function closemenu(){
	$('#extendmenu').hide();
	$('#'+document.cmo).hide();
}

function extendmenu(){
	clearTimeout(document.tom);
}


function submitForm(){
		errors = "";
		if( document.getElementById('fullname').value == "" ){errors+='-Name\n';}
		if( document.getElementById('phone').value == "" ){errors+='-Phone\n';}
		if( document.getElementById('email').value == "" ){errors+='-Email\n';}
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   var address = document.getElementById('email').value
	   if(reg.test(address) == false) {
		  errors+='-Invalid Email\n';
	   }

		if(errors!=""){alert('The following fields are required: \r\n' + errors); return false;}
		document.pform.action = '?submit=1'; document.pform.submit();
}

 

function addfield(i){
	document.counter = document.counter+1; nfield(document.counter);
}

function nfield(i){
	var newcode = '<p id="box'+i+'"><span class="labelText">Upload Documents:</span><input type="file" name="fdocument'+i+'" onchange="addfield(this.value)" onkeypress="return noenter()" onkeypress="return !(window.event.keyCode == 13 || event.which == 13)"/> <a href="javascript:remove('+i+')"><img src="images/delete.png" border="0"/></a></p>';
	$('#newfiles').append(newcode);
}

function remove(i){
	$('#box'+i).remove();
}

function viewpic(i){
	$("#dtext").hide();
	$("#pvw").show();
	$("#pvw").attr('src', "mini/"+i);
}
