mDay = new Array();
mDay['1']=31;
mDay['2']=28;
mDay['3']=31;
mDay['4']=30;
mDay['5']=31;
mDay['6']=30;
mDay['7']=31;
mDay['8']=31;
mDay['9']=30;
mDay['10']=31;
mDay['11']=30;
mDay['12']=31;

function GetCountryResort(resort){
    i = 1;
    fl = false;
    while ((i < ccoid.length)&&(!fl))
        if (ccuname[i] == resort){
            document.searchfrm.r.value = ccuid[i];
            document.searchfrm.c.value = ccoid[i];
            fl = true;
        }else i++;
    document.searchfrm.submit();
}
function SetCalendarDate(id, num)
{
    currentDate=new Date();
    currentDay=currentDate.getDate();
    currentMonth=currentDate.getMonth()+1;
    currentYear=currentDate.getYear();
    var sel = document.getElementById(id);
    if((currentDay+num)>mDay[currentMonth]){
        currentDay = (currentDay+num)-mDay[currentMonth];
        currentMonth = currentMonth+1;
        if(currentMonth>12)
        {
            currentMonth=1;
            currentYear++;
        }
        sel.value = currentDay+"."+currentMonth+"."+currentYear;
    }else sel.value = (currentDay+num)+"."+currentMonth+"."+currentYear;
}
function SetDate(name,name2,num){
	dd    = eval(document.getElementById(name));
	m    = eval(document.getElementById(name2));

	currentDate=new Date();
	currentDay=currentDate.getDate();
	currentMonth=currentDate.getMonth()+1;

	if((currentDay+num)>mDay[currentMonth]){

		currentDay = (currentDay+num)-mDay[currentMonth];
		currentMonth = currentMonth+1;
		if(currentMonth>12) currentMonth=1;
		dd.selectedIndex = currentDay-1;
		m.selectedIndex = currentMonth-1;

	}else{
		dd.selectedIndex = currentDay+num-1;
		m.selectedIndex = currentMonth-1;
	}

    $day = getvar('Dayw');
	if ($day != '')
	{
		dd.selectedIndex = $day - 1;
	}
    $month = getvar('Monthw');
	if ($month != '')
	{
		m.selectedIndex = $month - 1;
	}
}
function Month2day(name,name2){

   dd = document.getElementById(name);
   val = dd.value;
   selected = false;
   mon  = document.getElementById(name2);
   dn = mDay[mon.options[mon.selectedIndex].value]
   dd.options.length = dn;
   for(i = 0; i < dn ; i++){
   	opt = new Option();
	opt.value = i + 1;
	opt.text = i + 1;
	dd.options[i] = opt;
    if (dd.options[i].value == val){
        dd.options[i].selected = true;
        selected = true;
    }
   }
   if (!selected) dd.options[dd.options.length-1].selected = true;
}

function Con2Cur(name,name2){

   dd    = document.getElementById(name);
   mon  = document.getElementById(name2);
   dd.options.length = 0;
	opt = new Option();
	opt.value = 0;
	opt.text =  ",ίΕ";
	dd.options[dd.options.length ] = opt;
if(mon != null)
   for(i = 1; i < CuCo.length ; i++){
	if(CuCo[i] == mon.options[mon.selectedIndex].value){	
   		opt = new Option();
		opt.value = CuId[i];
		opt.text =  CuNa[i];
		dd.options[dd.options.length ] = opt;
	}
   }	
}
function Raz2Child(name,name2,name3){
    dd   = document.getElementById(name);
    ch1  = document.getElementById(name2);
    ch2  = document.getElementById(name3);
	ch1.disabled=false;
	ch2.disabled=false;

	if (dd.options[dd.selectedIndex] != null ){
		vv = dd.options[dd.selectedIndex].value;
		if( (vv == 1) || (vv == 2) || (vv == 14) ){
			ch1.disabled=true;
			ch2.disabled=true;
		}
		if((vv == 5) || (vv == 7) || (vv == 11) ){
			ch2.disabled=true;
		}
	}

}
