/********************************************************************************************/
/* AJAX Simple Tabs by developersnippets, This code is intended for practice purposes.      */
/* You may use these functions as you wish, for commercial or non-commercial applications,  */
/* but please note that the author offers no guarantees to their usefulness, suitability or */
/* correctness, and accepts no liability for any losses caused by their use.                */
/********************************************************************************************/

var req;
function callPage(pageUrl, divElementId, loadinglMessage, pageErrorMessage) {
     document.getElementById(divElementId).innerHTML = loadinglMessage;
     try {
     req = new XMLHttpRequest(); /* e.g. Firefox */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");  /* some versions IE */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
         } catch (E) {
          req = false;
         } 
       } 
     }
     req.onreadystatechange = function() {responsefromServer(divElementId, pageErrorMessage);};
     req.open("GET",pageUrl,true);
     req.send(null);
  }

function responsefromServer(divElementId, pageErrorMessage) {
   var output = '';
   if(req.readyState == 4) {
      if(req.status == 200) {
         output = req.responseText;
         document.getElementById(divElementId).innerHTML = output;
         } else {
         document.getElementById(divElementId).innerHTML = pageErrorMessage+"\n"+output;
         }
      }
  }
  
/* This Function is for Tab Panels */
function activeTab(tab, hotel_id)
	{   
		document.getElementById("tab1").className = "";
		document.getElementById("tab2").className = "";
		document.getElementById("tab3").className = "";
		document.getElementById("tab"+tab).className = "active";
		var url="http://www.royalsrajasthanonwheels.com/newCms/cms/image_listing.php?hotel_id="+ hotel_id;
		//alert('hotel_id'+ url);
		if(tab == 1) // If your tabs are more, then you can use 'switch' condition instead of 'if' condition for better practice
		{callPage(url+'&display=overview', 'content', '<img src="http://www.royalsrajasthanonwheels.com/newCms/images/loading.gif" /> Content is loading, Please Wait...', 'Error in Loading page <img src="http://www.royalsrajasthanonwheels.com/newCms/images/error_caution.gif" />');
		}else if(tab == 2){
		callPage(url+'&display=facilities', 'content', '<img src="http://www.royalsrajasthanonwheels.com/newCms/images/loading.gif" /> Content is loading, Please Wait...', 'Error in Loading page <img src="http://www.royalsrajasthanonwheels.com/newCms/images/error_caution.gif" />');
		}else
		callPage(url+'&display=map', 'content', '<img src="http://www.royalsrajasthanonwheels.com/newCms/images/loading.gif" /> Content is loading, Please Wait...', 'Error in Loading page <img src="http://www.royalsrajasthanonwheels.com/newCms/images/error_caution.gif" />');
	}
	
/* This Function is for Tab Panels */
function paging(cat_id, pageid, field)
	{   

		var url="http://www.indianholiday.com.ua/newCms/cms/image_listing.php?p="+ pageid+"&cat_id="+ cat_id+"&field="+ field ;
		//alert('hotel_id'+ url);
		callPage(url, 'hotel_page', '<img src="http://www.indianholiday.com.ua/newCms/images/loading.gif" />', 'Error in Loading page <img src="http://www.indianholiday.com.ua/newCms/images/error_caution.gif" />');
	}	
	
	function tour_paging(cat_id, pageid, field)
	{   

		var url="http://www.indianholiday.com.ua/newCms/cms/image_listing.php?tour_p="+ pageid+"&cat_id="+ cat_id+"&tour_field="+ field ;
		alert('hotel_id'+ url);
		callPage(url, 'tour_page', '<img src="http://www.indianholiday.com.ua/newCms/images/loading.gif" />', 'Error in Loading page <img src="http://www.indianholiday.com.ua/newCms/images/error_caution.gif" />');
	}	
	
/*This Function is for Tab Panels */
function image(image_id, main_cat_id )
	{   
 	var url="http://www.indianholiday.com.ua/newCms/cms/image_listing.php?image_id="+ image_id+"&image_cat_id="+ main_cat_id;
		//alert('hotel_id'+ url);
		callPage(url, 'big_image', '<img src="http://www.indianholiday.com.ua/newCms/images/loading.gif" />', 'Error in Loading page <img src="http://www.indianholiday.com.ua/newCms/images/error_caution.gif" />');
	}		
	
function packageimage(image_id, main_cat_id )
	{   
 	var url="http://www.indianholiday.com.ua/template/tours/tour_detail.php?image_id1="+ image_id+"&image_cat_id="+ main_cat_id;
		//alert('hotel_id'+ url);
		callPage(url, 'big_image', '<img src="http://www.indianholiday.com.ua/newCms/images/loading.gif" />', 'Error in Loading page <img src="http://www.indianholiday.com.ua/newCms/images/error_caution.gif" />');
	}	
	function hotelimage(image_name, hotel_id)
	{   
 	var url="http://www.indianholiday.com.ua/template/hotels/hotel_details.php?image_name="+ image_name+"&hotel_id="+ hotel_id;
		//alert('hotel_id'+ url);
		callPage(url, 'big_image', '<img src="http://www.indianholiday.com.ua/newCms/images/loading.gif" />', 'Error in Loading page <img src="http://www.indianholiday.com.ua/newCms/images/error_caution.gif" />');
	}	
	
	function newtourimage(image_name, package_id)
	{   
 	var url="http://www.indianholiday.com.ua/template/tours/tour_detail.php?image_name="+ image_name+"&package_id="+ package_id;
		//alert('hotel_id'+ url);
		callPage(url, 'big_image', '<img src="http://www.indianholiday.com.ua/newCms/images/loading.gif" />', 'Error in Loading page <img src="http://www.indianholiday.com.ua/newCms/images/error_caution.gif" />');
	}	
