
function createRequestObject() 
	{ 
       var req; 
       if(window.XMLHttpRequest){ 
          // Firefox, Safari, Opera... 
          req = new XMLHttpRequest(); 
       } else if(window.ActiveXObject) { 
          // Internet Explorer 5+ 
          req = new ActiveXObject("Microsoft.XMLHTTP"); 
       } else { 
          // There is an error creating the object, 
          // just as an old browser is being used. 
          alert('Problem creating the XMLHttpRequest object'); 
       } 
       return req;
    } 
    // Make the XMLHttpRequest object 
    var http = createRequestObject(); // for select_ship
	var http1 = createRequestObject(); // for select_ship_destination
	var http2 = createRequestObject(); // for select_ship_sub_destination
	var http3 = createRequestObject(); // for get_city
	var http4 = createRequestObject(); // for select_type
	var http11 = createRequestObject(); // for select dest
	var http_interest = createRequestObject(); // for select_ship_destination
	var http_interest1 = createRequestObject(); // for select_ship_destination
	var http_duration = createRequestObject(); // for select_ship_sub_destination
	var http_range = createRequestObject(); // for get_city
	/*


					  

////////////////////				SHIP-TYPE RELATION				////////////////////////////
*/
function select_reset()
{
	document.getElementById('ship').value="0";
	document.getElementById('type').value="0";
	select_type();
	document.getElementById('month').value="0";
}

 function select_ship()
{
	
	var typ=document.getElementById('type').value;
	var shipid=document.getElementById('ship').value;
	//alert(typ);
	if(typ>0)
	{}
	else
	{
		if(typ==0||shipid==0)
		{
		
		http.open('get','select_ship.php?bargeid='+shipid+'&typeid='+typ+'&rand='+Math.random());
		http.onreadystatechange = handleResponse_ship;
		http.send(null);	
		
		}
	}
	select_ship_destination();
}

function handleResponse_ship() 
{ 
	if(http.readyState == 4 && http.status == 200)
		{ 
			// Text returned FROM the PHP script 
			var response = http.responseText; 
			// alert(response);
			document.getElementById('select_type').innerHTML=response;
			//document.getElementById('find_btn').innerHTML='<input type="image" src="images/find_now1.gif" id="find_now" />&nbsp;&nbsp;<a href="index.php"><input type="image" src="images/reset_btn.gif" name="reset" id="reset" /></a>';
			//document.getElementById('find_now').disable=false;
	    }
		else
		{
		
			document.getElementById('select_type').innerHTML='<select name="type" id="type" style="width:180px;"><option value="0" selected="selected">LOADING...</option></select>';	
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
			//document.getElementById('find_now').disable=true;
		}
	    
}

//this function will call when you select type dropdown
function select_type()
{
	var ship=document.getElementById('ship').value;
	var typeid=document.getElementById('type').value;
	//alert(typeid);
	if(ship>0)
	{}
	else
	{
			if(ship==0||typeid==0)
		{
 			http4.open('get','select_type.php?typeid='+typeid+'&bargeid='+ship+'&rand='+Math.random());
	   	 	http4.onreadystatechange = handleResponse_type;
	   	 	http4.send(null);	
		}
	}
	
}

function handleResponse_type() 
{ 
	if(http4.readyState == 4 && http4.status == 200)
		{ 
			var response = http4.responseText; 
 			document.getElementById('select_ship').innerHTML=response;
			select_ship_destination();
	    }
		else
		{
			document.getElementById('select_ship').innerHTML='<select name="ship" id="ship" style="width:180px;"><option value="0" selected="selected">LOADING...</option></select>';	
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
		}
	    
}

//end function
function select_interest()
{
	var shipid=document.getElementById('ship').value;
	//alert("ineterest");
 	http_interest.open('get','select_interest.php?shipid='+shipid+'&rand='+Math.random());
    http_interest.onreadystatechange = handleResponse_interest;
    http_interest.send(null);	
	//select_ship_destination();
}
function handleResponse_interest() 
{ 
	if(http_interest.readyState == 4 && http_interest.status == 200)
		{ 
    	   	// Text returned FROM the PHP script 
	  	  var response = http_interest.responseText; 
		  //alert(response);
		  document.getElementById('div_select_interest').innerHTML=response;
		  //document.getElementById('find_btn').innerHTML='<input type="image" src="images/find_now1.gif" id="find_now" />&nbsp;&nbsp;<a href="index.php"><input type="image" src="images/reset_btn.gif" name="reset" id="reset" /></a>';
			//document.getElementById('find_now').disable=false;
	    }
		else
		{
			document.getElementById('div_select_interest').innerHTML='<select name="interest" id="interest" style="width:180px;"><option value="0" selected="selected">LOADING...</option></select>';	
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
			//document.getElementById('find_now').disable=true;
		}
	    
}

function select_price_range()
{
	var shipid=document.getElementById('ship').value;
	http_range.open('get','select_price_range.php?shipid='+shipid+'&rand='+Math.random());
    http_range.onreadystatechange = handleResponse_price_range;
    http_range.send(null);	
	//select_ship_destination();
}
function handleResponse_price_range() 
{ 
	if(http_range.readyState == 4 && http_range.status == 200)
		{ 
	  	  var response = http_range.responseText; 
		  document.getElementById('div_select_price_range').innerHTML=response;
		  document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="images/find_now1.gif" id="find_now" />&nbsp;&nbsp;<a href="javascript:void(0)" onclick="select_reset();select_ship();select_interest();select_price_range();select_duration()"><img src="images/reset_btn.gif" name="reset" id="reset" border="0" /></a>';
	    }
		else
		{
			document.getElementById('div_select_price_range').innerHTML='<select name="price_range" id="price_range" style="width:180px;"><option value="0" selected="selected">LOADING...</option></select>';	
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
		}
	    
}

function select_duration()
{
	var shipid=document.getElementById('ship').value;
	//alert(shipid)
 	http_duration.open('get','select_duration.php?shipid='+shipid+'&rand='+Math.random());
    http_duration.onreadystatechange = handleResponse_duration;
    http_duration.send(null);	
	//select_ship_destination();
}
function handleResponse_duration() 
{ 
	if(http_duration.readyState == 4 && http_duration.status == 200)
		{ 
    	   	// Text returned FROM the PHP script 
	  	  var response = http_duration.responseText; 
		//  alert(response);
	
		  document.getElementById('div_select_duration').innerHTML=response;
		  document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="images/find_now1.gif" id="find_now" />&nbsp;&nbsp;<a href="javascript:void(0)" onclick="select_reset();select_ship();select_interest();select_price_range();select_duration()"><img src="images/reset_btn.gif" name="reset" id="reset" border="0" /></a>';
			//document.getElementById('find_now').disable=false;
	    }
		else
		{
			document.getElementById('div_select_duration').innerHTML='<select name="duration" id="duration" style="width:180px;"><option value="0" selected="selected">LOADING...</option></select>';	
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
			//document.getElementById('find_now').disable=true;
		}
	    
}


/*

////////////////////				SHIP-TYPE RELATION END				////////////////////////////
*/

/* 

////////////////////				SHIP-DESTINATION RELATION				////////////////////////////
*/
function select_ship_destination()
{
	var shipid=document.getElementById('ship').value;
	//alert("destination");
 	http1.open('get','select_ship_destination.php?bargeid='+shipid+'&rand='+Math.random());
    http1.onreadystatechange = handleResponse_ship_destination;
    http1.send(null);	
	 select_ship_sub_destination()
}

function handleResponse_ship_destination() 
{ 
	if(http1.readyState == 4 && http1.status == 200)
		{ 
    	   	// Text returned FROM the PHP script 
	  	  var response = http1.responseText; 
		 //alert(response);
		  document.getElementById('select_detination').innerHTML=response;
		  document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="images/find_now1.gif" id="find_now" />&nbsp;&nbsp;<a href="javascript:void(0)" onclick="select_reset();select_ship();select_interest(),select_price_range(),select_duration()"><img src="images/reset_btn.gif" name="reset" id="reset" border="0" /></a>';
			//document.getElementById('find_now').disable=false;
	    }
		else
		{
			document.getElementById('select_detination').innerHTML='<select name="destination" id="destination" style="width:180px;" ><option value="0" selected="selected">LOADING...</option></select>';
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
			//document.getElementById('find_now').disable=true;
		}
	    
}
function handleResponse_ship_destination1() 
{ 
	if(http11.readyState == 4 && http1.status == 200)
		{ 
    	   	// Text returned FROM the PHP script 
	  	  var response = http11.responseText; 
		 //alert(response);
		  document.getElementById('select_detination').innerHTML=response;
		  document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="images/find_now1.gif" id="find_now" />&nbsp;&nbsp;<a href="javascript:void(0)" onclick="select_reset();select_ship();select_interest(),select_price_range(),select_duration()"><img src="images/reset_btn.gif" name="reset" id="reset" border="0" /></a>';
			//document.getElementById('find_now').disable=false;
	    }
		else
		{
			document.getElementById('select_detination').innerHTML='<select name="destination" id="destination" style="width:180px;" ><option value="0" selected="selected">LOADING...</option></select>';
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
			//document.getElementById('find_now').disable=true;
		}
	    
}
/*

////////////////////				SHIP-DESTINATION RELATION END				////////////////////////////
*/
/*

////////////////////				SHIP-SUB DESTINATION RELATION				////////////////////////////
*/
 function select_ship_sub_destination()
{
	var shipid=document.getElementById('ship').value;
	//alert("sub destinatiom");
	//alert('select_ship_sub_destination.php?bargeid='+shipid+'&rand='+Math.random());
 	http2.open('get','select_ship_sub_destination.php?bargeid='+shipid+'&rand='+Math.random());
    http2.onreadystatechange = handleResponse_ship_sub_destination;
    http2.send(null);	
}

function handleResponse_ship_sub_destination() 
{ 
	if(http2.readyState == 4 && http2.status == 200)
		{ 
    	   	// Text returned FROM the PHP script 
	  	  var response = http2.responseText; 
		  //alert(response);
		  document.getElementById('select_sub_detination').innerHTML=response;
		  document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="images/find_now1.gif" id="find_now" />&nbsp;&nbsp;<a href="javascript:void(0)" onclick="select_reset();select_ship();select_interest();select_price_range();select_duration()"><img src="images/reset_btn.gif" name="reset" id="reset" border="0" /></a>';
			//document.getElementById('find_now').disable=false;
	    }
		else
		{
			document.getElementById('select_sub_detination').innerHTML='<select name="s_destination" id="s_destination" style="width:180px;" ><option value="0" selected="selected">LOADING...</option></select>';	
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
			//document.getElementById('find_now').disable=true;
		}
	    
}
/*

////////////////////				SHIP-SUB DESTINATION RELATION END				////////////////////////////
*/
/*
///////////////////					GET CITY FUNCTION								////////////////////////////
*/
function get_city()
	{ 
	   var value=document.getElementById('destination').value;
	   var value2=document.getElementById('ship').value;
       http3.open('get','get_city.php?ids='+value+'&ship='+value2+'&rand='+Math.random());
       http3.onreadystatechange = handleResponse_city;
       http3.send(null);
    }
	
function get_type_city()
{
		var typeid=document.getElementById('type').value;
		//alert(typeid);
		http11.open('get','select_ship_type_dest.php?type='+typeid+'&rand='+Math.random());
		
		http11.onreadystatechange = handleResponse_ship_destination1;
		//alert(handleResponse_ship_destination);
		http11.send(null);
}
	
	
function get_city_ship()
	{ 
	   var shipid=document.getElementById('ship').value;
	   var value=document.getElementById('destination').value;
	  // alert(shipid);
	 //  alert(value)
       http3.open('get','get_city.php?ids='+value+'&shipid='+shipid+'&rand='+Math.random());
       http3.onreadystatechange = handleResponse_city;
       http3.send(null);
    }


function handleResponse_city() 
{ 
	if(http3.readyState == 4 && http3.status == 200)
		{ 
    	   	// Text returned FROM the PHP script 
	  	  var response = http3.responseText; 
		 //alert(response);
		  document.getElementById('select_sub_detination').innerHTML=response;
		  document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="images/find_now1.gif" id="find_now" />&nbsp;&nbsp;<a href="javascript:void(0)" onclick="select_reset();select_ship();select_interest();select_price_range();select_duration()"><img border=0 src="images/reset_btn.gif" name="reset" id="reset" /></a>';
			//document.getElementById('find_now').disable=false;
	    }
		else
		{
			document.getElementById('select_sub_detination').innerHTML='<select name="s_destination" id="s_destination" style="width:180px;" ><option value="0" selected="selected">LOADING...</option></select>';	
			document.getElementById('find_btn').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/search_loading.gif" height="31" />';
			//document.getElementById('find_now').disable=true;
		}
	    
}	
/*
//////////////////					GET CITY FUNCTION END							////////////////////////////
*/ 
