Current File : /home/inlingua/public_html/sales/common_ajax.js |
var xmlHttp
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
//======== from destintion drop down ===============
//====================== fetch flight number from tour page click ==================
function fetch_flight_destinations_from(selected_dest) {
var strURL="http://exclusivelyluxurytravel.com/from_destination.php?selected="+selected_dest;;
var req = GetXmlHttpObject();
if (req) {
//level_desc = "level_desc";
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('from_dest_div').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
else {
document.getElementById('from_dest_div').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function fetch_flight_destinations_to(selected_dest) {
var strURL="http://exclusivelyluxurytravel.com/to_destination.php?selected="+selected_dest;
var req = GetXmlHttpObject();
if (req) {
//level_desc = "level_desc";
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('to_dest_div').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
else {
document.getElementById('to_dest_div').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
//====================== fetch flight number from tour page click ==================
function fetch_flight_number(client_id) {
var strURL="fetch_flight_info.php?client_id="+client_id;
var req = GetXmlHttpObject();
if (req) {
//level_desc = "level_desc";
document.getElementById('forward_div').style.display = 'none';
document.getElementById('flight_acc_no').style.display='';
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('flight_acc_no').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
else {
//document.getElementById('flight_acc_no').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
//====================== fetch flight number from tour page click ==================
function fetch_tour_number(flight_id) {
var strURL="fetch_tour_info.php?flight_id="+flight_id;
var req = GetXmlHttpObject();
if (req) {
//level_desc = "level_desc";
document.getElementById('forward_div').style.display = 'none';
document.getElementById('flight_acc_no').style.display='';
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('flight_acc_no').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
else {
//document.getElementById('flight_acc_no').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
//====================== check against client name and email id and phone no ==================
function enq_check_duplicate(content, flag) {
if(flag=='phone'){
phone1 = document.getElementById('mbl1').value;
phone2 = document.getElementById('mbl2').value;
//phone3 = document.getElementById('mbl3').value;
content = phone1+'-'+phone2+'-'+content;
}
var strURL="enquiry_check_duplicate.php?content="+content+"&flag="+flag;
var req = GetXmlHttpObject();
if (req) {
//level_desc = "level_desc";
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
if(req.responseText==''){
} else {
alert(req.responseText);
}
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
else {
//document.getElementById('flight_acc_no').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
}
}
req.open("GET", strURL, true);
req.send(null);
}
}//====================== check against client name and email id and phone no ==================
function flight_check_duplicate(content, flag) {
if(flag=='phone'){
phone1 = document.getElementById('mbl1').value;
phone2 = document.getElementById('mbl2').value;
//phone3 = document.getElementById('mbl3').value;
content = phone1+'-'+phone2+'-'+content;
}
var strURL="flight_check_duplicate.php?content="+content+"&flag="+flag;
var req = GetXmlHttpObject();
if (req) {
//level_desc = "level_desc";
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
if(req.responseText==''){
} else {
alert(req.responseText);
}
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
else {
//document.getElementById('flight_acc_no').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
//==================== =======================
//==================== =======================
function remove_sel(flag, val){
switch(flag){
case 'country':
document.newclient_form.country.options[val].selected = false;
break;
case 'group':
document.newclient_form.destinations_group.options[val].selected = false;
break;
case 'custom':
document.newclient_form.destinations_custom.options[val].selected = false;
break;
case 'city':
document.newclient_form.cities.options[val].selected = false;
break;
}
append_val(flag);
}
function append_val(flag){
switch(flag){
case 'country':
value_countries = document.newclient_form.country.length;
list_str = '';
count = 0;
for(i=0;i<value_countries;i++){
if(document.newclient_form.country.options[i].selected == true){
count++;
if(count!=1){
list_str +=',';
}
send_val = document.newclient_form.country.options[i].text;
flag_send = "'"+"country"+"'";
list_str += ' <img src="images/cal_close_small.gif" onclick="remove_sel('+flag_send+','+i+')"> '+send_val;
}
}
document.getElementById('final_countries').innerHTML = list_str;
break;
//===================== group tours ============================
case 'group':
value_group = document.newclient_form.destinations_group.length;
list_str_g = '';
count_g = 0;
for(j=0;j<value_group;j++){
if(document.newclient_form.destinations_group.options[j].selected == true){
count_g++;
if(count_g!=1){
list_str_g +=',';
}
send_val_g = document.newclient_form.destinations_group.options[j].text;
flag_send_g = "'"+"group"+"'";
list_str_g += ' <img src="images/cal_close_small.gif" onclick="remove_sel('+flag_send_g+','+j+')"> '+send_val_g;
}
}
document.getElementById('group_final').innerHTML = list_str_g;
break;
case 'custom':
value_custom = document.newclient_form.destinations_custom.length;
list_str_c = '';
count_c = 0;
for(k=0;k<value_custom;k++){
if(document.newclient_form.destinations_custom.options[k].selected == true){
count_c++;
if(count_c!=1){
list_str_c +=',';
}
send_val_c = document.newclient_form.destinations_custom.options[k].text;
flag_send_c = "'"+"custom"+"'";
list_str_c += ' <img src="images/cal_close_small.gif" onclick="remove_sel('+flag_send_c+','+k+')"> '+send_val_c;
}
}
document.getElementById('custom_final').innerHTML = list_str_c;
break;
case 'city':
value_city = document.newclient_form.cities.length;
list_str_ct = '';
count_ct = 0;
for(l=0;l<value_city;l++){
if(document.newclient_form.cities.options[l].selected == true){
count_ct++;
if(count_ct!=1){
list_str_ct +=',';
}
send_val_ct = document.newclient_form.cities.options[l].text;
flag_send_ct = "'"+"city"+"'";
list_str_ct += ' <img src="images/cal_close_small.gif" onclick="remove_sel('+flag_send_ct+','+l+')"> '+send_val_ct;
}
}
document.getElementById('city_final').innerHTML = list_str_ct;
break;
}
}
//============================== ===============
//============================== ===============
// New Code for
function showItem(id,val)
{
var country_id=document.getElementById("country_id").value;
var state_id=document.getElementById("state_id").value;
var city_id=0;//document.getElementById("city_id").value;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_country_city_selection.php?myRand="+myRand+"&id="+id+"&val="+val+"&country_id="+country_id+"&state_id="+state_id+"&city_id="+city_id;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4){
document.getElementById("sp_state_id").innerHTML=xmlHttp.responseText;}
}
function show_voucher_room_type()
{
var hotel_id=document.getElementById("hotel_id1").value;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_voucher_room_type.php?myRand="+myRand+"&act=0&hotel_id="+hotel_id;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("show_more_room_type").innerHTML+=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_voucher_day_service()
{
var check_in=document.frm_voucher.check_in_date.value;
var check_out=document.frm_voucher.check_out_date.value;
var voucher_no=document.frm_voucher.voucher_no.value;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_voucher_room_type.php?myRand="+myRand+"&act=1&check_in="+check_in+"&check_out="+check_out+"&voucher_no="+voucher_no;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("show_day_service").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_voucher(voucher_no,print)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="view_voucher.php?myRand="+myRand+"&voucher_no="+voucher_no+"&print="+print;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("view_voucher").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function add_voucher_note(val)
{
if (val=='add_new')
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_voucher_room_type.php?myRand="+myRand+"&act=2&do="+val;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("voucher_note").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
else{document.getElementById("voucher_note").innerHTML='';}
}
function show_hotel_list(val)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_hotel_list.php?myRand="+myRand+"&val="+val;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("hotel_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
//////////////////Movement Starts////////////////
function show_hotel_list_movement(val)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_hotel_list_movement.php?myRand="+myRand+"&val="+val;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("hotel_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_company_list_movement(val)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_company_list_movement.php?myRand="+myRand+"&val="+val;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("company_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_trans_list_movement(val)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_trans_list_movement.php?myRand="+myRand+"&val="+val;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("transporter_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_guide_list_movement(val)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="show_guide_list_movement.php?myRand="+myRand+"&val="+val;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("guide_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_vehicle_list_movement(val)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="show_vehicle_list_movement.php?myRand="+myRand+"&val="+val;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("vehicle_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_city_list_movement(val,id)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_city_list_movement.php?myRand="+myRand+"&val="+val+"&id="+id;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("city_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_city_list_report(val,id)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_city_list_report.php?myRand="+myRand+"&val="+val+"&id="+id;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("city_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_represent_list_movement(val,id)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_represent_list_report.php?myRand="+myRand+"&val="+val+"&id="+id;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("represent_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
/////////////////////////////Movement Ends//////////////
function show_hotel_room_type(hotel_id)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_voucher_room_type.php?myRand="+myRand+"&act=3&hotel_id="+hotel_id;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("hotel_rrom_id").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_city_list(val,id)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_city_list.php?myRand="+myRand+"&val="+val+"&id="+id;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("city_divID").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_markup_on_list(val)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var url="ajax_markup_on_list.php?myRand="+myRand+"&val="+val;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById("choose_markup_on").innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function show_country_city(action)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
if (action=='show_city' || action=='show_state_city'){
var divID="td_state_cities";
}
else{
var divID="divID";}
var country_id=document.getElementById("sel_country_id").value;
if (action=='show_state_city') {var state_id=document.getElementById("sel_state_id").value;}
else if (action=='show_city') {
if(document.getElementById("sel_state_id")){var state_id=document.getElementById("sel_state_id").value;}
else{var state_id=0;}
}
else if (action=='add_city') {
if(document.getElementById("state_id")){var state_id=document.getElementById("state_id").value;}
else{var state_id=0;}
}
else {var state_id=0;}
var city_id=0;
myRand=parseInt(Math.random()*99999999);
var url="ajax_cities_countries.php?myRand="+myRand+"&action="+action+"&country_id="+country_id+"&state_id="+state_id+"&city_id="+city_id;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
document.getElementById(divID).innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function update_rem_flag(rem_id,val)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
myRand=parseInt(Math.random()*99999999);
var spn_id="spn_"+rem_id;
var url="ajax_update_rem_flag.php?myRand="+myRand+"&val="+val+"&rem_id="+rem_id;
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4){
//alert(xmlHttp.responseText);
document.getElementById(spn_id).innerHTML=xmlHttp.responseText;}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
//=======