﻿
function go1()
{
   if(document.fromProduct.TR_Catid.value=="")
   { 
   		alert("Please select category.")
		document.fromProduct.TR_Catid.focus();
		return false;
   }
   if(document.fromProduct.TR_Subcatid.value=="")
   {
   		alert("Please select subcategory.")
		document.fromProduct.TR_Subcatid.focus();
		return false;
   }
	
		document.fromProduct.action="/sales/ItemList1.asp"
		document.fromProduct.submit();		
		return true;
}
function viewall()
{
	document.fromProduct.action="/sales/viewall.asp"
	document.fromProduct.submit();
}
function ViewSpec(product_id,mnf_name,PRD_brandmodel,PageMode,subcat_id,cat_id)
{
		
	document.frmHomePromo.subcat_id.value=subcat_id
	document.frmHomePromo.cat_id.value=cat_id
	document.frmHomePromo.pageMode.value=PageMode
	document.frmHomePromo.product_id.value=product_id
	document.frmHomePromo.mnf_name.value=mnf_name
	document.frmHomePromo.PRD_brandmodel.value=PRD_brandmodel
	//alert(document.frmHome.PageMode.value)
	document.frmHomePromo.action="/rentals/viewItem.asp"
	document.frmHomePromo.submit();
}	

function GetQuote(product_id,mnf_name,PRD_brandmodel,PRD_description,PageMode,subcat_id,cat_id)
{
	document.frmHomePromo.subcat_id.value=subcat_id
	document.frmHomePromo.cat_id.value=cat_id
	document.frmHomePromo.pageMode.value=PageMode
	document.frmHomePromo.product_id.value=product_id
	document.frmHomePromo.mnf_name.value=mnf_name
	document.frmHomePromo.PRD_brandmodel.value=PRD_brandmodel
	document.frmHomePromo.action="/rentals/store.asp"
	
}
function tradeshow()
 {
	document.frmtrade.action="/tradeshow/trendyTS.asp"
	document.frmtrade.submit();
 }

function blank_login()
{
	if(document.frmQuickQuote.Tr_name.value == "Enter Name")
	{				
		document.frmQuickQuote.Tr_name.value=""
		document.frmQuickQuote.Tr_name.focus()
		return false;
	}
}

function blank_email1()
{
	if(document.frmQuickQuote.TRZ_Email.value == "Enter Email")
	{	
		document.frmQuickQuote.TRZ_Email.value="";
		document.frmQuickQuote.TRZ_Email.focus();
		return false;
	}
}
	

function blank_tel()
{
	if(document.frmQuickQuote.Tr_tel.value == "Enter Tel Number")
	{
		document.frmQuickQuote.Tr_tel.value="";
		document.frmQuickQuote.Tr_tel.focus();
		return false;
	}
}

function blank_cname()
{
	if(document.frmQuickQuote.Tr_cname.value == "Enter Company Name")
	{
		document.frmQuickQuote.Tr_cname.value="";
		document.frmQuickQuote.Tr_cname.focus();
		return false;
		
	}
}
function validateForm1(pageMode,verify_name,product_name,emailMode)
{

	
	
	if (document.frmQuickQuote.Tr_cname.value== "Enter Company Name" || document.frmQuickQuote.Tr_cname.value=="")
	{
		alert("Please enter company name !!!");
		document.frmQuickQuote.Tr_cname.focus();
		return false;
	}
	if(document.frmQuickQuote.Tr_cname.value.charAt(0)==' ')
		{
			alert("Company cannot start with space");
			document.frmQuickQuote.Tr_cname.focus();
			return false;
		}	
	if (document.frmQuickQuote.Tr_name.value== "Enter Name")
	{
		alert("Please enter your name !!!");
		document.frmQuickQuote.Tr_name.focus();
		return false;
	}

	 if (document.frmQuickQuote.Tr_name.value=="")
	{
		alert("Please enter your name !!!");
		document.frmQuickQuote.Tr_name.focus();
		return false;
	}
		
	if(document.frmQuickQuote.Tr_name.value.charAt(0)==' ')
	{
		alert("Name cannot start with space");
		document.frmQuickQuote.Tr_name.focus();
		return false;
	}
	
	
		var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒšœŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789_ ";
		var checkStr =document.frmQuickQuote.Tr_name.value;
		var allValid = true;
	  for (i = 0;  i < checkStr.length;  i++)
	  {
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
			  if (ch == checkOK.charAt(j))
				break;
			if (j == checkOK.length)
			{
			  allValid = false;
			  break;
			}
	  }
	  

	if (!allValid)
	{
		 alert("Please enter only letter, digit and \"_\" characters in the field.");
		 document.frmQuickQuote.Tr_name.focus();
		 return false;
	}

	if(document.frmQuickQuote.TRZ_Email.value=="Enter email")
	{
		document.frmQuickQuote.TRZ_Email.focus();
		alert("Please enter email address !!!");
		return false;
	}
	
	 if(document.frmQuickQuote.TRZ_Email.value=="")
	{
		document.frmQuickQuote.TRZ_Email.focus();
		alert("Please enter email address !!!");
		return false;
	}

	if(document.frmQuickQuote.TRZ_Email.value.charAt(0)==' ')
	{
		alert("Email cannot start with space");
		document.frmQuickQuote.Tr_name.focus();
		return false;
	}

	
	var sobjValue;
	var iobjLength;
	sobjValue=document.frmQuickQuote.TRZ_Email.value;
	iobjLength=sobjValue.length;
	iFposition=sobjValue.indexOf("@");
	iSposition=sobjValue.indexOf(".");
	iTmp=sobjValue.lastIndexOf(".");	

	if ((iFposition == -1)||(iSposition == -1))
	{
		alert("Please enter the E-Mail address in the proper format");
		document.frmQuickQuote.TRZ_Email.focus();
		return false;
	}
	if(sobjValue.charAt(0) == "@" || sobjValue.charAt(0)==".")
	{
		alert("Please enter the E-Mail address in the proper format");
		document.frmQuickQuote.TRZ_Email.focus();
		return false;				
	}
	if(sobjValue.charAt(iobjLength) == "@" || sobjValue.charAt(iobjLength)==".")
	{
		alert("Please enter the E-Mail address in the proper format");
		document.frmQuickQuote.TRZ_Email.focus();
		return false;				
	}	
	if((sobjValue.indexOf("@",(iFposition+1)))!=-1)
	{	
		alert("Please enter the E-Mail address in the proper format");
		document.frmQuickQuote.TRZ_Email.focus();
		return false;
	}
	if ((iobjLength-(iTmp+1)<2)||(iobjLength-(iTmp+1)>3))
	{
		
		alert("Please enter the E-Mail address in the proper format");
		
		document.frmQuickQuote.TRZ_Email.focus();
		return false;
	}
	
	if (document.frmQuickQuote.Tr_tel.value== "Enter Tel Number" || document.frmQuickQuote.Tr_tel.value== "Enter Tel Numbe")
	{
		
		alert("Please enter telephone number !!!");
		document.frmQuickQuote.Tr_tel.focus();
		return false;
	}
	
	if (document.frmQuickQuote.Tr_tel.value=="")
	{
		alert("Please enter telephone number !!!");
		document.frmQuickQuote.Tr_tel.focus();
		return false;
	}
		
	if(document.frmQuickQuote.Tr_tel.value.charAt(0)==' ')
	{
		alert("Telephone number cannot start with space");
		document.frmQuickQuote.Tr_tel.focus();
		return false;
	}
			
	
	if(pageMode=="Add")
	{
		document.frmQuickQuote.pageMode.value="Add";
		/*document.frmQuickQuote.action="/quickquote/quickquoteaddMore.asp";
			document.frmQuickQuote.submit();*/
	}
	else
	{
		document.frmQuickQuote.pageMode.value="Email";
		/*document.frmQuickQuote.action="/quickquote/quickquotesendEmail.asp";
			document.frmQuickQuote.submit();*/
	}
	 if(document.frmQuickQuote.pageMode.value=="Email")
	 {
			document.frmQuickQuote.action="/quickquote/quickquotesendEmail.asp";
			document.frmQuickQuote.submit();
	}
	else
	{
			document.frmQuickQuote.action="/quickquote/quickquoteaddMore.asp";
			document.frmQuickQuote.submit();
	}
}



