//** Tab Content script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)

//** Last updated: Nov 8th, 06



var enabletabpersistence=1 //enable tab persistence via session only cookies, so selected tab is remembered?



////NO NEED TO EDIT BELOW////////////////////////

var tabcontentIDs=new Object()



function expandcontent(linkobj){

var ulid=linkobj.parentNode.parentNode.id //id of UL element

var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents

for (var i=0; i<ullist.length; i++){

ullist[i].className=""  //deselect all tabs

if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)

document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents

}

linkobj.parentNode.className="selected"  //highlight currently clicked on tab

document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content

saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))

}



function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)

var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]

if (thetab.getAttribute("rel"))

expandcontent(thetab)

}



function savetabcontentids(ulid, relattribute){// save ids of tab content divs

if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet

tabcontentIDs[ulid]=new Array()

tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute

}



function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
var r255=document.getElementById("r255");
var	r275=document.getElementById("r275");
var	r290=document.getElementById("r290");
	
var	r125=document.getElementById("r125");
var	r150=document.getElementById("r150");
var	r165=document.getElementById("r165");
	
var	rr125=document.getElementById("rr125");
var	rr150=document.getElementById("rr150");
var	rr165=document.getElementById("rr165");
	
var	single26=document.getElementById("single26");
var	single27=document.getElementById("single27");
var	single28=document.getElementById("single28");
var	single29=document.getElementById("single29");
	
var	double26=document.getElementById("double26");
var	double27=document.getElementById("double27");
var	double28=document.getElementById("double28");
var	double29=document.getElementById("double29");
	
var	doublekolesz26=document.getElementById("doublekolesz26");
var	doublekolesz27=document.getElementById("doublekolesz27");
var	doublekolesz28=document.getElementById("doublekolesz28");
var	doublekolesz29=document.getElementById("doublekolesz29");

var reg,reghu,acco,accohu,hotel,hotelhu,total,totalhu = 0;

if (selectedtabid=="felh_tcontent3")

{
	reg=0;
    reghu=0;
    
	if(r255.checked){ reg=reg+parseFloat(r255.value); reghu=reghu+65000;}
	if(r275.checked){ reg=reg+parseFloat(r275.value); reghu=reghu+70000;}
	if(r290.checked){ reg=reg+parseFloat(r290.value); reghu=reghu+74000;}
	if(r125.checked){ reg=reg+parseFloat(r125.value); reghu=reghu+32000;}
	if(r150.checked){ reg=reg+parseFloat(r150.value); reghu=reghu+38000;}
	if(r165.checked){ reg=reg+parseFloat(r165.value); reghu=reghu+42000;}
	
	document.getElementById("regvalue").innerHTML=reg;}
	document.getElementById("reghuvalue").innerHTML=reghu;

{
	acco=0;
	accohu=0;
	if(rr125.checked){ acco=acco+parseFloat(rr125.value); accohu+=32000;}
	if(rr150.checked){ acco=acco+parseFloat(rr150.value); accohu+=38000;}
	if(rr165.checked){ acco=acco+parseFloat(rr165.value); accohu+=42000;}
	
	document.getElementById("accovalue").innerHTML=acco;
	document.getElementById("accohuvalue").innerHTML=accohu;
}

{
	hotel=0;
	hotelhu=0;
	if(single26.checked){ hotel=hotel+parseFloat(single26.value); hotelhu+=14050;}
	if(single27.checked){ hotel=hotel+parseFloat(single27.value); hotelhu+=14050;}
	if(single28.checked){ hotel=hotel+parseFloat(single28.value); hotelhu+=14050;}
	if(single29.checked){ hotel=hotel+parseFloat(single29.value); hotelhu+=14050;}
	if(double26.checked){ hotel=hotel+parseFloat(double26.value); hotelhu+=16700;}
	if(double27.checked){ hotel=hotel+parseFloat(double27.value); hotelhu+=16700;}
	if(double28.checked){ hotel=hotel+parseFloat(double28.value); hotelhu+=16700;}
	if(double29.checked){ hotel=hotel+parseFloat(double29.value); hotelhu+=16700;}
	if(doublekolesz26.checked){ hotel=hotel+parseFloat(doublekolesz26.value); hotelhu+=4900;}
	if(doublekolesz27.checked){ hotel=hotel+parseFloat(doublekolesz27.value); hotelhu+=4900;}
	if(doublekolesz28.checked){ hotel=hotel+parseFloat(doublekolesz28.value); hotelhu+=4900;}
	if(doublekolesz29.checked){ hotel=hotel+parseFloat(doublekolesz29.value); hotelhu+=4900;}
	
	document.getElementById("hotelvalue").innerHTML=hotel;
	document.getElementById("hotelhuvalue").innerHTML=hotelhu;
}

{
	total=0;
	totalhu=0;
	if(r255.checked){ total=total+parseFloat(r255.value); totalhu+=65000;}
	if(r275.checked){ total=total+parseFloat(r275.value); totalhu+=70000;}
	if(r290.checked){ total=total+parseFloat(r290.value); totalhu+=74000;}
	if(r125.checked){ total=total+parseFloat(r125.value); totalhu+=32000;}
	if(r150.checked){ total=total+parseFloat(r150.value); totalhu+=38000;}
	if(r165.checked){ total=total+parseFloat(r165.value); totalhu+=42000;}
	if(rr125.checked){ total=total+parseFloat(rr125.value); totalhu+=32000;}
	if(rr150.checked){ total=total+parseFloat(rr150.value); totalhu+=38000;}
	if(rr165.checked){ total=total+parseFloat(rr165.value); totalhu+=42000;}
	if(single26.checked){ total=total+parseFloat(single26.value); totalhu+=14050;}
	if(single27.checked){ total=total+parseFloat(single27.value); totalhu+=14050;}
	if(single28.checked){ total=total+parseFloat(single28.value); totalhu+=14050;}
	if(single29.checked){ total=total+parseFloat(single29.value); totalhu+=14050;}
	if(double26.checked){ total=total+parseFloat(double26.value); totalhu+=16700;}
	if(double27.checked){ total=total+parseFloat(double27.value); totalhu+=16700;}
	if(double28.checked){ total=total+parseFloat(double28.value); totalhu+=16700;}
	if(double29.checked){ total=total+parseFloat(double29.value); totalhu+=16700;}
	if(doublekolesz26.checked){ total=total+parseFloat(doublekolesz26.value); totalhu+=4900;}
	if(doublekolesz27.checked){ total=total+parseFloat(doublekolesz27.value); totalhu+=4900;}
	if(doublekolesz28.checked){ total=total+parseFloat(doublekolesz28.value); totalhu+=4900;}
	if(doublekolesz29.checked){ total=total+parseFloat(doublekolesz29.value); totalhu+=4900;}
	
	document.getElementById("totalcost").innerHTML=total;
	document.getElementById("totalhucost").innerHTML=totalhu;
	document.getElementById("totalpay").innerHTML=total;
	document.getElementById("totalhupay").innerHTML=totalhu;
}

if (enabletabpersistence==1) //if persistence feature turned on

setCookie(ulid, selectedtabid)

}



function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content

var ullist=document.getElementById(ulid).getElementsByTagName("li")

for (var i=0; i<ullist.length; i++){

if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){

return ullist[i].getElementsByTagName("a")[0]

break

}

}

}



function initializetabcontent(){

for (var i=0; i<arguments.length; i++){ //loop through passed UL ids

if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off

setCookie(arguments[i], "")

var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any

var ulobj=document.getElementById(arguments[i])

var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL

for (var x=0; x<ulist.length; x++){ //loop through each LI element

var ulistlink=ulist[x].getElementsByTagName("a")[0]

if (ulistlink.getAttribute("rel")){

savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs

ulistlink.onclick=function(){

expandcontent(this)

return false

}

if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default

expandcontent(ulistlink) //auto load currenly selected tab content

}

} //end inner for loop

if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value

var culistlink=getullistlinkbyId(arguments[i], clickedontab)

if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value

expandcontent(culistlink) //auto load currenly selected tab content

else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)

expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead

}

} //end outer for loop

}





function getCookie(Name){ 

var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair

if (document.cookie.match(re)) //if cookie found

return document.cookie.match(re)[0].split("=")[1] //return its value

return ""

}



function setCookie(name, value){

document.cookie = name+"="+value //cookie value is domain wide (path=/)

}