////items for printing - start
function printit()
{  
	if(window.print)
	{
	   window.print();  
	}
	else
	{
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
	}
}
////items for printing - end

/////Validations at submission time - start
function submitform()
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	var website_filter=/^(http:\/\/)*((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	//validation of name - start
	if(document.inq_form.Name.value == '')
	{
		alert('Please Enter Name');
		document.inq_form.Name.focus();
		return false;
	}
	//validation of name - end
	
	//validation of telephone no - start
	if(document.inq_form.Tel_No.value != '')
	{
		var tel_no = document.inq_form.Tel_No.value;
		var len = tel_no.length;
		var num_var = parseInt(document.inq_form.Tel_No.value);
		var new_len = num_var;
		
		if(len > 10)
		{
			alert('Please enter maximum of 10 numbers in telephone no');
			document.inq_form.Tel_No.focus();
			return false;
		}
		else if(document.inq_form.Tel_No.value.match(/^\d+$/) == null)
		{
			alert('Please Enter a Valid Telephone number');
			document.inq_form.Tel_No.focus();
			return false;			
		}
		else if(len < 10)
		{
			alert('Please enter atleast 10 numbers in telephone no');
			document.inq_form.Tel_No.focus();
			return false;
		}
	}
	//validation of telephone no - end
	
	//validation of mobile no - start
	if(document.inq_form.Mobile_No.value != '')
	{
		var mob_no = document.inq_form.Mobile_No.value;
		var len = mob_no.length;
		if(len > 10)
		{
			alert('Please enter maximum of 10 numbers in mobile no');
			document.inq_form.Mobile_No.focus();
			return false;
		}
		else if(document.inq_form.Mobile_No.value.match(/^\d+$/) == null)
		{
			alert('Please Enter a Valid Mobile number');
			document.inq_form.Mobile_No.focus();
			return false;
		}
		else if(len < 10)
		{
			alert('Please enter atleast 10 numbers in mobile no');
			document.inq_form.Mobile_No.focus();
			return false;
		}
	}
	//validation of mobile no - end
	
	//////////mismatch of telephone and mobile no is necessary - start

	if(document.inq_form.Tel_No.value != '' && document.inq_form.Mobile_No.value != '' && document.inq_form.Tel_No.value == document.inq_form.Mobile_No.value)
	{
		alert('Telephone no and mobile no should not be same');
		document.inq_form.Mobile_No.focus();
		return false;
	}

	//////////mismatch of telephone and mobile no is necessary - end
	
	//validation of email id - start
	if(document.inq_form.Email_ID.value == '')
	{
		alert('Please Enter Email ID');
		document.inq_form.Email_ID.focus();
		return false;
	}
	
	if(document.inq_form.Email_ID.value != '')
	{
		if(!filter.test(document.inq_form.Email_ID.value))
		{
			alert('Please Enter a Valid email address');
			document.inq_form.Email_ID.focus();
			return false;
		}
	}
	//validation of email id - end

	//validation of wesite url - start

	if(document.inq_form.Website.value != '')
	{
		if(!website_filter.test(document.inq_form.Website.value))
		{
			alert('Please Enter a Valid Website');
			document.inq_form.Email_ID.focus();
			return false;
		}
	}

	//validation of wesite url - end

	//validation of product code - start
	if(document.inq_form.textfield22.value == '')
	{
		alert('Please Enter Product Code');
		document.inq_form.textfield22.focus();
		return false;
	}
	//validation of product code - end	
	return true;
}
/////Validations at submission time - end



/////Validations at submission time of inquiry of all procucts - start
function submitform2()
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	var website_filter=/^(http:\/\/)*((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	//validation of name - start
	if(document.inq_form.Name.value == '')
	{
		alert('Please Enter Name');
		document.inq_form.Name.focus();
		return false;
	}
	//validation of name - end
	
	//validation of telephone no - start
	if(document.inq_form.Tel_No.value != '')
	{
		var tel_no = document.inq_form.Tel_No.value;
		var len = tel_no.length;
		var num_var = parseInt(document.inq_form.Tel_No.value);
		var new_len = num_var;
		
		if(len > 10)
		{
			alert('Please enter maximum of 10 numbers in telephone no');
			document.inq_form.Tel_No.focus();
			return false;
		}
		else if(document.inq_form.Tel_No.value.match(/^\d+$/) == null)
		{
			alert('Please Enter a Valid Telephone number');
			document.inq_form.Tel_No.focus();
			return false;			
		}
		else if(len < 10)
		{
			alert('Please enter atleast 10 numbers in telephone no');
			document.inq_form.Tel_No.focus();
			return false;
		}
	}
	//validation of telephone no - end
	
	//validation of mobile no - start
	if(document.inq_form.Mobile_No.value != '')
	{
		var mob_no = document.inq_form.Mobile_No.value;
		var len = mob_no.length;
		if(len > 10)
		{
			alert('Please enter maximum of 10 numbers in mobile no');
			document.inq_form.Mobile_No.focus();
			return false;
		}
		else if(document.inq_form.Mobile_No.value.match(/^\d+$/) == null)
		{
			alert('Please Enter a Valid Mobile number');
			document.inq_form.Mobile_No.focus();
			return false;
		}
		else if(len < 10)
		{
			alert('Please enter atleast 10 numbers in mobile no');
			document.inq_form.Mobile_No.focus();
			return false;
		}
	}
	//validation of mobile no - end
	
	//////////mismatch of telephone and mobile no is necessary - start

	if(document.inq_form.Tel_No.value != '' && document.inq_form.Mobile_No.value != '' && document.inq_form.Tel_No.value == document.inq_form.Mobile_No.value)
	{
		alert('Telephone no and mobile no should not be same');
		document.inq_form.Mobile_No.focus();
		return false;
	}

	//////////mismatch of telephone and mobile no is necessary - end
	
	//validation of email id - start
	if(document.inq_form.Email_ID.value == '')
	{
		alert('Please Enter Email ID');
		document.inq_form.Email_ID.focus();
		return false;
	}
	
	if(document.inq_form.Email_ID.value != '')
	{
		if(!filter.test(document.inq_form.Email_ID.value))
		{
			alert('Please Enter a Valid email address');
			document.inq_form.Email_ID.focus();
			return false;
		}
	}
	//validation of email id - end

	//validation of wesite url - start

	if(document.inq_form.Website.value != '')
	{
		if(!website_filter.test(document.inq_form.Website.value))
		{
			alert('Please Enter a Valid Website');
			document.inq_form.Email_ID.focus();
			return false;
		}
	}

	//validation of wesite url - end
	return true;
}
/////Validations at submission time of inquiry of all procucts - end

////check if product checkbox are selected - start
function product_validate()
{
	var i=1;
	var flg = false;
	while(document.getElementById('prod'+i))
	{
		if(document.getElementById('prod'+i).checked == true)
		{
			//alert('checked val '+document.getElementById('prod'+i).value);
			flg = true;
		}
		if(flg)
		{
			break;
		}
		i++;
	}

	if(flg)
		return true;
	else
	{
		alert('Please select atleast one product of your choice');
		return false;
	}
}
////check if product checkbox are selected - end

/////Set parent window values in multiple inquiry option - start
/*
function set_parent()
{
	var em_val = document.frm_em_all.textfield.value;
	window.opener.frm_multiple.em.value=em_val;
	var target_form = opener.document.frm_multiple;
	//alert(top.opener.frm_multiple.action);
	top.opener.frm_multiple.submit();
	window.self.close();	
	return true;
}
*/
/////Set parent window values in multiple inquiry option - end

function em_validate()
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

	if(document.frm_multiple.ur_em.value == '')
	{
		alert('Please Enter Your Email ID');
		document.frm_multiple.ur_em.focus();
		return false;
	}
	if(document.frm_multiple.ur_em.value.search(filter)==-1)
	{
		alert('Please Enter Your Email address Proper');
		document.frm_multiple.ur_em.focus();
		return false;
	}
	
	if(document.frm_multiple.frnd_em.value == '')
	{
		alert('Please Enter Friend\'s Email ID');
		document.frm_multiple.frnd_em.focus();
		return false;
	}
	if(document.frm_multiple.frnd_em.value.search(filter)==-1)
	{
		alert('Please Enter Friend\'s Email address Proper');
		document.frm_multiple.frnd_em.focus();
		return false;
	}
	if(document.frm_multiple.frnd_em.value == document.frm_multiple.ur_em.value)
	{
		alert('Both Email ID can\'t be same');
		document.frm_multiple.frnd_em.focus();
		return false;
	}
	var i=1;
	var flg = false;
	while(document.getElementById('prod'+i))
	{
		if(document.getElementById('prod'+i).checked == true)
		{
			//alert('checked val '+document.getElementById('prod'+i).value);
			flg = true;
		}
		if(flg)
		{
			break;
		}
		i++;
	}

	if(flg)
		return true;
	else
	{
		alert('Please select atleast one product of your choice');
		return false;
	}
}

function chk_emls()
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	if(document.tel_a_frnd.ur_em.value == '')
	{
		alert('Please Enter Your Email ID');
		document.tel_a_frnd.ur_em.focus();
		return false;
	}
	if(document.tel_a_frnd.ur_em.value.search(filter)==-1)
	{
		alert('Please Enter Your Email address Proper');
		document.tel_a_frnd.ur_em.focus();
		return false;
	}
	
	if(document.tel_a_frnd.frnd_em.value == '')
	{
		alert('Please Enter Friend\'s Email ID');
		document.tel_a_frnd.frnd_em.focus();
		return false;
	}
	if(document.tel_a_frnd.frnd_em.value.search(filter)==-1)
	{
		alert('Please Enter Friend\'s Email address Proper');
		document.tel_a_frnd.frnd_em.focus();
		return false;
	}
	if(document.tel_a_frnd.frnd_em.value == document.tel_a_frnd.ur_em.value)
	{
		alert('Both Email ID can\'t be same');
		document.tel_a_frnd.frnd_em.focus();
		return false;
	}
}

function set_nul_val()
{
	var i=1;
	var flg = false;

	while(document.getElementById('prod'+i))
	{
		if(document.getElementById('prod'+i).checked == true)
		{
			//alert('checked val '+document.getElementById('prod'+i).value);
			flg = true;
		}
		if(flg)
		{
			break;
		}
		i++;
	}

	if(flg)
	{
		document.frm_multiple.id.value='';
		return true;
	}
	else
	{
		alert('Please select atleast one product of your choice');
		return false;
	}
}