var roomPanelLabel	= "";
var adultPanelLabel = "";
var senioPanelLabel = null;
var childPanelLabel = "";
var cboAdultPanel	= "";
var cboSenioPanel	= null;
var cboChildPanel	= "";
var roomOffsetPanelLabel = "";

var showRoom1 = 8;
 var showChild = 6;
 var ageFrame = "";
 var cboAgePanel = "";
 var roomAgePanelLabel = "";
 
 function getObj(objID)
 {
 if (document.getElementById) {return document.getElementById(objID);}
 else if (document.all) {return document.all[objID];}
 else if (document.layers) {return document.layers[objID];}
 }
 
 function TogDisp(obj,flg)
 {
	if (obj != null)
	{
		obj.style.display=(flg)?"block":"none";
	}
 }
 function SRm(cr,showRoom)
 {
	//alert(cr+":"+showRoom);
	for (var i=2;i <= showRoom;i++)
	{
		TogDisp(getObj(roomPanelLabel + i),cr >=i);
		TogDisp(getObj(adultPanelLabel + i),cr >=i);
		//if (senioPanelLabel != null && cboSenioPanel != null)
		try
		{
			//alert(senioPanelLabel + i);
			TogDisp(getObj(senioPanelLabel + i),cr >=i);
		}
		catch (oc)
		{}
		TogDisp(getObj(childPanelLabel + i),cr >=i);
		TogDisp(getObj(roomOffsetPanelLabel + i),cr >=i);
		TogDisp(getObj(cboAdultPanel + i),cr >=i);
		if (senioPanelLabel != null && cboSenioPanel != null)
			TogDisp(getObj(cboSenioPanel + i),cr >=i);
		TogDisp(getObj(cboChildPanel + i),cr >=i);
	}
 
	TogDisp(getObj(roomOffsetPanelLabel + 1),cr != 1);
 }
 
 
 function CRms(r,RowChildAges)
 {
	var i,n=0;
	for(i=0;i<r;i++)
	{
		n += parseInt(getObj(RowChildAges[i]).value);
	}
	return n;
 }
 function ShowAges(r,RowChildAges,showRoom)
 {
	var cRms=CRms(r,RowChildAges);
	var dF=getObj(ageFrame);
	if(cRms == 0)
	{
		if(dF!=null)
		dF.style.display="none";
	}
	else
	{
		ShowSels(r,RowChildAges,showRoom);
		if(dF!=null)
		{
			if(dF.style.display=="none")
			{
				dF.style.visibility="hidden";
				dF.style.display="block";
			}
		dF.style.visibility="visible";
		}
	}
 }
 
 function ShowSels(r,RowChildAges,showRoom)
 {
	var da,iRm,iKd,ck;
	for(iRm=0;iRm < showRoom;iRm++)
	{
		var iRmIncr = iRm + 1;
		if(getObj(RowChildAges[iRm])!=null)
		ck=parseInt(getObj(RowChildAges[iRm]).value);
		 
		for(iKd=1;iKd<=showChild;iKd++)
		{
			iKdIncr = iKd;
			if(getObj(cboAgePanel + iRmIncr+iKdIncr)!=null)
				getObj(cboAgePanel + iRmIncr+iKdIncr).style.display=(iKd<=ck)?"block":"none";
		}
		if(getObj(roomAgePanelLabel + iRmIncr)!=null)
			getObj(roomAgePanelLabel + iRmIncr).style.display=(ck>0&&iRmIncr<=r)?"block":"none";
	}
	if(getObj("RmDrp") && getObj("RmDrp").style.display == "none")getObj(roomAgePanelLabel + 1).style.display="none";
 }
function sok(r,RowChildRooms,RowChildAges,showRoom)
{
	SKARI(r,RowChildRooms,RowChildAges,showRoom);
}
function SKAR(r,RowChildRooms,RowChildAges,showRoom)
{
	SKARI(r,RowChildRooms,RowChildAges,showRoom);
}
	 
function SKARI(r,RowChildRooms,RowChildAges,showRoom)
{
	for (iRm=0; iRm < RowChildRooms.length; iRm++)
	{
		try{getObj(RowChildRooms[iRm]).style.display=(iRm+1<=r)?"block":"none";}catch(err){}
	}
	ShowAges(r,RowChildAges,showRoom);
}
function ShowIS(d,s)
{
	d.infant.style.display=(s==1)?"block":"none";
}