var counterText1 = 1;

var counter1	= 0;

function AddElements1(divName,tot){

	

	var newdiv = document.createElement('table');

	if(counter1 == 0 && counterText1 == 1) {

	 counter1 = counter1+tot;

	 counterText1 = counterText1+tot; 

	}

	counter1++;

	counterText1++;	 

	newdiv.setAttribute("id", "ch_"+counterText1);



	newdiv.innerHTML = '   <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="25" colspan="3">Floor Area '+counterText1+':</td><td height="25" colspan="3">Screed Depth:</td></tr><tr><td width="22%"><input name="floorarea[]" type="text" class="text_fld_new_02" id="floorarea" /></td><td width="3%"> (Sq./m)</td><td width="7%">&nbsp;</td><td width="22%"><input name="screeddepth[]" type="text" class="text_fld_new_02" id="screeddepth" /></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/+.gif" width="13" height="13" onclick="AddElements1(\'image_file1\',0)"/></a></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/-.gif" width="13" height="13" onclick="removeElements(\'image_file1\', \''+counterText1+'\')"/></a></td></td><td width="43%">&nbsp;</td></tr></table>';



	

	document.getElementById(divName).appendChild(newdiv);

}



var counterText2 = 1;

var counter2	= 0;

function AddElements2(divName,tot){

	

	var newdiv = document.createElement('table');

	if(counter2 == 0 && counterText2 == 1) {

	 counter2 = counter2+tot;

	 counterText2 = counterText2+tot; 

	}

	counter2++;

	counterText2++;	 

	newdiv.setAttribute("id", "ch_"+counterText2);



	newdiv.innerHTML = '   <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="25" colspan="3">Insulation Area '+counterText2+':</td><td height="25" colspan="3">Depth:</td></tr><tr><td width="22%"><input name="insulationarea[]" type="text" class="text_fld_new_02" id="floorarea" /></td><td width="3%"> (Sq./m)</td><td width="7%">&nbsp;</td><td width="22%"><input name="insulationdepth[]" type="text" class="text_fld_new_02" id="screeddepth" /></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/+.gif" width="13" height="13" onclick="AddElements2(\'image_file2\',0)"/></a></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/-.gif" width="13" height="13" onclick="removeElements(\'image_file2\', \''+counterText2+'\')"/></a></td></td><td width="43%">&nbsp;</td></tr></table>';



	

	document.getElementById(divName).appendChild(newdiv);

}



var counterText3 = 1;

var counter3	= 0;

function AddElements3(divName,tot){

	

	var newdiv = document.createElement('table');

	if(counter3 == 0 && counterText3 == 1) {

	 counter3 = counter3+tot;

	 counterText3 = counterText3+tot; 

	}

	counter3++;

	counterText3++;	 

	newdiv.setAttribute("id", "ch_"+counterText3);



	newdiv.innerHTML = '   <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="25" colspan="3">Acoustic Area '+counterText3+':</td><td height="25" colspan="3">Depth:</td></tr><tr><td width="22%"><input name="acousticarea[]" type="text" class="text_fld_new_02" id="floorarea" /></td><td width="3%"> (Sq./m)</td><td width="7%">&nbsp;</td><td width="22%"><input name="acousticdepth[]" type="text" class="text_fld_new_02" id="screeddepth" /></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/+.gif" width="13" height="13" onclick="AddElements3(\'image_file3\',0)"/></a></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/-.gif" width="13" height="13" onclick="removeElements(\'image_file3\', \''+counterText3+'\')"/></a></td></td><td width="43%">&nbsp;</td></tr></table>';



	

	document.getElementById(divName).appendChild(newdiv);

}



var counterText4 = 1;

var counter4	= 0;

function AddElements4(divName,tot){

	

	var newdiv = document.createElement('table');

	if(counter4 == 0 && counterText4 == 1) {

	 counter4 = counter4+tot;

	 counterText4 = counterText4+tot; 

	}

	counter4++;

	counterText4++;	 

	newdiv.setAttribute("id", "ch_"+counterText4);



	newdiv.innerHTML = '   <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="25" colspan="3">Membrane Area '+counterText4+':</td><td height="25" colspan="3">Gauge:</td></tr><tr><td width="22%"><input name="membranearea[]" type="text" class="text_fld_new_02" id="floorarea" /></td><td width="3%"> (Sq./m)</td><td width="7%">&nbsp;</td><td width="22%"><input name="gauge[]" type="text" class="text_fld_new_02" id="screeddepth" /></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/+.gif" width="13" height="13" onclick="AddElements4(\'image_file4\',0)"/></a></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/-.gif" width="13" height="13" onclick="removeElements(\'image_file4\', \''+counterText4+'\')"/></a></td></td><td width="43%">&nbsp;</td></tr></table>';



	

	document.getElementById(divName).appendChild(newdiv);

}



var counterText5 = 1;

var counter5	= 0;

function AddElements5(divName,tot){

	

	var newdiv = document.createElement('table');

	if(counter5 == 0 && counterText5 == 1) {

	 counter5 = counter5+tot;

	 counterText5 = counterText5+tot; 

	}

	counter5++;

	counterText5++;	 

	newdiv.setAttribute("id", "ch_"+counterText5);



	newdiv.innerHTML = '   <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="25" colspan="3">Underfloor Heating Floor Area Area '+counterText5+':</td></tr><tr><td width="5%"><input name="h_membranearea1[]" type="text" class="text_fld_new_02" id="floorarea" /></td><td width="3%"> (Sq./m)</td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/+.gif" width="13" height="13" onclick="AddElements5(\'image_file5\',0)"/></a></td><td width="3%"><a href="javascript:;"><img src="/clientdemo/demosite/wp-content/themes/theme1162/images/-.gif" width="13" height="13" onclick="removeElements(\'image_file5\', \''+counterText5+'\')"/></a></td></td><td width="43%">&nbsp;</td></tr></table>';



	

	document.getElementById(divName).appendChild(newdiv);

}



function removeElements(parentDiv, childID){

	

	 var childDiv = "ch_"+childID;

	 		

     if (childDiv == parentDiv) {

          alert("The parent div cannot be removed.");

     }

     else if (document.getElementById(childDiv)) {     

          var child   = document.getElementById(childDiv);

          var parent  = document.getElementById(parentDiv);

          parent.removeChild(child);

     }

     else {

          alert("Child div has already been removed or does not exist.");

          return false;

     }

}



function QuotationFrmValidation(){

	

    var reg =/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

	var msg = '';

	

	if(document.getElementById('uname').value==""){

		msg ="Please enter your name\n";

	}

	

	if(document.getElementById('telephone').value==""){

		msg +="Please enter your telephone\n";

	}

	

	if(document.getElementById('email').value==""){

		msg +="Please enter your email address\n";

	}else if(document.getElementById('email').value.search(reg) < 0){

		msg +="Please enter valid email address\n";

	}

	

	if(document.getElementById('company').value==""){

		msg +="Please enter your company name\n";

	}

	

	if(msg != ''){

		alert(msg);

		return false;

	}else{

		document.frmquotation.submit();

	}

}
