
var req;
function callPage(pageUrl, divElementId, loadinglMessage, pageErrorMessage,image) {
     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,image);};
     req.open("GET",pageUrl,true);
     req.send(null);
     
     
  }

function responsefromServer(divElementId, pageErrorMessage,image) {
   var output = '';

   if(req.readyState == 4) {
      if(req.status == 200) {
       
         output = req.responseText;
         document.getElementById(divElementId).innerHTML = output;
       
         if(image!=null)
          resimyaz(image);
  
      } else {
         document.getElementById(divElementId).innerHTML = pageErrorMessage+"\n"+output;
         }
      }
  }
  
function resimyaz(xxx)
{
    var fo = new FlashObject('gallery.swf?xxx='+xxx, "intro", "534", "484", "8", "#ffffff");
    fo.addParam("allowScriptAccess", "sameDomain");
    fo.addParam("quality", "high");
    fo.addParam("menu", "false");
    fo.write("dvPhotos");
}

  
///Tur ayrıntıları tabları
function activeTab(tab)
	{
	    usttengelentid = displayItem('tid');
	    usttengelenhid = displayItem('hid');
	    if(usttengelentid!="")
	     image="tid"+usttengelentid;
	    else 
	    image="hid"+usttengelenhid;
	    
	//alert(image);
		/*document.getElementById("tab1").className = "";
		document.getElementById("tab2").className = "";
		document.getElementById("tab3").className = "";
		document.getElementById("tab4").className = "";
		document.getElementById("tab5").className = "";
		document.getElementById("tab6").className = "";
		document.getElementById("tab"+tab).className = "current";*/

		if(tab == 1)
		{
		callPage('TourContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />',null);
		}
		else if(tab == 2)
		{
		callPage('TourContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />',null);
		}
		else if(tab==3)
		{
		callPage('TourContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />',image);
	    }
	    else if(tab==4)
	    {
	    callPage('TourContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />');
	    }
	    else if(tab==5)
	    {
	    callPage('TourContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />');
	    }
	    else if (tab==6)
	    {
	    callPage('TourContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />');
	    }
	}
	
	///Hotel Ayrıntıları tabları
	function activeTabHotel(tab)
	{   
	  usttengelentid = displayItem('tid');
	    usttengelenhid = displayItem('hid');
	    if(usttengelentid!="")
	     image="tid"+usttengelentid;
	    else 
	    image="hid"+usttengelenhid;
		/*document.getElementById("tab1").className = "";
		document.getElementById("tab2").className = "";
		document.getElementById("tab3").className = "";
		document.getElementById("tab"+tab).className = "current";*/
		
		if(tab == 1)
		{
		callPage('HotelContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />');
		}
		else if(tab == 2)
		{
		callPage('HotelContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />',image);
		}
		else if(tab==3)
		{
		callPage('HotelContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />');
	    }	   
	}
	
	///Rentacar Ayrıntıları tabları
	function activeTabCar(tab)
	{   
	    usttengelentid = displayItem('tid');
	    usttengelenhid = displayItem('hid');
	    if(usttengelentid!="")
	     image="tid"+usttengelentid;
	    else 
	    image="hid"+usttengelenhid;
		document.getElementById("tab1").className = "";
		document.getElementById("tab2").className = "";
		document.getElementById("tab3").className = "";
		document.getElementById("tab"+tab).className = "current";
		
		if(tab == 1)
		{
		callPage('RentACarContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />');
		}
		else if(tab == 2)
		{
		callPage('RentACarContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />');
		}
		else if(tab==3)
		{
		callPage('RentACarContent.aspx?tab='+tab, 'content', '<img src=\"images/loading.gif\" /> Content is loading, Please Wait...', 'Error in Loading page <img src=\"images/error_caution.gif\" />');
	    }	   
	}
	
	
	
////////////////////////////////////////////////////////
function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }	
}
function queryString(key){
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}
function displayItem(key){
	if(queryString(key)=='false') 
	{
		//result.innerHTML="you didn't enter a ?name=value querystring item.";
		return "";
	}else{
		//result.innerHTML+=queryString(key)+"<BR>";
		return queryString(key);
	}
}
////////////////////////////////////////////////////////