// JavaScript Document
/*
    Ajax FUNCTION FOR INDEX EVENT LOADING
*/
function createCookie(name,value,days) {
	//alert(value);
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
 function eventload(var1,page)
  {
	  document.getElementById('left-col').innerHTML	=	'';
	  document.getElementById('left-col').innerHTML	=	'<div align="center" style="margin-top:120px;margin-bottom:120px;"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  //  $("#left-col").empty().html('<img src="loading.gif" />');
	  if(var1= 1)
	  {
	  


	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'eventindex',page: page },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
		$("#post").empty().html('<img src="images/loading_globe.gif" />');
		var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
		if (window.addthis){
			window.addthis = null;
		}
		$.getScript( script );

	    document.getElementById('left-col').innerHTML	=	response;	
		//$("left-col").slideToggle("slow");
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
	
	  }
   }
 //function  for getting public event  
 
  function calenderpublic(flag)
  {
	 document.getElementById('calendar').innerHTML	=	"&nbsp;";  
	  var type = new Array();
	 if(flag==1)
	 {
	
		    type[0] =1;
		    type[1] =1;
		    type[2]=1;
	        type[3] =1;
	 }
	 else
	 {
		 for (i=0; i< 4; i++){
			if(document.form.checkgroup[i].checked==true)
			{
				type[i]=1;
			}
			else
			{
				type[i]=0;
			}
		 }
	 }

	  if(type[0]==0 && type[1] ==0 && type[2]==0 && type[3]==0)
	  {
		    type[0] =1;
		    type[1] =1;
		    type[2]=1;
	        type[3] =1;
	  }
	  
	  
	  
	  $(document).ready(function() {
						 
								  
	
		$('#calendar').fullCalendar({
			header: {
			    left: 'prev,next today',
				center: 'title',
				right: '' //month,basicWeek,basicDay
			},
		
			editable: false,
			
			events: "jirna-pubevents.php?traev="+type[0]+"&webe="+type[1]+"&ce="+type[2]+"&hde="+type[3]+"",
			
			eventDrop: function(event, delta) {
				alert(event.title + ' was moved ' + delta + ' days\n' +
					'(should probably update your database)');
			},
			
			loading: function(bool) {
				if (bool) $('#loading').show();
				else $('#loading').hide();
			}
			
		});
		
	});
  }
  //FOR SMALL CALENDAR
  function calenderpublic_2(flag)
  {
	 document.getElementById('calendar').innerHTML	=	"&nbsp;";  
	  var type = new Array();
	 if(flag==1)
	 {
	
		    type[0] =1;
		    type[1] =1;
		    type[2]=1;
	        type[3] =1;
	 }
	 else
	 {
		 for (i=0; i< 4; i++){
			if(document.form.checkgroup[i].checked==true)
			{
				type[i]=1;
			}
			else
			{
				type[i]=0;
			}
		 }
	 }

	  if(type[0]==0 && type[1] ==0 && type[2]==0 && type[3]==0)
	  {
		    type[0] =1;
		    type[1] =1;
		    type[2]=1;
	        type[3] =1;
	  }
	  
	  
	  
	  $(document).ready(function() {
						 
								  
	
		$('#calendar').fullCalendar({
			header: {
			    left: 'prev,next today',
				center: 'title',
				right: '' //month,basicWeek,basicDay
			},
		
			editable: false,
			
			events: "jirna-pubevents_2.php?traev="+type[0]+"&webe="+type[1]+"&ce="+type[2]+"&hde="+type[3]+"",
			
			eventDrop: function(event, delta) {
				alert(event.title + ' was moved ' + delta + ' days\n' +
					'(should probably update your database)');
			},
			
			loading: function(bool) {
				if (bool) $('#loading').show();
				else $('#loading').hide();
			}
			
		});
		
	});
  }
  
  
  //FOR CITY
  function getCity(stateId)
  {

	  if(stateId != 0)
	  {
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'cityindex',stateid: stateId },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('citydiv').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
	  }
	  else
	  {
		  document.getElementById('citydiv').innerHTML	=	'<select name="City"><option>City </option></select>';	
	  }

   }


//FOR SUPPLIER
   function supplierload(page,flag,secondflag)
  {
	  document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:200px;margin-bottom:200px;"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  	//FOR TEXT SEARCH
		var cname=document.getElementById("searchname").value;
		var x="";
		var cityname="";
		var cityid=0;
		var y="";
		var suppname="";
		var suppid=0;
		var z="";
		var subsuppname="";
		var subsuppid=0;
		var c="";
		var subcounname="";
		var subcounid=0;
		
		
		
		//FOR CITY ID AND NAME
		x=document.getElementById("City");
		cityname=x.options[x.selectedIndex].text;
		cityid=x.options[x.selectedIndex].value;
		//FOR SUPPLIER ID AND NAME
		//alert($("#SubSupp").val());
		y=document.getElementById("Supp");
		suppname=y.options[y.selectedIndex].text;
		suppid=y.options[y.selectedIndex].value;
		//FOR SUPPLIER SUB ID AND NAME
	if(flag==0)
	{
			z=document.getElementById("SubSupp");
			subsuppname=z.options[z.selectedIndex].text;
			subsuppid=z.options[z.selectedIndex].value;
		
		//FOR SUB CONUNTRY
		if(subsuppid!='0')
		{	
			c=document.getElementById("subcountry");
			subcounname=c.options[c.selectedIndex].text;
			subcounid=c.options[c.selectedIndex].value;
			//alert(subcounid);
			
		}else
		{
			//subcounname="";
			//subcounid=0;
		}
		
	}
		if(subsuppid!='0' && subcounid=='0' && suppid!='6')
		{
	
			//subcounid=231;
			//subcounname="United Arab Emirates";
			subcounid=0;
			subcounname="All countries";
			
		}
		if(secondflag=='1' && suppid!='6')
		{
			subcounid=231;
			subcounname="United Arab Emirates";
		}
	
		//alert(subcounname);

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'supplier',page: page,cname: cname,cityid: cityid,cityname: cityname,suppid: suppid,suppname: suppname,subsuppid: subsuppid,subsuppname: subsuppname,subcounid: subcounid, subcounname: subcounname},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
   //FOR AGENCY
   function agencyload(page,flag,secondflag)
  {
	  document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:200px;margin-bottom:200px;"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  	//FOR TEXT SEARCH
		var cname=document.getElementById("searchname").value;
		var x="";
		var cityname="";
		var cityid=0;
		var y="";
		var suppname="";
		var suppid=0;
		var z="";
		var subsuppname="";
		var subsuppid=0;
		var c="";
		var subcounname="";
		var subcounid=0;
		
		
		
		//FOR CITY ID AND NAME
		x=document.getElementById("City");
		cityname=x.options[x.selectedIndex].text;
		cityid=x.options[x.selectedIndex].value;
		//FOR SUPPLIER ID AND NAME
		//alert($("#SubSupp").val());
		y=document.getElementById("Supp");
		suppname=y.options[y.selectedIndex].text;
		suppid=y.options[y.selectedIndex].value;
		//FOR SUPPLIER SUB ID AND NAME
	if(flag==0)
	{
			z=document.getElementById("SubSupp");
			subsuppname=z.options[z.selectedIndex].text;
			subsuppid=z.options[z.selectedIndex].value;
		
		//FOR SUB CONUNTRY
		if(subsuppid!='0')
		{	
			c=document.getElementById("subcountry");
			subcounname=c.options[c.selectedIndex].text;
			subcounid=c.options[c.selectedIndex].value;
			//alert(subcounid);
			
		}else
		{
			//subcounname="";
			//subcounid=0;
		}
		
	}
		if(subsuppid!='0' && subcounid=='0' && suppid!='6')
		{
	
			//subcounid=231;
			//subcounname="United Arab Emirates";
			subcounid=0;
			subcounname="All countries";
			
		}
		if(secondflag=='1' && suppid!='6')
		{
			subcounid=231;
			subcounname="United Arab Emirates";
		}
	
		//alert(subcounname);

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'agency',page: page,cname: cname,cityid: cityid,cityname: cityname,suppid: suppid,suppname: suppname,subsuppid: subsuppid,subsuppname: subsuppname,subcounid: subcounid, subcounname: subcounname},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }

//FOR EVENTS-EVENT DISPLAY
function calevent_load(page,eid)
  {
	 //alert(eid);
	 document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:140px;margin-bottom:140px;"><img src="../../../../images/loading_globe.gif" border="0"/></div>';
      
	  new Ajax.Request('../../../../travelproajax.php',
        {
			method:'post',
		parameters: {action: 'calevents',page: page,eventid: eid },
        onSuccess: function(transport){
        var response = transport.responseText;
		var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
		if (window.addthis){
			window.addthis = null;
		}
		$.getScript( script );
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
	

   }
   
   //CALENDAR WEEK LOAD
   function calevent_load_week(page,eid)
  {
	 // alert(eid);
	 document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:140px;margin-bottom:140px;"><img src="images/loading_globe.gif" border="0"/></div>';
      
	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'calevents_week',page: page,eventid: eid },
        onSuccess: function(transport){
        var response = transport.responseText;
		var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
		if (window.addthis){
			window.addthis = null;
		}
		$.getScript( script );
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
	

   }
   
   //FOR EVENTS-DAY DISPLAY
function calday_load(page,edate)
  {
	 //alert(edate);
	 document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:105px;margin-bottom:105px"><img src="images/loading_globe.gif" border="0"/></div>';

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'caldays',eventdate: edate },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
	

   }
   
    //FOR EVENTS-NEW-DAY DISPLAY
function calday_load_new(page,edate)
  {
	 //alert(edate);
	 document.getElementById('right-main-new').innerHTML	=	'';
	  document.getElementById('right-main-new').innerHTML	=	'<div align="center" style="margin-top:105px;margin-bottom:105px"><img src="images/loading_globe.gif" border="0"/></div>';

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'caldaysnew',eventdate: edate },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main-new').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
	

   }
   
   
 function  showHideContent(id,id2,show)      
  
  {        
  var elem = document.getElementById(id); 
  var id2  = document.getElementById(id2);
  if (elem)       
  {         
  if (show)        
  {          
  elem.style.display = 'block';         
  elem.style.visibility = 'visible';   
  
   id2.style.display = 'none';         
  id2.style.visibility = 'hidden'; 
  }         
  else          
  { elem.style.display = 'none';    
    elem.style.visibility = 'hidden';  
	
	 id2.style.display = 'block';         
     id2.style.visibility = 'visible'; 
	}      
	}     
	}     

   //FOR ALL COUNTRY POPULATION
   
 //var months = ['nuhman', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
 
   
  
  /* function clcikforcity()

 {
 //alert('city');
// var city= ['nuhman', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

 $("#city").autocomplete(city, {
		minChars: 0,
		max: 20,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 120,
		formatItem: function(data, i, total) {
			
			return data[0];
		}
	});

 }*/




function clickme()
{




 



$("#country").autocomplete(dis, {
		minChars: 0,
		max: 20,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 120,
		formatItem: function(data, i, total) {
			
			return data[0];
		}
	});
}

function clearText(field){

    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;

}
   
   function changeme()
   {
	    var city=document.getElementById("city").value;
		//alert(city);
	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'city-country',city: city },
        onSuccess: function(transport){
        var response = transport.responseText;
		var str = removeNL(response);
		document.getElementById("country").value=str;
	   // document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
   }
   
   
   function removeNL(str) {
    var strClean = "";
    for (i=0; i < str.length; i++) {
        if (str.charAt(i) != '\n' &&
            str.charAt(i) != '\r' &&
            str.charAt(i) != '\t') {
            strClean = strClean + str.charAt(i);
        }
    }
    return strClean;
}

//FOR COUNTRY POPILATE
function getCountry(cityId)
  {

	  if(cityId != 0)
	  {
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'countryindex',cityid: cityId },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('countrydiv').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
	  }
	  else
	  {
		  document.getElementById('countrydiv').innerHTML	=	'<select name="Country" style="width:340px"><option>Country *</option></select>';	
	  }

   }
   
  //FOR SUPPLY 
   
  function supplierCombo(ptype)
  { 
       document.getElementById('selectcombo').innerHTML	=	'';
       document.getElementById('selectcombo').innerHTML	=	'<div align="center" style="margin-top:0px"><img src="images/load.gif" border="0"/></div>';	
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'supplierCombo',ptype: ptype},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('selectcombo').innerHTML	=	response;
		//$("#Supp").dropdownchecklist({ icon: {},emptyText: "Select the ones that apply", width: 340,maxDropHeight: 250 }); 
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
    
   }
    
	//SUB SUPPLY
  function suppchange(suppid)
  { 
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'subSupplier',suppid: suppid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
   
   
   
   //FOR SUPPLIER SUB
   function supplierSub(page)
  {
	  document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:200px"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  //  $("#left-col").empty().html('<img src="loading.gif" />');
	
		 var cname=document.getElementById("searchname").value;
	

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'supplier',page: page,cname: cname },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
	
	
   }
   
   
   
  //SUB SUPPLY FOR SERCH
  function suppchange_srch(suppid)
  { 
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'subSupplier_srch',suppid: suppid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    //alert(response);
	    document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
   //SUB SUPPLY COUNTRY FOR SERCH
  function subsupplychange_srch(suppid)
  { 
	   new Ajax.Request('travelproajax.php',
        {
		method:'post',
		parameters: {action: 'subSuppliercountry_srch',suppid: suppid},
        onSuccess: function(transport){
        var response = transport.responseText;
		//alert(response);
	    document.getElementById('selectsubcountry').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
     //SUB AGENCY FOR SERCH
  function agencychange_srch(suppid)
  { 
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'subAgency_srch',suppid: suppid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    //alert(response);
	    document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
   //SUB AGENCIES COUNTRY FOR SERCH
  function subagencychange_srch(suppid)
  { 
	   new Ajax.Request('travelproajax.php',
        {
		method:'post',
		parameters: {action: 'subAgencycountry_srch',suppid: suppid},
        onSuccess: function(transport){
        var response = transport.responseText;
		//alert(response);
	    document.getElementById('selectsubcountry').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
   
   //FOR SUPPLY COMPANY EDIT
   
  function supplierComboCompany(ptype)
  { 
       document.getElementById('selectcombo').innerHTML	=	'';
       document.getElementById('selectcombo').innerHTML	=	'<div align="center" style="margin-top:0px"><img src="images/load.gif" border="0"/></div>';	
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'supplierComboCompany',ptype: ptype},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('selectcombo').innerHTML	=	response;	
		$("#subcountry").val(231);
		//$("#Supp").dropdownchecklist({ icon: {},emptyText: "Select the ones that apply", width: 340,maxDropHeight: 250 }); 
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
    
   }
    
	
   //SUB SUPPLIER FOR COMPANY EDIT
    function suppchangeCompany(suppid)
  { 
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'subSupplierCompany',suppid: suppid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }

//SUPER ADMIN COMPANY VALIDATE
function validateSuper(stat,cid)
{ 
	new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'companyValidate',cid: cid,stat: stat},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    //document.getElementById('validation').innerHTML	=	response;
		$('#validation-success').fadeIn(1000, function() {
           window.setTimeout ( function() {
             $('#validation-success').fadeOut(1000, function() { 
              }) }
             , 10000);
       });
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
}
//SUPER ADMIN EVENT VALIDATE
function validateEvent(stat,eid)
{
	//alert(eid);
	new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'eventValidate',eid: eid,stat: stat},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    //document.getElementById('validateall').innerHTML	=	response;
		$('#validation-success').fadeIn(1000, function() {
           window.setTimeout ( function() {
             $('#validation-success').fadeOut(1000, function() { 
              }) }
             , 10000);
       });
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
}
//USER VALIDATE
function validateUser(stat,uid)
{
	new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'userValidate',uid: uid,stat: stat},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    //document.getElementById('validation').innerHTML	=	response;
		$('#validation-success').fadeIn(1000, function() {
           window.setTimeout ( function() {
             $('#validation-success').fadeOut(1000, function() { 
              }) }
             , 10000);
       });
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });
}

//FOR COMPANY LIST
   function companylist(page)
  {
	  
	  document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:200px;margin-bottom:200px"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  //  $("#left-col").empty().html('<img src="loading.gif" />');
	
		
	

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'companylist',page: page },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   //FOR EVENT LIST
   function eventlist(page)
  {
	  
	  document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:100px"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  //  $("#left-col").empty().html('<img src="loading.gif" />');
	
		
	

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'eventlist',page: page },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
    //FOR USER LIST
   function userlist(page)
   {
	  
	  document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:200px;margin-bottom:200px"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  //  $("#left-col").empty().html('<img src="loading.gif" />');
	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'userlist',page: page },
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
  //######################################
  //SUPPLIERS SERCH
  //######################################
  function supplier_search()
  { 
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'supplier_search',suppid: suppid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
  //######################################
  //USER DELETE
  //######################################
  function delete_user(uid)
  { alert(uid);
	   new Ajax.Request('travelproajax.php',
       {
		method:'post',
		parameters: {action: 'delete_user',uid: uid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    location.reload(true);
	    //document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
   //SUPPLIER SEARCH NEW METHOS
  function supplier_newload(id,supid)
  {
	   new Ajax.Request('travelproajax.php',
       {
		method:'post',
		parameters: {action: 'supplier_newload',id: id,supid: supid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   //SUPPLIER COUNTRY SEARCH NEW METHOS
  function suppliercoun_newload(id,supid,subcountryid)
  { 
	   new Ajax.Request('travelproajax.php',
       {
		method:'post',
		parameters: {action: 'suppliercoun_newload',id: id,supid: supid,subcountryid: subcountryid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    document.getElementById('selectsubcountry').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
  //SUPPLIER LOAD NEW
   function supplierload_new(id,subid,subcountryid,idname,subname,subcountryname)
  {
	  document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:200px;margin-bottom:200px;"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  	//FOR TEXT SEARCH
		var cname=document.getElementById("searchname").value;
		var page=1;
		var x="";
		var cityname="";
		var cityid=0;
		var y="";
		var suppname="";
		var suppid=0;
		var z="";
		var subsuppname="";
		var subsuppid=0;
		var c="";
		var subcounname="";
		var subcounid=0;
	
		
		
		//FOR CITY ID AND NAME
		x=document.getElementById("City");
		cityname=x.options[x.selectedIndex].text;
		cityid=x.options[x.selectedIndex].value;
		//FOR SUPPLIER ID AND NAME
		//alert($("#SubSupp").val());
		suppname=idname;
		suppid=id;
		//FOR SUPPLIER SUB ID AND NAME
			
			subsuppname=subname;
			subsuppid=subid;
		
		//FOR SUB CONUNTRY
		if(subsuppid!='0')
		{	
			subcounname=subcountryname;
			subcounid=subcountryid;
			//alert(subcounid);
			
		}else
		{
			//subcounname="";
			//subcounid=0;
		}
		
	
		if(subsuppid!='0' && subcounid=='0' && suppid!='6')
		{
			//subcounid=231;
			//subcounname="United Arab Emirates";
			subcounid=0;
			subcounname="All countries";
			
		}
	//	if(suppid!='6')
//		{
//			subcounid=231;
//			subcounname="United Arab Emirates";
//		}
	
		//alert(subcounname);

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'supplier',page: page,cname: cname,cityid: cityid,cityname: cityname,suppid: suppid,suppname: suppname,subsuppid: subsuppid,subsuppname: subsuppname,subcounid: subcounid, subcounname: subcounname},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
   
    //AGENCY SEARCH NEW METHOS
  function agency_newload(id,supid)
  {
	   new Ajax.Request('travelproajax.php',
       {
		method:'post',
		parameters: {action: 'agency_newload',id: id,supid: supid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   //AGENCY COUNTRY SEARCH NEW METHOS
  function agencycoun_newload(id,supid,subcountryid)
  { 
	   new Ajax.Request('travelproajax.php',
       {
		method:'post',
		parameters: {action: 'agencycoun_newload',id: id,supid: supid,subcountryid: subcountryid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    document.getElementById('selectsubcountry').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
     //AGENCY LOAD NEW
   function agencyload_new(id,subid,subcountryid,idname,subname,subcountryname)
  {
	  document.getElementById('right-main').innerHTML	=	'';
	  document.getElementById('right-main').innerHTML	=	'<div align="center" style="margin-top:200px;margin-bottom:200px;"><img src="images/loading_globe.gif" border="0"/></div>';	
	  
	  	//FOR TEXT SEARCH
		var cname=document.getElementById("searchname").value;
		var page=1;
		var x="";
		var cityname="";
		var cityid=0;
		var y="";
		var suppname="";
		var suppid=0;
		var z="";
		var subsuppname="";
		var subsuppid=0;
		var c="";
		var subcounname="";
		var subcounid=0;
	
		
		
		//FOR CITY ID AND NAME
		x=document.getElementById("City");
		cityname=x.options[x.selectedIndex].text;
		cityid=x.options[x.selectedIndex].value;
		//FOR SUPPLIER ID AND NAME
		//alert($("#SubSupp").val());
		suppname=idname;
		suppid=id;
		//FOR SUPPLIER SUB ID AND NAME
			
			subsuppname=subname;
			subsuppid=subid;
		
		//FOR SUB CONUNTRY
		if(subsuppid!='0')
		{	
			subcounname=subcountryname;
			subcounid=subcountryid;
			//alert(subcounid);
			
		}else
		{
			//subcounname="";
			//subcounid=0;
		}
		
	
		if(subsuppid!='0' && subcounid=='0' && suppid!='6')
		{
			//subcounid=231;
			//subcounname="United Arab Emirates";
			subcounid=0;
			subcounname="All countries";
			
		}
	//	if(suppid!='6')
//		{
//			subcounid=231;
//			subcounname="United Arab Emirates";
//		}
	
		//alert(subcounname);

	  new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'agency',page: page,cname: cname,cityid: cityid,cityname: cityname,suppid: suppid,suppname: suppname,subsuppid: subsuppid,subsuppname: subsuppname,subcounid: subcounid, subcounname: subcounname},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('right-main').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
//FOR NEWSLETETR
function news_suppchange(suppid)
  { 
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'new_subSupplier',suppid: suppid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('selectcombo').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
   
function new_Supplier(ptype){ 
    document.getElementById('selectcombo').innerHTML	=	'';
       document.getElementById('selectcombo').innerHTML	=	'<div align="center" style="margin-top:0px"><img src="images/load.gif" border="0"/></div>';	
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'new_Supplier',ptype: ptype},
        onSuccess: function(transport){
        var response = transport.responseText;
	    
	    document.getElementById('selectcombo').innerHTML	=	response;
		//$("#Supp").dropdownchecklist({ icon: {},emptyText: "Select the ones that apply", width: 340,maxDropHeight: 250 }); 
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText)}
     });
}  
  
function news_country(subcounid){
	var y="";
	var suppname ="";
	var suppid=0;
	var z="";
	var subsuppname="";
	var subsuppid=0;
 
  		y=document.getElementById("Supp");
		suppname=y.options[y.selectedIndex].text;
		suppid=y.options[y.selectedIndex].value;
		//FOR SUPPLIER SUB ID AND NAME
		
				z=document.getElementById("SubSupp");
				if(z!=null){
				subsuppname=z.options[z.selectedIndex].text;
				subsuppid=z.options[z.selectedIndex].value;
				}else
				{
					subsuppid=0;
				}
		
			
	   new Ajax.Request('travelproajax.php',
        {
			method:'post',
		parameters: {action: 'news_country',suppid: suppid,subsuppid: subsuppid,subcounid: subcounid},
        onSuccess: function(transport){
        var response = transport.responseText;
	    //alert(response);
	    document.getElementById('newsletterto').innerHTML	=	response;			
       },
        onFailure: function(transport){ alert('Something went wrong...'+transport.responseText) }
     });

   }
  
