﻿
//Global XMLHTTP Request object
var XmlHttp;

//Creating and setting the instance of appropriate XMLHTTP Request object to a “XmlHttp” variable  
function CreateXmlHttp()
{

	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
}


//Returns the node text value 
function GetInnerText (node)
{
	 return (node.textContent || node.innerText || node.text) ;
}

//Returns the node text value 
function GetAttributeText (node)
{
	 return (node.attributes[0].value || node.attributes(0).nodeValue) ;
}


function StartPageUtility()
{
	ContactCountryListOnChangeAVM();
	FormRelatedProcess();
	setTimeout('BillingCountryListOnChangeAVM();',1000);
	txtOtherValidatorsStartUp(); 
	
}
// ==============================================================================================
// ======================== COUNTRY PART STARTS =================================================
// ==============================================================================================
//Gets called when country combo box selection changes
function ContactCountryListOnChangeAVM() 
{
	var countryList = document.getElementById("slContactCountry");

	//Getting the selected country from country combo box.
	var selectedCountry = countryList.options[countryList.selectedIndex].value;
	
	// URL to get states for a given country
	var requestUrl = AjaxServerPageName + "?mtd=1&SelectedCountry=" + encodeURIComponent(selectedCountry);
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAVMCountry;
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}

//Called when response comes back from server
function HandleResponseAVMCountry()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{		

					ClearAndSetCityListItems(XmlHttp.responseXML.documentElement);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of city combo box and adds the city of currently selected country
function ClearAndSetCityListItems(countryNode)
{
    var cityList = document.getElementById("slContactCity");
	//Clears the state combo box contents.
	for (var count = cityList.options.length-1; count >-1; count--)
	{
		cityList.options[count] = null;
	}

	var textValue; 
	var optionItem;
	//Add new states list to the city combo box.
			
	optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
	cityList.options[0] = optionItem;
			
	var cityNodes = countryNode.getElementsByTagName('city');
	if(cityNodes.length>0)
	{
			document.Form1.slContactCity.disabled=false;
							
			for (var count = 0; count < cityNodes.length; count++)
			{
				textAttribute = GetAttributeText(cityNodes[count]);
   				textValue = GetInnerText(cityNodes[count]);
				optionItem = new Option( textValue, textAttribute,  false, false);
				cityList.options[cityList.length] = optionItem;
			}					
			
			CountyReset();
			
			document.Form1.txtContactCity.disabled=true;
			document.Form1.slContactCounty.disabled=false;
			
			if(document.getElementById("rfvContactCity").enabled==false)
			{
				ValidatorEnable(document.getElementById("rfvContactCity"),true);
			}
			ValidatorEnable(document.getElementById("rfvtxtContactCity"),false);			
			ValidatorEnable(document.getElementById("revtxtContactCity"),false);
			if(document.getElementById("rfvContactCounty").enabled==false)
			{					
				ValidatorEnable(document.getElementById("rfvContactCounty"),true);
			}		
	}
	else
	{
			CountyReset();
			document.Form1.slContactCity.disabled=true;
			document.Form1.txtContactCity.disabled=false;
			document.Form1.slContactCounty.disabled=true;
		
			ValidatorEnable(document.getElementById("rfvContactCity"),false);
			ValidatorEnable(document.getElementById("rfvtxtContactCity"),true);
			ValidatorEnable(document.getElementById("revtxtContactCity"),true);	
			ValidatorEnable(document.getElementById("rfvContactCounty"),false);			
		
	}			
}

function CountyReset()
{
		// County Dropdown Part
		var countyList = document.getElementById("slContactCounty");
		//Clears the county combo box contents.
		for (var count = countyList.options.length-1; count >-1; count--)
		{
			countyList.options[count] = null;
		}		
				
		optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
		countyList.options[0] = optionItem;	
}

// ==============================================================================================
// ======================== COUNTRY PART ENDS  ==================================================
// ==============================================================================================

// ==============================================================================================
// ======================== COUNTY PART ENDS  ==================================================
// ==============================================================================================
//Gets called when city combo box selection changes
function ContactCityListOnChangeAVM() 
{
	var countryList = document.getElementById("slContactCountry");

	//Getting the selected country from country combo box.
	var selectedCountry = countryList.options[countryList.selectedIndex].value;
	
	var cityList = document.getElementById("slContactCity");

	//Getting the selected country from country combo box.
	var selectedCity = cityList.options[cityList.selectedIndex].value;
	if(selectedCity>0)
	{	
	
		// URL to get states for a given country
		var requestUrl = AjaxServerPageName + "?mtd=2&SelectedCountry=" + encodeURIComponent(selectedCountry) + "&SelectedCity=" + encodeURIComponent(selectedCity);
		CreateXmlHttp();
	
		// If browser supports XMLHTTPRequest object
		if(XmlHttp)
		{
			//Setting the event handler for the response
			XmlHttp.onreadystatechange = HandleResponseAVMCity;
		
			//Initializes the request object with GET (METHOD of posting), 
			//Request URL and sets the request as asynchronous.
			XmlHttp.open("GET", requestUrl,  true);
		
			//Sends the request to server
			XmlHttp.send(null);		
		}
	}
	else
	{
    		var countyList = document.getElementById("slContactCounty");
		//Clears the state combo box contents.
		for (var count = countyList.options.length-1; count >-1; count--)
		{
			countyList.options[count] = null;
		}
		
		optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
		countyList.options[0] = optionItem;
	}

}

//Called when response comes back from server
function HandleResponseAVMCity()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{		
					ClearAndSetCountyListItems(XmlHttp.responseXML.documentElement);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of county combo box and adds the couties of currently selected city
function ClearAndSetCountyListItems(countyNode)
{
    var countyList = document.getElementById("slContactCounty");
	//Clears the state combo box contents.
	for (var count = countyList.options.length-1; count >-1; count--)
	{
		countyList.options[count] = null;
	}

	var countyNodes = countyNode.getElementsByTagName('county');
	if(countyNodes.length>0)
	{
			document.Form1.slContactCounty.disabled=false;
			var textValue; 
			var optionItem;
			//Add new states list to the state combo box.
			
			optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
			countyList.options[0] = optionItem;
							
			for (var count = 0; count < countyNodes.length; count++)
			{
				textAttribute = GetAttributeText(countyNodes[count]);
   				textValue = GetInnerText(countyNodes[count]);
				optionItem = new Option( textValue, textAttribute,  false, false);
				countyList.options[countyList.length] = optionItem;
			}
			
	}
	else
	{
		document.Form1.slContactCounty.disabled=true;
	}
}

// ==============================================================================================
// ======================== COUNTY PART ENDS  ===================================================
// ==============================================================================================


// ==============================================================================================
// ======================== COUNTRY PART STARTS (BILLING) =======================================
// ==============================================================================================
//Gets called when country combo box selection changes
function BillingCountryListOnChangeAVM() 
{
	var countryList = document.getElementById("slBillingCountry");

	//Getting the selected country from country combo box.
	var selectedCountry = countryList.options[countryList.selectedIndex].value;
	
	// URL to get states for a given country
	var requestUrl = AjaxServerPageName + "?mtd=1&SelectedCountry=" + encodeURIComponent(selectedCountry);
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAVMBillingCountry;
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}

//Called when response comes back from server
function HandleResponseAVMBillingCountry()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{		

					ClearAndSetBillingCityListItems(XmlHttp.responseXML.documentElement);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of city combo box and adds the city of currently selected country
function ClearAndSetBillingCityListItems(countryNode)
{
    var cityList = document.getElementById("slBillingCity");
	//Clears the state combo box contents.
	for (var count = cityList.options.length-1; count >-1; count--)
	{
		cityList.options[count] = null;
	}

	var textValue; 
	var optionItem;
	//Add new states list to the city combo box.
			
	optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
	cityList.options[0] = optionItem;
			
	var cityNodes = countryNode.getElementsByTagName('city');
	if(cityNodes.length>0)
	{
			document.Form1.slBillingCity.disabled=false;
						
			for (var count = 0; count < cityNodes.length; count++)
			{
				textAttribute = GetAttributeText(cityNodes[count]);
   				textValue = GetInnerText(cityNodes[count]);
				optionItem = new Option( textValue, textAttribute,  false, false);
				cityList.options[cityList.length] = optionItem;
			}
			
			BillingCountyTaxOfficeReset();	
			
			document.Form1.txtBillingCity.disabled=true;
			document.Form1.slBillingCounty.disabled=false;
			

			if(document.getElementById("rfvBillingCity").enabled==false)
			{
				ValidatorEnable(document.getElementById("rfvBillingCity"),true);
			}
			ValidatorEnable(document.getElementById("rfvtxtBillingCity"),false);			
			ValidatorEnable(document.getElementById("revtxtBillingCity"),false);
			if(document.getElementById("rfvBillingCounty").enabled==false)
			{					
				ValidatorEnable(document.getElementById("rfvBillingCounty"),true);
			}								
			
			if(document.getElementById("rfvBillingTaxOffice").enabled==false)
			{					
				ValidatorEnable(document.getElementById("rfvBillingTaxOffice"),true);
			}
			
			if(document.getElementById("rfvtxtTaxNumber").enabled==false)
			{					
				ValidatorEnable(document.getElementById("rfvtxtTaxNumber"),true);
			}
			
			if(document.getElementById("revtxtTaxNumber").enabled==false)
			{					
				ValidatorEnable(document.getElementById("revtxtTaxNumber"),true);
			}	
			
			if(document.getElementById("rfvCommerceChamber").enabled==false)
			{					
				ValidatorEnable(document.getElementById("rfvCommerceChamber"),true);
			}				
			
			if(document.getElementById("rfvtxtSicilNo").enabled==false)
			{					
				ValidatorEnable(document.getElementById("rfvtxtSicilNo"),true);
			}			
									
						
			document.Form1.slBillingTaxOffice.disabled=false;
			document.Form1.txtTaxNumber.disabled=false;
			document.Form1.slCommerceChamber.disabled=false;
			document.Form1.txtSicilNo.disabled=false;
	}
	else
	{
	
		BillingCountyTaxOfficeReset();
		
		document.Form1.slBillingCity.disabled=true;
		document.Form1.txtBillingCity.disabled=false;
		document.Form1.slBillingCounty.disabled=true;
		document.Form1.slBillingTaxOffice.disabled=true;
		document.Form1.txtTaxNumber.disabled=true;
		document.Form1.slCommerceChamber.disabled=true;
		document.Form1.txtSicilNo.disabled=true;
		
		
		ValidatorEnable(document.getElementById("rfvBillingCity"),false);
		ValidatorEnable(document.getElementById("rfvtxtBillingCity"),true);
		ValidatorEnable(document.getElementById("revtxtBillingCity"),true);	
		ValidatorEnable(document.getElementById("rfvBillingCounty"),false);	
		ValidatorEnable(document.getElementById("rfvBillingTaxOffice"),false);	
		ValidatorEnable(document.getElementById("rfvtxtTaxNumber"),false);
		ValidatorEnable(document.getElementById("revtxtTaxNumber"),false);
		ValidatorEnable(document.getElementById("rfvCommerceChamber"),false);
		ValidatorEnable(document.getElementById("rfvtxtSicilNo"),false);		
		
	}				
}

function BillingCountyTaxOfficeReset()
{
	// County Dropdown Part
	var countyList = document.getElementById("slBillingCounty");
	//Clears the county combo box contents.
	for (var count = countyList.options.length-1; count >-1; count--)
	{
		countyList.options[count] = null;
	}		
			
	optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
	countyList.options[0] = optionItem;	
	
	// County Dropdown Part
	var taxofficeList = document.getElementById("slBillingTaxOffice");
	//Clears the county combo box contents.
	for (var count = taxofficeList.options.length-1; count >-1; count--)
	{
		taxofficeList.options[count] = null;
	}		
			
	optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
	taxofficeList.options[0] = optionItem;	
}

// ==============================================================================================
// ======================== COUNTRY PART ENDS (BILLING) =========================================
// ==============================================================================================

// ==============================================================================================
// ======================== COUNTY PART STARTS (BILLING) ========================================
// ==============================================================================================

function BillingCityListChangePack()
{
	BillingCityListOnChangeAVM();
}
//Gets called when city combo box selection changes
function BillingCityListOnChangeAVM() 
{
	var countryList = document.getElementById("slBillingCountry");

	//Getting the selected country from country combo box.
	var selectedCountry = countryList.options[countryList.selectedIndex].value;
	
	var cityList = document.getElementById("slBillingCity");

	//Getting the selected country from country combo box.
	var selectedCity = cityList.options[cityList.selectedIndex].value;

	if(selectedCity>0)	
	{
		// URL to get states for a given country
		var requestUrl = AjaxServerPageName + "?mtd=2&SelectedCountry=" + encodeURIComponent(selectedCountry) + "&SelectedCity=" + encodeURIComponent(selectedCity);
		CreateXmlHttp();
	
		// If browser supports XMLHTTPRequest object
		if(XmlHttp)
		{
			//Setting the event handler for the response
			XmlHttp.onreadystatechange = HandleResponseAVMBillingCity;
			
			//Initializes the request object with GET (METHOD of posting), 
			//Request URL and sets the request as asynchronous.
			XmlHttp.open("GET", requestUrl,  true);
		
			//Sends the request to server
			XmlHttp.send(null);		
		}
	}
	else
	{
    		var countyList = document.getElementById("slBillingCounty");
		//Clears the state combo box contents.
		for (var count = countyList.options.length-1; count >-1; count--)
		{
			countyList.options[count] = null;
		}
		
		optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
		countyList.options[0] = optionItem;
	}
}

//Called when response comes back from server
function HandleResponseAVMBillingCity()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{		
					ClearAndSetBillingCountyListItems(XmlHttp.responseXML.documentElement);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of county combo box and adds the couties of currently selected city
function ClearAndSetBillingCountyListItems(countyNode)
{
    var countyList = document.getElementById("slBillingCounty");
	//Clears the state combo box contents.
	for (var count = countyList.options.length-1; count >-1; count--)
	{
		countyList.options[count] = null;
	}

	var countyNodes = countyNode.getElementsByTagName('county');
	if(countyNodes.length>0)
	{
			document.Form1.slBillingCounty.disabled=false;
			var textValue; 
			var optionItem;
			//Add new states list to the state combo box.
			
			optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
			countyList.options[0] = optionItem;
							
			for (var count = 0; count < countyNodes.length; count++)
			{
				textAttribute = GetAttributeText(countyNodes[count]);
   				textValue = GetInnerText(countyNodes[count]);
				optionItem = new Option( textValue, textAttribute,  false, false);
				countyList.options[countyList.length] = optionItem;
			}
			
	}
	else
	{
		document.Form1.slBillingCounty.disabled=true;
	}
	
	setTimeout('BillingTaxOfficeListOnChangeAVM();',1000); 	
}

// ==============================================================================================
// ======================== COUNTY PART ENDS (BILLING) ==========================================
// ==============================================================================================

// ==============================================================================================
// ======================== TAXOFFICE PART STARTS (BILLING) =====================================
// ==============================================================================================
//Gets called when city combo box selection changes
function BillingTaxOfficeListOnChangeAVM() 
{
	var countryList = document.getElementById("slBillingCountry");

	//Getting the selected country from country combo box.
	var selectedCountry = countryList.options[countryList.selectedIndex].value;
	
	var cityList = document.getElementById("slBillingCity");

	//Getting the selected country from country combo box.
	var selectedCity = cityList.options[cityList.selectedIndex].value;	
	
	// URL to get states for a given country
	var requestUrl = AjaxServerPageName + "?mtd=3&SelectedCountry=" + encodeURIComponent(selectedCountry) + "&SelectedCity=" + encodeURIComponent(selectedCity);
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAVMBillingTaxOffice;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}

//Called when response comes back from server
function HandleResponseAVMBillingTaxOffice()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{		
					ClearAndSetBillingTaxOfficeListItems(XmlHttp.responseXML.documentElement);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of county combo box and adds the couties of currently selected city
function ClearAndSetBillingTaxOfficeListItems(taxofficeNode)
{
    var taxofficeList = document.getElementById("slBillingTaxOffice");
	//Clears the state combo box contents.
	for (var count = taxofficeList.options.length-1; count >-1; count--)
	{
		taxofficeList.options[count] = null;
	}

	var taxofficeNodes = taxofficeNode.getElementsByTagName('taxoffice');
	if(taxofficeNodes.length>0)
	{
			document.Form1.slBillingTaxOffice.disabled=false;
			var textValue; 
			var optionItem;
			//Add new states list to the state combo box.
			
			optionItem = new Option( "-- SEÇİNİZ --", "0",  false, false);
			taxofficeList.options[0] = optionItem;	
			for (var count = 0; count < taxofficeNodes.length; count++)
			{
				textAttribute = GetAttributeText(taxofficeNodes[count]);
   				textValue = GetInnerText(taxofficeNodes[count]);
				optionItem = new Option( textValue, textAttribute,  false, false);
				taxofficeList.options[taxofficeList.length] = optionItem;
			}
			
	}
	else
	{
		document.Form1.slBillingTaxOffice.disabled=true;
	}
}

// ==============================================================================================
// ======================== TAXOFFICE PART ENDS (BILLING) =======================================
// ==============================================================================================

// ==============================================================================================
// ======================== FORM RELATED PROCESS PART STARTS  ===================================
// ==============================================================================================

function FormRelatedProcess()
{
	for (var count = 1; count < 11; count++)
	{
		var tempTextbox =  document.getElementById("txtOther_"+count);
		tempTextbox.disabled=true;
	}
}

function EnableDisabletxtOther(No)
{
		var tempTextbox =  document.getElementById("txtOther_"+No);
		var slAVM = document.getElementById("slAVM_"+No);
		var nselectedindex = slAVM.selectedIndex;
		var val = slAVM.options[nselectedindex].value;
		
		if(No>1)
		{		
			if(val=="0")
			{
			
				ValidatorEnable(document.getElementById("rfvtxtOther_"+No),false);
				//ValidatorEnable(document.getElementById("revtxtOther_"+No),false);		
				ValidatorEnable(document.getElementById("rfvtxtBrand_"+No),false);
				//ValidatorEnable(document.getElementById("revtxtBrand_"+No),false);
					
				//ValidatorEnable(document.getElementById("rfvSector_"+No),false);
				ValidatorEnable(document.getElementById("rfvFirmType_"+No),false);
				ValidatorEnable(document.getElementById("rfvArea_"+No),false);
				ValidatorEnable(document.getElementById("rfvRent_"+No),false);
				ValidatorEnable(document.getElementById("rfvDues_"+No),false);			
			}
			else
			{
				ValidatorEnable(document.getElementById("rfvtxtOther_"+No),true);
				//ValidatorEnable(document.getElementById("revtxtOther_"+No),true);		
				ValidatorEnable(document.getElementById("rfvtxtBrand_"+No),true);
				//ValidatorEnable(document.getElementById("revtxtBrand_"+No),true);
					
				//ValidatorEnable(document.getElementById("rfvSector_"+No),true);
				ValidatorEnable(document.getElementById("rfvFirmType_"+No),true);
				ValidatorEnable(document.getElementById("rfvArea_"+No),true);
				ValidatorEnable(document.getElementById("rfvRent_"+No),true);
				ValidatorEnable(document.getElementById("rfvDues_"+No),true);		
			}
		}
		
		if (val=="99999")
		{
			tempTextbox.disabled=false;
			ValidatorEnable(document.getElementById("rfvtxtOther_"+No),true);
			//ValidatorEnable(document.getElementById("revtxtOther_"+No),true);				
		}
		else
		{
			tempTextbox.disabled=true;
			ValidatorEnable(document.getElementById("rfvtxtOther_"+No),false);
			//ValidatorEnable(document.getElementById("revtxtOther_"+No),false);		
		}		
}

function txtOtherValidatorsStartUp()
{
	ValidatorEnable(document.getElementById("rfvtxtOther_1"),false);
	//ValidatorEnable(document.getElementById("revtxtOther_1"),false);
	
	for (var count = 2; count < 11; count++)
	{
		ValidatorEnable(document.getElementById("rfvtxtOther_"+count),false);
		//ValidatorEnable(document.getElementById("revtxtOther_"+count),false);		
		ValidatorEnable(document.getElementById("rfvtxtBrand_"+count),false);
		//ValidatorEnable(document.getElementById("revtxtBrand_"+count),false);
			
		//ValidatorEnable(document.getElementById("rfvSector_"+count),false);
		ValidatorEnable(document.getElementById("rfvFirmType_"+count),false);
		ValidatorEnable(document.getElementById("rfvArea_"+count),false);
		ValidatorEnable(document.getElementById("rfvRent_"+count),false);
		ValidatorEnable(document.getElementById("rfvDues_"+count),false);
	}
	
	// Disable AVM Application Validators

	for (var count = 2; count < 6; count++)
	{
		ValidatorEnable(document.getElementById("rfvslApplicationAVM"+count),false);	
		ValidatorEnable(document.getElementById("rfvtxtApplicationBrand"+count),false);	
		//ValidatorEnable(document.getElementById("revtxtApplicationBrand2"+count),false);
		//ValidatorEnable(document.getElementById("rfvslApplicationSector"+count),false);
		ValidatorEnable(document.getElementById("rfvslApplicationArea"+count),false);	
	}
}

function EnableDisableApplicationVal(No)
{
		var tempTextbox =  document.getElementById("txtOther_"+No);
		var slAppAVM = document.getElementById("slApplicationAVM"+No);
		var nselectedindex = slAppAVM.selectedIndex;
		var val = slAppAVM.options[nselectedindex].value;
		
		if(No>1)
		{		
			if(val=="0")
			{
			
				ValidatorEnable(document.getElementById("rfvslApplicationAVM"+No),false);	
				ValidatorEnable(document.getElementById("rfvtxtApplicationBrand"+No),false);	
				//ValidatorEnable(document.getElementById("revtxtApplicationBrand2"+No),false);
				//ValidatorEnable(document.getElementById("rfvslApplicationSector"+No),false);
				ValidatorEnable(document.getElementById("rfvslApplicationArea"+No),false);			
			}
			else
			{
				ValidatorEnable(document.getElementById("rfvslApplicationAVM"+No),true);	
				ValidatorEnable(document.getElementById("rfvtxtApplicationBrand"+No),true);	
				//ValidatorEnable(document.getElementById("revtxtApplicationBrand2"+No),false);
				//ValidatorEnable(document.getElementById("rfvslApplicationSector"+No),true);
				ValidatorEnable(document.getElementById("rfvslApplicationArea"+No),true);		
			}
		}		
}
// ==============================================================================================
// ======================== FORM RELATED PROCESS PART ENDS  =====================================
// ==============================================================================================

function BrandChecked(ddl,txt,val,val2)
{	
	var textbox = document.getElementById(txt);
	var validator = document.getElementById(val);
	var validator2 = document.getElementById(val2);
	
	if(ddl.options[ddl.selectedIndex].value == "99999")
	{
		textbox.style.display = "";
		ValidatorEnable(validator,true);
		ValidatorEnable(validator2,true);				
	}
	else
	{
		textbox.style.display = "none";
		ValidatorEnable(validator,false);
		ValidatorEnable(validator2,false);		
	}
}
