<!--
var ts = '';
var bastar = '';
var bittar = '';
var siradakiodano = 0;//ajaxsrcden oku
//var hotid = displayItem("id");

/////////////////////////////////////////////////////////////////////////
function roomNum(odasayi)
{
	if(odasayi == "1")
	{
		document.getElementById("spOda1").style.display = 'none' ;
		roomShowHide("8","none");
	}
	else
	{
		document.getElementById("spOda1").style.display = '' ;
		roomShowHide(odasayi,"");
	}
}
function roomShowHide(lastindex,display)
{

	for(i=2;i<=parseInt(lastindex);i++)
	{
		document.getElementById("trOda" + i).style.display = display ;
	}
	if(parseInt(lastindex)<8)
	{
		for(i=parseInt(lastindex)+1;i<=8;i++)
		{
			document.getElementById("trOda" + i).style.display = (display == "none") ? "" : "none" ;
		}
	}
}
function ageNum(odasayi,cocsayi)
{
	if(cocsayi == 0)
	{
		ageShowHide("3",odasayi,"none");
	}
	else
	{
		ageShowHide(cocsayi,odasayi,"");
	}
}
function ageShowHide(lastindex,odasayi,display)
{

	for(i=1;i<=parseInt(lastindex);i++)
	{
		document.getElementById("spYas" + odasayi + i).style.display = display ;
	}
	if(parseInt(lastindex)<3)
	{
		for(i=parseInt(lastindex)+1;i<=3;i++)
		{
			document.getElementById("spYas" + odasayi + i).style.display = (display == "none") ? "" : "none" ;
		}
	}
}
/////////////////////////////////////////////////////////////////////////
function strAdultNum(odasayi)
{
	tmp = "";
	var tmpObj = null;
	for(i=1;i<=parseInt(odasayi);i++)
	{
		tmpObj = document.getElementById("ddAdult" + i);
		tmp += tmpObj.options[tmpObj.selectedIndex].value + ",";
	}
	if(tmp != "")tmp = tmp.substring(0,tmp.length-1);
	return tmp;
}
function strChildNum(odasayi)
{
	tmp = "";
	var tmpObj = null;
	for(i=1;i<=parseInt(odasayi);i++)
	{
		tmpObj = document.getElementById("ddChild" + i);
		tmp += tmpObj.options[tmpObj.selectedIndex].value + ",";
	}
	if(tmp != "")tmp = tmp.substring(0,tmp.length-1);
	return tmp;
}
function strAgeNum(odasayi)
{
	var tmp = "";
	var tmpObj = null;
	var tmpObj2 = null;
	var cocsayi = 0;
	for(i=1;i<=parseInt(odasayi);i++)
	{	
		tmpObj = document.getElementById("ddChild" + i);
		cocsayi = tmpObj.options[tmpObj.selectedIndex].value;
		for(j=1;j<=parseInt(cocsayi);j++)
		{
			tmpObj2 = document.getElementById("ddYas" + i + j);
			tmp += i + "," + j + "," + tmpObj2.options[tmpObj2.selectedIndex].value + "|";
		}
	}
	if(tmp != "")tmp = tmp.substring(0,tmp.length-1);
	return tmp;
}

/////////////////////////////////////////////////////////////////////////
function araSbmt1(reqodasira,bookodaid,reqodaids)
{
	if(!validDate())
	{
		alert('Check-in date must be further than today.');
		return false;
	}
	else if(Trim(document.getElementById('BaslaTarih').value)== '')
	{
		alert('Please select check-in date.');
		return false;
	}
	else if(Trim(document.getElementById('BitisTarih').value)== '')
	{
		alert('Please select check-out date.');
		return false;
	}
	else if(!validDate1())
	{
		alert('Check-out date must be further than check-in date.');
		return false;
	}
	else
	{
		siradakiodano = reqodasira;
		bastar = document.getElementById('BaslaTarih').value;
		bittar = document.getElementById('BitisTarih').value;
		odasayi = document.getElementById('ddOdaSayi').value;
		
		ads = "&an=" + strAdultNum(odasayi); //adults
		chs = "&cn=" + strChildNum(odasayi); //childs
		ags = "&ag=" + strAgeNum(odasayi); //ages
		reqodasira = "&rqos=" + reqodasira;//requested oda sira
		bookodaid = "&boid=" + bookodaid;//book edilmek istenen oda id
		reqodaids = "&rqoids=" + reqodaids;//requested book ids > 13,14 ..
		
		ts = 'bt='+document.getElementById('BaslaTarih').value+'&st='+document.getElementById('BitisTarih').value;
		document.getElementById('tbOda').style.display = '';
		document.getElementById('spOdaBekle').innerHTML = '<IMG src=\"admin/images/loading.gif\" border=\"0\">&nbsp;Loading rooms. Please wait...</SPAN> </SPAN>';
		document.getElementById('spOdaBekle').style.display = '';
		location.href = '#home';
		//document.getElementById('spOdaTable').style.display = '';
		//document.getElementById('tbKisi').style.display = 'none';
		//document.getElementById('tbFiyat').style.display = 'none';
		//alert(ts+ads+chs+ags+reqodasira+bookodaid+reqodaids);
		call_async('spOdaBekle',ts+ads+chs+ags+reqodasira+bookodaid+reqodaids,'1',odasayi);
	}
}
function prepQuery()
{
	bastar = document.getElementById('BaslaTarih').value;
	bittar = document.getElementById('BitisTarih').value;
	odasayi = document.getElementById('ddOdaSayi').value;
	ads = "&an=" + strAdultNum(odasayi); //adults
	chs = "&cn=" + strChildNum(odasayi); //childs
	ags = "&ag=" + strAgeNum(odasayi); //ages
	reqodasira = "&rqos=";//requested oda sira
	bookodaid = "&boid=";//book edilmek istenen oda id
	reqodaids = "&rqoids=";//requested book ids > 13,14 ..
	
	ts = 'bt='+document.getElementById('BaslaTarih').value+'&st='+document.getElementById('BitisTarih').value;
	
	return ts+ads+chs+ags+reqodasira+bookodaid+reqodaids;
}
function remoteStart(bastar,bittar,odasayi,adultsayi,childsayi,childyas)
{
	document.getElementById('BaslaTarih').value = bastar;
	document.getElementById('BitisTarih').value = bittar;
	
	document.getElementById('ddOdaSayi').selectedIndex = odasayi - 1;
	roomNum(odasayi);
	
	var anum = new Array();
	anum = adultsayi.split(',');
	for(i=0;i<anum.length;i++)
		document.getElementById('ddAdult' + (i+1)).selectedIndex = anum[i] - 1;
	
	var agnum = new Array();
	var cnum = new Array();
	cnum = childsayi.split(',');
	for(j=0;j<cnum.length;j++)
	{
		document.getElementById('ddChild' + (j+1)).selectedIndex = cnum[j];
		ageNum((j+1),cnum[j]);
		
		if(childyas != ''){
			for(k=0;k<parseInt(cnum[j]);k++)
			{
				agnum = childyas.split('|')[k];
				
				if(parseInt(cnum[j]) > 0)
					document.getElementById('ddYas' + agnum.split(',')[0] + agnum.split(',')[1]).selectedIndex = agnum.split(',')[2];
			}
		}
	}
	
	araSbmt1('1','0','');
}

function popRoomDet(oid)
{
	window.open('PopRoomDet.aspx?id='+oid,'','width=400,height=200,scrollbars=2');
}

function validDate()
{
	bastar = document.getElementById('BaslaTarih').value;
	
	var l_dt = new Date();
	var today = Date.UTC( l_dt.getFullYear(), l_dt.getMonth()+1, l_dt.getDate());
	var secondDate1 = new Date(bastar.split('/')[2],bastar.split('/')[1]-1,bastar.split('/')[0]);
	var secondDate = Date.UTC( secondDate1.getFullYear(), secondDate1.getMonth()+1, secondDate1.getDate());
	
	if(today>secondDate)return false;
	else return true;
}

function validDate1()
{
	bastar = document.getElementById('BaslaTarih').value;
	bittar = document.getElementById('BitisTarih').value;
	
	var firstDate1 = new Date(bastar.split('/')[2],bastar.split('/')[1]-1,bastar.split('/')[0]);
	//var firstDate = Date.UTC( firstDate1.getFullYear(), firstDate1.getMonth()+1, firstDate1.getDate());
	var firstDate = Date.parse( (firstDate1.getMonth()+1)+"-"+firstDate1.getDate()+"-"+ firstDate1.getFullYear());
	//alert(firstDate);
	var secondDate1 = new Date(bittar.split('/')[2],bittar.split('/')[1]-1,bittar.split('/')[0]);
	//var secondDate = Date.UTC( secondDate1.getFullYear(), secondDate1.getMonth()+1, secondDate1.getDate());
	var secondDate = Date.parse( (secondDate1.getMonth()+1)+"-"+secondDate1.getDate()+"-"+ secondDate1.getFullYear());
	//alert(secondDate);
	if(firstDate>=secondDate)return false;
	else return true;
}
//-->