 function newImage(arg) {
  	if (document.images) {
  		rslt = new Image();
  		rslt.src = arg;
  		return rslt;
  	}
  }
  function changeImages() {
  	if (document.images && (preloadFlag == true)) {
  		for (var i=0; i<changeImages.arguments.length; i+=2) {
  			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
  		}
  	}
  }  
  var preloadFlag = false;
  function preloadImages() {
  	if (document.images) {
  		b_hotel5_over = newImage("http://www.aaaahotels.com/images/b_hotel5-over.gif");
			b_hotel4_over = newImage("http://www.aaaahotels.com/images/b_hotel4-over.gif");
  		b_hotel3_over = newImage("http://www.aaaahotels.com/images/b_hotel3-over.gif");
			b_hotel2_over = newImage("http://www.aaaahotels.com/images/b_hotel2-over.gif");
			b_pensions_over = newImage("http://www.aaaahotels.com/images/b_pensions-over.gif");
			b_apartments_over = newImage("http://www.aaaahotels.com/images/b_apartments-over.gif");
			b_hostels_over = newImage("http://www.aaaahotels.com/images/b_hostels-over.gif");
  		preloadFlag = true;
  	}
  }

function dnes() {
	var datum=new Date();
	var mesic=datum.getMonth();
	var navratova_hodnota=null;
	var navratova_hodnota_den=null;
	var den=datum.getDate();
	var rok=datum.getYear();
	if (rok < 1000) rok += 1900;
	mesic++;
	
	if (datum.getDay() == 0) {document.write("Sunday, ")}
	if (datum.getDay() == 1) {document.write("Monday, ")}
	if (datum.getDay() == 2) {document.write("Tuesday, ")}
	if (datum.getDay() == 3) {document.write("Wednesday, ")}
	if (datum.getDay() == 4) {document.write("Thursday, ")}
	if (datum.getDay() == 5) {document.write("Friday, ")}
	if (datum.getDay() == 6) {document.write("Saturday, ")}

	if (datum.getMonth() == 0) {document.write("January&nbsp;")}
	if (datum.getMonth() == 1) {document.write("February&nbsp;")}
	if (datum.getMonth() == 2) {document.write("March&nbsp;")}
	if (datum.getMonth() == 3) {document.write("April&nbsp;")}
	if (datum.getMonth() == 4) {document.write("May&nbsp;")}
	if (datum.getMonth() == 5) {document.write("June&nbsp;")}
	if (datum.getMonth() == 6) {document.write("July&nbsp;")}
	if (datum.getMonth() == 7) {document.write("August&nbsp;")}
	if (datum.getMonth() == 8) {document.write("September&nbsp;")}
	if (datum.getMonth() == 9) {document.write("October&nbsp;")}
	if (datum.getMonth() == 10) {document.write("November&nbsp;")}
	if (datum.getMonth() == 11) {document.write("December&nbsp;")}

	document.write(den+",&nbsp;");
	
	navratova_hodnota= rok;
	return(navratova_hodnota);	
	}
	
	
	var hotely=new Array();
	var gradesl=new Array();
	var grades=new Array();
	grades[10]='* * * * *';
	grades[9]='* * * *';
	grades[8]='* * *';
	grades[7]='* *';
	grades[6]='Pensions';
	grades[5]='Apartments';
	grades[4]='Hostels';
	
	
	function setLokalita(){
		form=document.forms['searchform2'];
		form.grade.length=0;
		lok=form.townpart[form.townpart.selectedIndex].value;
		form.grade.options[0]=new Option('- - - -',0,true,true);
		poc=1;
		if(lok!=0){
		for(i=gradesl[lok].length-1;i>-1;i--){
			if((gradesl[lok][i])>3){
				form.grade.options[poc]=new Option(grades[gradesl[lok][i]],gradesl[lok][i]);
				poc++;
			}
		}
		}
		else{
			for(i=10;i>3;i--){
				form.grade.options[poc]=new Option(grades[i],i);
				poc++;
		}
		}
		form.id.length=0;
		form.id.options[0]=new Option('- - - -',0);
		poc=1;
		for(i=0;i<hotely.length;i++){
			if(lok!=0){
			if(hotely[i].lokid==lok){
				form.id.options[poc]=new Option(hotely[i].name,hotely[i].id);
				poc++;
			}
			}
			else{
				form.id.options[poc]=new Option(hotely[i].name,hotely[i].id);
				poc++;
			}
		}

	}
	
	function setGrade(){
		form=document.forms['searchform2'];
		form.id.length=0;
		lok=form.townpart[form.townpart.selectedIndex].value;
		grad=form.grade[form.grade.selectedIndex].value;
		form.id.options[0]=new Option('- - - -',0);
		poc=1;
		for(i=0;i<hotely.length;i++){
	
			if(grad!=0){
				if(lok!=0){
				if(hotely[i].lokid==lok&&hotely[i].gradeid==grad){
					form.id.options[poc]=new Option(hotely[i].name,hotely[i].id);
					poc++;
				}
				}
				else{
					if(hotely[i].gradeid==grad){
				form.id.options[poc]=new Option(hotely[i].name,hotely[i].id);
					poc++;
					}
				}
	
			}
			else{
				if(lok!=0){
				if(hotely[i].lokid==lok){
					form.id.options[poc]=new Option(hotely[i].name,hotely[i].id);
					poc++;
				}
				}
				else{
					form.id.options[poc]=new Option(hotely[i].name,hotely[i].id);
					poc++;
				}
			}
		
		}
	}
	
	function setHotel(){
		form=document.forms['searchform2'];
		
		
	}
	
	function hotel(id,name,lokid,gradeid){
		this.id=id;
		this.name=name;
		this.lokid=lokid;
		this.gradeid=gradeid;
		hotely[hotely.length]=this;
	}
	
	function grade(gradeid,lokid){
		gradesl[lokid][gradeid]=gradeid;
	}

	
	
	function openwin(url,w,h){
		window.open (url,"Jmeno",'toolbar=0,location=0,directories=0,status=0, menubar=0,scrollbars=0,resizable=0,width='+w+',height='+h); 
	}
	
	function resetForms(){
		document.forms['searchform'].text.value="";
		document.forms['searchform2'].townpart.selectedIndex=0;
		document.forms['searchform2'].grade.selectedIndex=0;
		document.forms['searchform2'].id.selectedIndex=0;
	}
	
	function setGrady(x){
		form=document.forms['searchform2'];
		for(i=0;i<form.grade.options.length;i++){
			if(x==form.grade.options[i].value) form.grade.selectedIndex=i;
		}
	}