function fnValidate(){
	var SearchID = document.getElementById('q');
	if(SearchID.value == '') {
		alert("Please enter atleast one keyword to search");
		SearchID.focus();
		return false;
	}
	else
		return true;
} //End of fnValidate

var min=11;
var max=12;
function increaseFontSize() {
   var p = document.getElementsByTagName('td');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}
function decreaseFontSize() {
   var p = document.getElementsByTagName('td');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

function getCountryCombo(strCountryDef)  {
	
	if (window.ActiveXObject)
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	else if (document.implementation && document.implementation.createDocument) 
		xmlDoc=document.implementation.createDocument("","",null);
	else 
		alert('Your browser cannot handle this script');
	
	xmlDoc.async=false;
	xmlDoc.load("js/countryDetails.xml");
	var countryCollection = xmlDoc.getElementsByTagName('country');
	var targetCombo = document.getElementById('ddlCountry');
	clearCombo('ddlCountry');
	if(countryCollection.length>0) {
		var cnt = 0;
		var cntryName = '';
		for(cnt=0;cnt<countryCollection.length;cnt++) {
			cntryName = countryCollection[cnt].getAttribute("name")
			targetCombo.options[cnt+1] = new Option(cntryName, cntryName, false, false);
		}
	}
	if(strCountryDef !='') {
		targetCombo.value = strCountryDef;
		getStateCombo(strCountryDef)
	}
} //End of getCountryCombo

function getStateCombo(strCountry) {
	if (window.ActiveXObject)
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	else if (document.implementation && document.implementation.createDocument) 
		xmlDoc=document.implementation.createDocument("","",null);
	else 
		alert('Your browser cannot handle this script');
	
	xmlDoc.async=false;
	xmlDoc.load("js/countryDetails.xml");
	var countryCollection = xmlDoc.getElementsByTagName('country');
	if(countryCollection.length>0) {
		var cnt = 0;
		var stateCollection = '';
		for(cnt=0;cnt<countryCollection.length;cnt++) {
			if(countryCollection[cnt].getAttribute("name") == strCountry) {
				stateCollection = 	countryCollection[cnt].getElementsByTagName('state');
				var targetCombo = document.getElementById('ddlState');
				var stateName = '';
				if(stateCollection.length>0) {
						var st = 0;
						clearCombo('ddlState');
						for(st=0;st<stateCollection.length;st++) {
							stateName = stateCollection[st].getAttribute("name")
							targetCombo.options[st+1] = new Option(stateName, stateName, false, false);
						}
				}	
				break;
			}	
		}
	}

} //End of getStateCombo

/*
* Clears the Drop Down Values Except the First Option
* @Parameter is Drop Down list ID
*/
function clearCombo(cntrlName) {
		var targetCombo = document.getElementById(cntrlName);
		for(var j=targetCombo.length;j>0;j--)
			targetCombo.options[j] = null;
} //End of clearCombo
