/*function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }

	function getLocations(category) {		

		var strURL="findLocation.php?category="+category;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				//alert(req.readyState);
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('locationdiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	function getCity(countryId,stateId) {		
		var strURL="findCity.php?country="+countryId+"&state="+stateId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('citydiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}*/
	
	
	
$(document).ready(function(){
	
	//$("td#city").append('');
	//$('#SecondList').hide();
	$("#main input[type='radio']").click(function(){
		if($(this).val()=='FRM_LHA'){
			$(".travel").text("TO")
			//$("p#check").append("check");
		}
		else{
			$(".travel").text("FROM")
		}
		});
		//from and to change text finished
		
		$(".category input[type='radio']").click(function(){
				
			var cat = $(this).val();
			$('#SecondList').hide();
			$('#SecondList').empty();
			
			
			$("#city img").show();
			
			
		$.get("findLocation.php", { category: cat},function(data){
				$("#city img").hide();
				$('#city #SecondList').append(data);
				$('#SecondList').show();
			} );

		/*$.ajax({
			url:"findLocation.php",
			dataType:"html",
			data:"category="+cat,
			
			success:function(data){
				$("#city img").hide();
				$('#city #SecondList').append(data);
				$('#SecondList').show();
					}
				});*/
				
			
			});
		
		
		
		
		
		
	
	});	
	
/*$(document).ready(function(){
	

	$("#engine ul li a").click(function(){
		var div = $(this).attr("name");
		$("#engine ul li a").removeClass("active");
		$(this).addClass("active");
		$(".tab").removeClass("active");
		$('.SecondList').remove();
		$("#"+div).addClass("active");
		});
	

	$(".category").change(function(){
		var cat = $(this).val();
	
		$('.SecondList').remove();
		$(".locationdiv img").show();
		
		$.ajax({
			url:"findLocation.php",
			dataType:"html",
			data:"category="+cat,
			cache:false,
			success:function(data){
				$(".locationdiv img").hide();
				$('.locationdiv').append(data);
				
				}
			
			
			});
		//$("#check").append(cat);
		});
	});	*/
