var opens = new Array();
var ts = new Array();
var wtime = 300;

function restore_(){
	for(i=1;i<=imgs.length;i++)if(opens["m"+i]){
		x1 = find_("i"+i);
		x1.src=x1.oSrc;
		ts['m'+i] = setTimeout("clear('m"+i+"')", wtime);
	}
}
function clear(id){
	cnt = id.substring(1);
	clearTimeout(ts[id]);
	if((x =find_(id))!=null)x.style.display='none';
	y = find_("i"+cnt)
	y.src=y.oSrc
}
	  	
function preload_(){
  var d=document; if(d.images){ if(!d.im) d.im=new Array();
    var i,j=d.im.length,a=imgs; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){d.im[j]=new Image; d.im[j++].src=imgn(a[i]);}}
}

function find_(n,d){
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=find_(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swap_(obj){
	cnt = obj.substring(1);
	clearTimeout(ts["m"+cnt]);
	x1 = find_(obj);
	if(!x1.oSrc)x1.oSrc=x1.src;
	x1.src=imgn(imgs[cnt-1]);
	if((y = find_("m"+cnt))!=null){
		y.style.top=(gettop(x1)+34)+"px";
		y.style.left =(getleft(x1)+15)+"px";
		y.style.display='block';
	}
	opens["m"+cnt]=1;
}

function onmenu(o){
	cnt = o.id.substring(1);
	clearTimeout(ts["m"+cnt]);
	x =find_("i"+cnt);
	x.src = imgn(imgs[cnt-1])
	opens["m"+cnt] = 1 ;
}

function outmenu(o){
	cnt = o.id.substring(1);
	ts["m"+cnt] = setTimeout("clear('m"+cnt+"')", wtime);
}

function imgn(s){
	return '/i/m_'+s+'_s_'+lang+'.gif'
}

function gettop(o){
	var val=0;
	if(o.offsetParent)val=gettop(o.offsetParent);
	return o.offsetTop+val;
}
function getleft(o){
	var val=0;
	if(o.offsetParent)val=getleft(o.offsetParent);
	return o.offsetLeft+val;
}
function chng(obj){
	o1 = find_(obj);
	o2 = find_(obj+'_date');
	if(obj=='arrival'){
		other='departure'; 
		dir=+1;
	}else{
		other = 'arrival';
		dir=-1;
	}
	o3 = find_(other);
	o4 = find_(other+'_date');
	n = find_('nights');
	curd = o2.selectedIndex+dir*(n.selectedIndex+1);
	shm=0;
	curm = o1.options[o1.selectedIndex].value;
	totd = getdays(parseInt(curm.substr(5)),parseInt(curm.substring(0,4)));
	if(curd>=totd){
		curd=curd-totd;
		shm=1;
	}
	o4.selectedIndex=curd;
	o3.selectedIndex = o1.selectedIndex+dir*shm;
}

function getdays(month, year) {
  var ar = new Array(12);
  ar[1] = 31; 
  ar[2] = (year % 4 == 0) ? 29 : 28; 
  ar[3] = 31; 
  ar[4] = 30; 
  ar[5] = 31; 
  ar[6] = 30; 
  ar[7] = 31; 
  ar[8] = 31; 
  ar[9] = 30;
  ar[10] = 31; 
  ar[11] = 30; 
  ar[12] = 31; 
  return ar[month];
}

function chn(){return false}

var timer; var clocktext; var dateObj ;
function clock(){ timer = setTimeout("updateclock()",1000); o = find_('time'); clocktext = o.innerHTML;}
function updateclock(){ dateObj = new Date(); 
hour = dateObj.getHours()-1;if(hour<0)hour=24+hour;if(hour<10)hour="0"+hour; minute = dateObj.getMinutes();if(minute<10)minute="0"+minute;
newtext = hour +":"+ minute; o = find_('time');if(newtext!=o.innerHTML)o.innerHTML=newtext; 
timer = setTimeout("updateclock()",1000); }

function chntab(i){
	if(maxtab>1){
		for(j=1;j<=maxtab;j++){
			o=find_('t'+j);
			if(j==i)o.className = 's';
			else o.className ='';
			o=find_('tt'+j);
			if(j==i)o.style.display='block';
			else o.style.display='none';
		}
	}
	return false	
}