// JavaScript Document
var errmsg
function frmvalid()
{
errmsg = ""

	// First Name
	tfname = document.getElementById('txtfname').value
	if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tfname))
	{
		errmsg = "First Name"
	}

	// Last Name
	tlname = document.getElementById('txtlname').value
	if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tlname))
	{
		errmsg += " Last Name"
	}

/*	// Last Name
	tcmpname = document.getElementById('txtcmpname').value
	if (tcmpname != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tcmpname))
		{
			errmsg += " Company Name"
		}
	}

	// Title
	ttitle = document.getElementById('txttitle').value
	if (ttitle != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(ttitle))
		{
			errmsg += " Title"
		}
	}

*/	// Email ID
	temail = document.getElementById('txtemail').value
	if (!(/^[a-z]+[ _\.0-9a-z_]+[0-9a-z]+@([0-9a-z][0-9a-z._]+\.)+[a-z]{2,4}$/).test(temail))
	{
		errmsg += " Email"
	}

/*	// Phone
	tphone = document.getElementById('txtphone').value
	if (tphone != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tphone))
		{
			errmsg += " Phone"
		}
	}
	
	// FAX
	tfax = document.getElementById('txtfax').value
	if (tfax != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tfax))
		{
			errmsg += " FAX"
		}
	}


	// Cell
	tcell = document.getElementById('txtcell').value
	if (tcell != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tcell))
		{
			errmsg += " Cell Phone"
		}
	}
	
	
	// Address
	tadd1 = document.getElementById('txtadd1').value
	if (tadd1 != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tadd1))
		{
			errmsg += " Address1"
		}
	}

	// Address
	tadd2 = document.getElementById('txtadd2').value
	if (tadd2 != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tadd2))
		{
			errmsg += " Address2"
		}
	}

*/
	// State
	tstate = document.getElementById('selstate').value
	tnonstate = document.getElementById('txtstate').value
	if (tstate == "Non-US" && tnonstate == "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tstate))
		{
			errmsg += " State"
		}
	}

	// Country
	tctry = document.getElementById('txtctry').value
	if (tctry != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tctry))
		{
			errmsg += " Country"
		}
	}


/*	// Zipcode
	tzip = document.getElementById('txtzip').value
	if (tzip != "") 
	{
		if (!(/^[(0-9 )]+[(0-9 )]$/).test(tzip))
		{
			errmsg += " Zipcode"
		}
	}

*/
	// Error
	if (errmsg != "")
	{
		errmsg = "<b>Invalid :</b> "+errmsg
		document.getElementById('e1').innerHTML = errmsg
		document.getElementById('txtok').value = ""
	}
	else
	{
		errmsg = ""	
		document.getElementById('e1').innerHTML = errmsg
		document.getElementById('txtok').value = "OK"
		document.frmcontact.submit()
	}
	
}//Function end	


function ptsmail()
{
	document.getElementById('c').innerHTML = "<hr color='#FFCC00'/>Thanks for your feedback!.  Your feedback has been sent!!. One of our staff will contact you very soon!!!<hr color='#FFCC00'/>";	
}


//View.asp
function legalinfo()
{
	document.getElementById('legal').innerHTML = "<span class='legal'><b>LEGAL DISCLAIMER:</b>The information presented here is, to the best of our knowledge and belief, accurate and reliable. Because conditions of use are beyond our control, we make no warranties, expressed or implied , and specifically exclude any and all warranties of merchantability and fitness for a particular purpose. Our products are sold with the express understanding that our customers will conduct their own tests to determine the suitability of the material for their particular use. Nothing herein shall be construed as permission or recommendation to practice a patented invention without a license. The sole liability of Polymer Technologies, Inc.. for any claims arising out of the manufacture, use, or sale of its products shall be for our customers purchase price or material replacement.</span>";
}


// Request Sample
function reqfrmvalid()
{
errmsg = ""

//Display the product grade
var tpg = document.getElementById('selprodgrade');
document.getElementById('tpg').value = tpg.options[tpg.selectedIndex].text;


	// First Name
	tfname = document.getElementById('txtfname').value
	if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tfname))
	{
		errmsg = "First Name"
	}

	// Last Name
	tlname = document.getElementById('txtlname').value
	if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tlname))
	{
		errmsg += " Last Name"
	}

	// Last Name
	tcmpname = document.getElementById('txtcmpname').value
	if (tcmpname != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tcmpname))
		{
			errmsg += " Company Name"
		}
	}

/*	// Title
	ttitle = document.getElementById('txttitle').value
	if (ttitle != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(ttitle))
		{
			errmsg += " Title"
		}
	}

	// Email ID
	temail = document.getElementById('txtemail').value
	if (!(/^[a-z]+[ _\.0-9a-z_]+[0-9a-z]+@([0-9a-z][0-9a-z._]+\.)+[a-z]{2,4}$/).test(temail))
	{
		errmsg += " Email"
	}

	// Phone
	tphone = document.getElementById('txtphone').value
	if (tphone != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tphone))
		{
			errmsg += " Phone"
		}
	}
	
	// FAX
	tfax = document.getElementById('txtfax').value
	if (tfax != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tfax))
		{
			errmsg += " FAX"
		}
	}


	// Cell
	tcell = document.getElementById('txtcell').value
	if (tcell != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tcell))
		{
			errmsg += " Cell Phone"
		}
	}
	
	
	// Address
	tadd1 = document.getElementById('txtadd1').value
	if (tadd1 != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tadd1))
		{
			errmsg += " Address1"
		}
	}

	// Address
	tadd2 = document.getElementById('txtadd2').value
	if (tadd2 != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tadd2))
		{
			errmsg += " Address2"
		}
	}
*/

	// State
	tstate = document.getElementById('selstate').value
	tnonstate = document.getElementById('txtstate').value
	if (tstate == "Non-US" && tnonstate == "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tstate))
		{
			errmsg += " State"
		}
	}

	// Country
	tctry = document.getElementById('txtctry').value
	if (tctry != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tctry))
		{
			errmsg += " Country"
		}
	}


/*	// Zipcode
	tzip = document.getElementById('txtzip').value
	if (tzip != "") 
	{
		if (!(/^[(0-9 )]+[(0-9 )]$/).test(tzip))
		{
			errmsg += " Zipcode"
		}
	}*/

	// Product
	tprod = document.getElementById('selprod').value
	if (tprod = 0)
	{
		errmsg = " Product"
	}

	// Product Grade
	tprodgr = document.getElementById('selprodgrade').value
	if (tprodgr = 0)
	{
		errmsg = " Product Grade"
	}


	if (errmsg != "")
	{
		errmsg = "<b>Invalid :</b> "+errmsg
		document.getElementById('e1').innerHTML = errmsg
		document.getElementById('txtok').value = ""
	}
	else
	{
		errmsg = ""	
		document.getElementById('e1').innerHTML = errmsg
		document.getElementById('txtok').value = "OK"
		document.frmreqsample.submit()
	}
	
}//Function end	



function frmmatvalid()
{
errmsg = ""

	// First Name
	tfname = document.getElementById('txtfname').value
	if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tfname))
	{
		errmsg = "First Name"
	}

	// Last Name
	tlname = document.getElementById('txtlname').value
	if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tlname))
	{
		errmsg += " Last Name"
	}

/*	// Last Name
	tcmpname = document.getElementById('txtcmpname').value
	if (tcmpname != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tcmpname))
		{
			errmsg += " Company Name"
		}
	}

	// Material
	tmat = document.getElementById('selprod').value
	if (tmat != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tmat))
		{
			errmsg += " Material"
		}
	}

*/	// Email ID
	temail = document.getElementById('txtemail').value
	if (!(/^[a-z]+[ _\.0-9a-z_]+[0-9a-z]+@([0-9a-z][0-9a-z._]+\.)+[a-z]{2,4}$/).test(temail))
	{
		errmsg += " Email"
	}

/*	// Phone
	tphone = document.getElementById('txtphone').value
	if (tphone != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tphone))
		{
			errmsg += " Phone"
		}
	}
	
	// FAX
	tfax = document.getElementById('txtfax').value
	if (tfax != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tfax))
		{
			errmsg += " FAX"
		}
	}


	// Cell
	tcell = document.getElementById('txtcell').value
	if (tcell != "") 
	{
		if (!(/^[(0-9- )]+[(0-9- )]$/).test(tcell))
		{
			errmsg += " Cell Phone"
		}
	}
	
	
	// Address
	tadd1 = document.getElementById('txtadd1').value
	if (tadd1 != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tadd1))
		{
			errmsg += " Address1"
		}
	}

	// Address
	tadd2 = document.getElementById('txtadd2').value
	if (tadd2 != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tadd2))
		{
			errmsg += " Address2"
		}
	}

*/
	// State
	tstate = document.getElementById('selstate').value
	tnonstate = document.getElementById('txtstate').value
	if (tstate == "Non-US" && tnonstate == "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tstate))
		{
			errmsg += " State"
		}
	}

	// Country
	tctry = document.getElementById('txtctry').value
	if (tctry != "") 
	{
		if (!(/^[(A-Za-z )]+[(A-Za-z0-9 )]$/).test(tctry))
		{
			errmsg += " Country"
		}
	}


/*	// Zipcode
	tzip = document.getElementById('txtzip').value
	if (tzip != "") 
	{
		if (!(/^[(0-9 )]+[(0-9 )]$/).test(tzip))
		{
			errmsg += " Zipcode"
		}
	}

*/
	// Error
	if (errmsg != "")
	{
		errmsg = "<b>Invalid :</b> "+errmsg
		document.getElementById('e1').innerHTML = errmsg
		document.getElementById('txtok').value = ""
	}
	else
	{
		errmsg = ""	
		document.getElementById('e1').innerHTML = errmsg
		document.getElementById('txtok').value = "OK"
		document.frmmatreq.submit()
	}

	
}//Function end	


//Retrieve the text of <select> material in matreq.asp
function tmatval()
{
	var ts1 = document.getElementById('selprod');
	document.getElementById('tmats').value = ts1.options[ts1.selectedIndex].text;
}


//Mail ack. for material request
function ptsmatmail()
{
	document.getElementById('c').innerHTML = "<hr color='#FFCC00'/>Thanks for your request!.  Your request has been sent!!. One of our staff will contact you very soon!!!<hr color='#FFCC00'/>";	
}




function dispctry()
{

	tstate = document.getElementById("selstate").value
	if (tstate == "Non-US") 
	{
		document.getElementById('dctry').style.display="block"
	}
	else
	{
		document.getElementById('dctry').style.display="none"
	}

}
