function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();
var http2 = createRequestObject();
var http3 = createRequestObject();


function Bookit(PID)
{
	var WHATID
	switch (DataForm.MainPage.value)
    {
    	case "TFW": 
		{ 
			WHATID = 1
			break 
		}
		case "TFWFlight": 
		{ 
			WHATID = 2
			break 
		}
		case "DEALSPACK": 
		{ 
			WHATID = 6
			break 
		}
		case "DEALSFLIGHT": 
		{ 
			WHATID = 18
			break 
		}
	}
	
	top.location.href = 'http://transatservices.clubvoyages.com/Calculator/default.asp?REFERRERID=' + ReferrerName + '&LangID=' + LangID + '&REFWHATID=' + WHATID + '&CSS=&AGENCYID=&PID=' + PID
}

function LoadState()
{
	DataForm = document.forms["DATA"]
}

function overProductHi(num, action, ct)
{
	if (document.getElementById)
	{	
		if (action==1)
		{
			document.getElementById("IMG" + num).src= STATICSERVERURL + 'Ulysse/reservez_ov.gif'

			for (c=1; c!=(ct+1); c++)
			{
				document.getElementById("TD" + num + "-" + c).className = "date_nobold_over"
			}
		}
		else
		{
			document.getElementById("IMG" + num).src= STATICSERVERURL + 'Ulysse/reservez_off.gif'
			for (c=1; c!=(ct+1); c++)
			{
				document.getElementById("TD" + num + "-" + c).className = "date_nobold"
			}
		}
	}
}

//put the cursor in wait mode
function setWaitPointer() 
{ 
	document.body.style.cursor = 'wait'
	//for (var i=0;i < document.all.length; i++) 
		//document.all(i).style.cursor = 'wait'; 
	
		
} 

//put the cursor back in auto mode
function resetPointer() 
{ 
	document.body.style.cursor = ''
	//alert(document.all(67).style.cursor)
	//for (var i=0;i < document.all.length; i++) 
		//document.all(i).style.cursor = ''; 
	//alert(document.all(67).style.cursor)
	
} 

//empiler
function AddToPile(Content, add, HashType, HashInfo)
{
	// process it
		eval(Content)
	/*	
	//Add to the pile
	if (add == 1) //Just add to current
	{
		ProcessPile[InPileNow] += ";" + Content
		
	}
	else
	{
		InPileNow += 1
		//window.location.hash = "#" + InPileNow
		ProcessPile[InPileNow] = Content
		HashSet(HashType, HashInfo)
	}
		//alert("J'ajoute le " + InPileNow + " : " + ProcessPile[InPileNow])
	
	*/
	
}


//Depiler
function BackProcess()
{
	
	//lower pile
		InPileNow -= 1
		//window.location.hash = "#" + InPileNow
		//alert("Je depile le " + InPileNow + " : " + ProcessPile[InPileNow])
	// process it
		eval(ProcessPile[InPileNow])
			
}

//Go forward Firefox only
function ForwardProcess()
{
	
	//lower pile
		InPileNow += 1
		//window.location.hash = "#" + InPileNow
		//alert("Je forward le " + InPileNow + " : " + ProcessPile[InPileNow])
	// process it
		eval(ProcessPile[InPileNow])
			
}

function CheckHash()
{
	//in case hash is not supported
	if (window.location.hash != '#1')
	{
		Hashpart = window.location.hash.substring(1, window.location.hash.length).split('*')
		document.getElementById("debugzone").value = new Date();
		document.getElementById("debugzone2").value = InPileNow
		document.getElementById("debugzone3").value = ProcessPile[InPileNow]
	
		//for IE only
		if (window.location.hash=='#back' && justIn == 0)
		{
			history.go(-8)
		}
		else if (Hashpart[0] > 1)
		{
	
			if (Hashpart[0] != InPileNow)
			{
				RebaseOnHash()
			}
			
		}
		else
		{
			InitLevel2()
		}
	}
}

function RebaseOnHash()
{
	
	Hashpart = window.location.hash.substring(1, window.location.hash.length).split('*')
	InPileNow = Hashpart[0]
	if (Hashpart[1] != '0') //selection hotel
	{	
		HTpart = Hashpart[1].split('-')
		if (document.getElementById('imgHotelFleche' + HTpart[0]))
		{
			SelectHotel(HTpart[0], HTpart[1])
		}
		
	}	
	//alert(Hashpart[2])
	if (Hashpart[2] != '0') //selection FW
	{
		
	}
	else
	{
		document.getElementById("FROMWHEN").innerHTML = ''
	}
}


function HashSet(HashType, HashInfo)
{

	Hashpart = window.location.hash.substring(1, window.location.hash.length)
	if (Hashpart == '1')
		Hashpart = '#1*0*0*0'
	Elem = Hashpart.split('*')
	
	NewHash = ''
	
	//Pile section
			
		NewHash += '#' + InPileNow + '*'
	
	
		if (HashType=='HS')//HS section
			NewHash += HashInfo + '*0*0'
		else 
		if (HashType=='FW')//FW section
			NewHash +=Elem[1] + '*' + HashInfo + '*0'
		else
		if (HashType=='OL')//OL section
			NewHash +=Elem[1] + '*' + Elem[2] + '*' + HashInfo + '*'
		
	
	window.location.hash = NewHash
	ProcessPile[InPileNow] = NewHash
}

function AddPileVar()
{
	InPileNow = InPileNow * 1 + 1
}

function InitLevel2()
{
	if(document.getElementById('Hotelhref' + HOTELEXITID))
	{
		InPileNow = 1
		if (document.getElementById("DETAILSELECTION").innerHTML=='')
		{
			document.getElementById("DETAILSELECTION").innerHTML = DETAILSELECTION
			document.getElementById("DETAILOFFER").innerHTML = ''
			document.getElementById("FROMWHEN").innerHTML = ''
			document.getElementById("OL").innerHTML = ''
			document.getElementById('Hotelhref' + HOTELEXITID).className = 'hotel_list'
			document.getElementById('imgHotelFleche' + HOTELEXITID).src = STATICSERVERURL + 'Ulysse/demi_cercle.gif'
		}
	}
	
}


function seperateTheme()
{
	document.write('</tr><tr>')
	document.write('<tr><td colspan="3" height="12"><span /></td></tr>')
}