var xmlDocV;
var gblSrcV="";	
function fnSetVenues(){
		var country=document.eventForm.country.value;
		var exhiName = document.getElementById("idTxtEditable_eventNameE").value;
		var townCode= document.eventForm.location.value;
		var day = document.eventForm.eventDate_dsd.value;
		var mon = document.eventForm.eventDate_dsm.value;
		var year = document.eventForm.eventDate_dsy.value;
		if (document.implementation && document.implementation.createDocument)
		{
			xmlDocV = document.implementation.createDocument("","",null);
			if(exhiName == "")
			{
				xmlDocV.load("../GetVenues?country="+country+"&srchDay="+day+"&srchMon="+mon+"&srchYear="+year+"&src="+gblSrc+"&townCode="+townCode);
			}
			else
			{
				xmlDocV.load("../GetVenues?country="+country+"&exhiName="+exhiName+"&srchDay="+day+"&srchMon="+mon+"&srchYear="+year+"&src="+gblSrc+"&townCode="+townCode);
			}
			xmlDocV.onload = setVenues;
		}
		else if (window.ActiveXObject)
		{
			xmlDocV = new ActiveXObject("Microsoft.XMLDOM");
			xmlDocV.onreadystatechange = function(){
				if(xmlDocV.readyState == 4)
					setVenues();
			}
			if(exhiName == "")
			{
				xmlDocV.load("GetVenues?country="+country+"&srchDay="+day+"&srchMon="+mon+"&srchYear="+year+"&src="+gblSrc+"&townCode="+townCode+"&reqSelect="+jsExhiDefaultOption);
			}
			else
			{
				xmlDocV.load("GetVenues?country="+country+"&exhiName="+exhiName+"&srchDay="+day+"&srchMon="+mon+"&srchYear="+year+"&src="+gblSrc+"&townCode="+townCode+"&reqSelect="+jsExhiDefaultOption);
			}
	 	}
		else
		{
			alert(jsBrowserRSValidation);
			return;
		}
	}
/*
//Function to display the Venues of the selected Country
*/
function setVenues() {
		fnRemoveValues();
		var x = xmlDocV.getElementsByTagName('venue');
		for(i=0;i<x.length;i++){
			var objOption = document.createElement("option");
			objOption.value=x[i].childNodes[0].firstChild.nodeValue;
			objOption.text=x[i].childNodes[1].firstChild.nodeValue;
			try {
				document.eventForm.venue.add(objOption);
			} catch( e ) {
				document.eventForm.venue.add(objOption,null);
			}
		}
		//alert('ere');
		//fnSetSelectedVenue('c');
		//alert('ere');
		fnSetExhi(gblSrc);
		//alert('ere');
		//fnSetDefaultVenue(x,gblSrc);
}
/*
//Function to display the Venues of the selected Country
*/
function fnRemoveValues(){
		while (document.eventForm.venue.length>1){
			document.eventForm.venue.remove(1);
		}
}
function fnSetSelectedVenue(src)
{
		if(src == "c")
		{
			if(document.eventForm.country.selectedIndex == 0)
			{
			document.getElementById("idVenue").selectedIndex = 0;	
			}
		}
}
function fnSetDefaultVenue(x)
{
/*if(gblSrc == "e")
{
	if(x.length == 1)
	{
		document.getElementById("idVenue").selectedIndex = 1;
	}
	else
	{
		document.getElementById("idVenue").selectedIndex = 0;
	}
}*/	
}	
function fnFillVenues(src)
{
	gblSrc = src;
	fnSetVenues();
}