
function submitContact (EditContactValue)
{
document.Main.EditCat.value = "";
document.Main.EditMan.value = "";  
document.Main.EditContact.value = EditContactValue;
document.Main.action="editcontact.asp";
document.Main.submit();
}
function submitCategory (EditCategoryValue) 
{
document.Main.EditContact.value = "";
document.Main.EditMan.value = ""; 
document.Main.EditCat.value = EditCategoryValue;
document.Main.submit();
}
function submitManu (EditManuValue) 
{
document.Main.EditContact.value = "";
document.Main.EditCat.value = "";  
document.Main.EditMan.value = EditManuValue;
document.Main.submit();
}
function CheckLength (nObj, nDataSize){
	if (nObj.value.length > nDataSize){
		var nOverSize
		nOverSize = nObj.value.length - nDataSize;
		alert("The description field is limited to " + nDataSize + " characters.  Please shorten your entry by " + nOverSize + " characters.");
		nObj.focus();
		return false;
	}		
	return true;
}

function CheckAttachments (SelectedAtt, Attach2, Attach3){
	if ((SelectedAtt.value == Attach2.value || SelectedAtt.value == Attach3.value) && (SelectedAtt.value != 0)) {
		alert("This attachment has already been chosen. Please select a different attachment.");
		SelectedAtt.value = 0; 
		SelectedAtt.focus();
	}
}

function SetDealerGroupCurrency ()
{
	var myindex=document.Main.CurrencyCode.selectedIndex;
	//var SelValue = document.Main.CurrencyCode.options[myindex].value;
	document.Main.DealerGroupCurrencyCode.selectedIndex=myindex;	
}

function CheckInputLength (nObj, nDataSize)
{	
	var myRegEx = RegExp("(\r[^\n]|[^\r]\n)", "g");
	var myText =nObj.value;
	var myNormalizedText = myText.replace(myRegEx, "\r\n");
		
	if (myNormalizedText.length > nDataSize){
	nObj.value=myText.substring(0, myText.length-(myNormalizedText.length-nDataSize));
	nObj.focus();
	
	}
	
	return false;
}


			
function ProcessDIVTag(divElementIdUsa,divElementIdOther,CountryName)
{
	var state = 'haryana';
	if ((document.getElementById(divElementIdUsa)) && (document.getElementById(divElementIdOther)))
	{
		if ((CountryName=="") || (CountryName=="United States") || (CountryName=="Canada"))
		{
			document.getElementById(divElementIdUsa).style.display="block";
			document.getElementById(divElementIdOther).style.display="none";
			document.Main.State.value = ""
			for (var i=0; i < document.Main.State.length;i++)
			{
				if (document.Main.State[i].value == state)
				{
					document.Main.State.selectedIndex = i;
					i = document.Main.State.length;
				}
					
			}
		}
		else
		{	
			document.getElementById(divElementIdUsa).style.display="none";
			document.getElementById(divElementIdOther).style.display="block";
			document.Main.State.selectedIndex
			for (var i=0; i < document.Main.State.length;i++)
			{
				if (document.Main.State[i].value == "")
				{
					document.Main.State.selectedIndex = i;
					i = document.Main.State.length;
				}
			}
		}
	}
}
function ProcessDIVTag2(divElementIdUSA,divElementIdOther,CountryName)
{
	if ((document.getElementById(divElementIdUSA)) && (document.getElementById(divElementIdOther)))
	{
		if (CountryName=="United States")
		{
			document.getElementById(divElementIdUSA).style.display="block";
			document.getElementById(divElementIdOther).style.display="none";
		}
		else
		{	
			document.getElementById(divElementIdUSA).style.display="none";
			document.getElementById(divElementIdOther).style.display="block";
		}
	}
}
function OpenLookUp(){
	var crmID;
	crmID = window.showModalDialog("/input/crm/lookupcontact.aspx?guid=A9EAAADBB0C0487AAA69952FFE35D28E", window, "height=400,width=650, menubar=no, status=yes, resizable=yes, scrollbars=yes");
	if (crmID)
	document.Main.CRMID.value = crmID;
}



	function OpenUp(sURL)
	{
		var params='height=380,width=640,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes';
		var winname=null;
		
		if((sURL.indexOf("/ads")!=-1))
		{
			params='height=480,width=640,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes';
			winname='VT_Window';
		}
		if(sURL.indexOf("/zoom")!=-1)
		{
			params='height=370,width=370,status=no,toolbar=no,menubar=no,location=no,resizable=yes';
			winname='Zoom_Window';
		}
		if(sURL.indexOf("/quotewizard")!=-1)
		{
			params='height=400,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes';
			winname='Quote_Window';
		}

		window.open(sURL,winname,params,false);
	}
	
	function change1(){
		document.form1.checkbox1.checked = false;
		}
	function change2(){
		document.form1.checkbox2.checked = false;
		}	
