/* author: Dominik Cabos */
/* Creation date: 2004-01-15 */

function hotel(dist, cat, fit, bus, price, instant, cur, dir, name, town)
{
this.dist = dist;
this.cat = cat;
this.fit = fit;
this.bus = bus;
this.price = price;
this.cur = cur;
this.dir = dir;
this.name = name;
this.town = town;
this.instant = instant;

}

i=0;
hotels = new Array();
hotels[i++]= new hotel(1,5,0,0,165,0,'EUR','/BrandenburgerHof','Hotel Brandenburger Hof','Berlin');
hotels[i++]= new hotel(1,5,1,0,185,0,'EUR','/DorintAmGendarmenmarkt','Dorint Am Gendarmenmarkt Hotel','Berlin');
hotels[i++]= new hotel(1,5,1,0,191,0,'EUR','/HolidayInnBerlin-Nuernberg','Holiday Inn Berlin-Nuernberg Hotel','Berlin');
hotels[i++]= new hotel(1,5,1,1,165,0,'EUR','/Palace','Palace Hotel Berlin','Berlin');
hotels[i++]= new hotel(1,5,1,1,199,1,'EUR','/KempinskiBristol','<font>Kempinski Bristol Hotel</font>','Berlin');
hotels[i++]= new hotel(1,5,1,0,210,0,'EUR','/Hilton','Hilton Hotel','Berlin');
hotels[i++]= new hotel(1,5,1,1,218,0,'EUR','/Inter-Continental','Inter-Continental Hotel','Berlin');
hotels[i++]= new hotel(1,5,1,0,225,0,'EUR','/GrandEsplanade','Grand Hotel Esplanade','Berlin');
hotels[i++]= new hotel(1,5,1,0,288 ,0,'EUR','/RegentSchloss','<font>Regent Schlosshotel Berlin</font>','Berlin');
hotels[i++]= new hotel(1,5,1,1,300,1,'EUR','/Adlon','<font>Adlon Hotel</font>','Berlin');
hotels[i++]= new hotel(1,4,0,1,84,1,'EUR','/Artim','<font>Artim Hotel</font>','Berlin');
hotels[i++]= new hotel(2,4,1,1,77,0,'EUR','/CourtyardBerlinTeltow','Courtyard Berlin Teltow Hotel','Berlin');
hotels[i++]= new hotel(2,4,1,1,85,0,'EUR','/DorintAmMueggelsee','Dolce Berlin Mueggelsee  Hotel','Berlin');
hotels[i++]= new hotel(1,4,0,0,101,0,'EUR','/Queens','Queens Hotel','Berlin');
hotels[i++]= new hotel(1,4,0,0,106,0,'EUR','/BestWesternSteglitzInternational','Best Western Hotel Steglitz International','Berlin');
hotels[i++]= new hotel(3,4,1,1,112,0,'EUR','/AstronBerlin-Potsdam','Astron Hotel Berlin-Potsdam<span style="font-weight:normal; text-decoration:none;"> (Potsdam)</span>','Potsdam');
hotels[i++]= new hotel(1,4,1,0,120,0,'EUR','/AstronBerlin-Mitte','Astron Hotel Berlin-Mitte','Berlin');
hotels[i++]= new hotel(2,4,1,0,120,0,'EUR','/AstronBerlin-Treptow','Astron Hotel Berlin-Treptow','Berlin');
hotels[i++]= new hotel(1,4,1,0,120,0,'EUR','/NHBerlin-Aleksanderplatz','NH Hotel Berlin-Aleksanderplatz','Berlin');
hotels[i++]= new hotel(1,4,0,0,120,0,'EUR','/Luisenhof','Luisenhof Hotel','Berlin');
hotels[i++]= new hotel(2,4,1,0,120,0,'EUR','/CourtyardBerlin-Koepenick','Courtyard Berlin-Koepenick Hotel','Berlin');
hotels[i++]= new hotel(2,4,1,0,134,0,'EUR','/BestWesternPresident','Best Western President Hotel','Berlin');
hotels[i++]= new hotel(2,4,0,0,134,0,'EUR','/Residenz','Residenz Hotel','Berlin');
hotels[i++]= new hotel(1,4,1,0,137,0,'EUR','/HolidayInnBerlin-HumboldPark','Holiday Inn Berlin-Humbold Park Hotel','Berlin');
hotels[i++]= new hotel(1,4,1,0,140,0,'EUR','/AlexanderPlaza','Alexander Plaza Hotel','Berlin');
hotels[i++]= new hotel(1,4,1,0,145,0,'EUR','/DorintSchweizerhof','Dorint Schweizerhof Hotel','Berlin');
hotels[i++]= new hotel(1,4,1,0,149,0,'EUR','/MaritimProArte','<font>Maritim ProArte Hotel</font>','Berlin');
hotels[i++]= new hotel(1,4,1,0,152,0,'EUR','/HolidayInnBerlin-Esplande','Holiday Inn Berlin-Esplande Hotel','Berlin');
hotels[i++]= new hotel(1,4,0,0,153,0,'EUR','/AnDerOper','An Der Oper Hotel','Berlin');
hotels[i++]= new hotel(1,4,0,0,154,0,'EUR','/HolidayInnEastPrenzlauerAllee','Holiday Inn East Prenzlauer Allee Hotel','Berlin');
hotels[i++]= new hotel(1,3,1,0,90,1,'EUR','/Alexander','<font>Hotel Alexander</font>','Saarmund');
hotels[i++]= new hotel(1,3,0,0,32,1,'EUR','/ansbach','<font>City Hotel Ansbach</font>','Berlin');
hotels[i++]= new hotel(1,3,1,0,70,1,'EUR','/orion','<font>Hotel Orion</font>','Berlin');
hotels[i++]= new hotel(1,3,1,0,65,1,'EUR','/bellevue','<font>Hotel Bellevue</font>','Berlin');
hotels[i++]= new hotel(1,3,1,0,59,1,'EUR','/pensionsavoy','<font>Hotel-Pension Savoy</font>','Berlin');



//hotels[i++]= new hotel(3,3,1,0,36,0,'EUR','/GarniSaarmund','Hotel Garni Saarmund<span style="font-weight:normal; text-decoration:none;"> (Saarmund)</span>','Saarmund');
hotels[i++]= new hotel(1,3,0,1,68,0,'EUR','http://www.polhotels.com/Berlin/Charlottenburger/','<font>Charlottenburger</font>','Berlin');
hotels[i++]= new hotel(1,3,0,0,69 ,0,'EUR','/Heidelberg','Heidelberg Hotel','Berlin');
hotels[i++]= new hotel(2,3,0,0,70,0,'EUR','/DorintAdlershof','Dorint Adlershof Hotel','Berlin');
hotels[i++]= new hotel(1,3,0,0,72,0,'EUR','/PensionKurfurst','Pension Kurfurst Hotel','Berlin');
hotels[i++]= new hotel(2,3,0,0,74,0,'EUR','/RamadaApartFlughafenBerlinSchonefeld','Ramada Aparthotel Flughafen Berlin Schonefeld','Berlin');
hotels[i++]= new hotel(1,3,0,1,77,1,'EUR','/Econtel','Econtel Hotel','Berlin');
hotels[i++]= new hotel(1,3,0,0,88,0,'EUR','/BestWesternAutobahnmotelAvus','Best Western Autobahnmotel Avus','Berlin');
hotels[i++]= new hotel(2,3,0,0,90,0,'EUR','/DorintAirportBerlinTegel','Dorint Airport Hotel Berlin Tegel','Berlin');
hotels[i++]= new hotel(1,3,0,0,91,0,'EUR','/BestWesternEuroConsul','Best Western Hotel Euro Consul','Berlin');
hotels[i++]= new hotel(1,3,0,0,95,0,'EUR','/BestWesternBoulevardamKurfuerstendamm','Best Western Hotel Boulevard am Kurfuerstendamm','Berlin');
hotels[i++]= new hotel(1,3,0,0,65,1,'EUR','/AMStudio','<font>Concorde AM Studio Hotel</font>','Berlin');
hotels[i++]= new hotel(1,3,0,0,102,0,'EUR','/DorintAnDerCharitBerlinMitte','Mercure Hotel Berlin An Der Charite','Berlin');
hotels[i++]= new hotel(1,3,1,0,113,0,'EUR','/BestWesternCity-Consul','Best Western Hotel City-Consul','Berlin');
hotels[i++]= new hotel(1,3,0,0,120,0,'EUR','/Ramada-TreffGrunau','Hotel Ramada-Treff Grunau','Berlin');
hotels[i++]= new hotel(1,3,1,0,120,0,'EUR','/Ramada-TreffParkBlubBerlin','Ramada-Treff Park Hotel Blub Berlin','Berlin');
hotels[i++]= new hotel(1,3,0,0,118,0,'EUR','/Sorat','Hotel Sorat','Berlin');
hotels[i++]= new hotel(1,3,1,1,140,0,'EUR','/ParkInn','Park Inn Berlin-Alexanderplatz','Berlin');
hotels[i++]= new hotel(1,3,0,0,154,0,'EUR','/HolidayInnBerlin-Kurfuerstendamm','Holiday Inn Berlin-Kurfuerstendamm Hotel','Berlin');
hotels[i++]= new hotel(1,3,0,0,158,0,'EUR','/BestWesternKant','Best Western Kanthotel','Berlin');
hotels[i++]= new hotel(1,3,0,0,250,0,'EUR','/WestinGrand','Westin Grand Hotel','Berlin');
hotels[i++]= new hotel(1,2,0,0,30,1,'EUR','/spree','<font>Hotel-Pension Spree</font>','Berlin');

function sortCategory(){
	for (p=1;p<hotels.length;p++){
		for(q=0;q<(hotels.length-1);q++){
			if (hotels[q].cat<hotels[q+1].cat) {
				a = new hotel;
				a = hotels[q];
				hotels[q] = hotels[q+1];
				hotels[q+1] = a;
			}
		}
	}
}

function sortPrice(){
	for (p=1;p<hotels.length;p++){
		for(q=0;q<(hotels.length-1);q++){
			if (hotels[q].price>hotels[q+1].price) {
				a = new hotel;
				a = hotels[q];
				hotels[q] = hotels[q+1];
				hotels[q+1] = a;
			}
		}
	}
}



function listHotels(){

category = document.theForm['category'].value;
locationSearch = document.theForm['location'].value;
priceRange = document.theForm['priceRange'].value;
fitness = document.theForm['fitness'].checked;
business = document.theForm['business'].checked;

// tablice wartosci domyslnych
selCategory = new Array();
for (m=1;m<6;m++){
if (category==m) selCategory[m]="selected";
}

selLocation = new Array();
for (m=1;m<4;m++){
if (locationSearch==m) selLocation[m] = "selected";
}

selPrice = new Array();
for (m=0;m<=200;m=m+50){
if (priceRange==m) selPrice[m] = "selected";
}
var selFitness, selBusiness;
if (fitness) selFitness = "checked";
if (business) selBusiness = "checked";

// koniec wartosci domyslnych =================


location.reload();

// Headers & main text
document.write('<html> <head> <TITLE>Berlin Hotels - Search Results</TITLE> <link rel=stylesheet type=text/css href=cityStyles.css> ');
document.write('<script language=javascript src=berlin.js></script> </head> <body> <table name=LAYOUT WIDTH=85% BORDER=0 align=center>');
document.write('<TR><TD colspan=3><img src=b.gif width=740 height=10> <table cellspacing=0 cellpadding=0 border=0 width=100%>');
document.write('<tr><td><img src=logo.gif></td><td align=right valign=bottom><a href=http://www.res99.com/nexres/cars/search.cgi?src=10004159 target=_blank><img src=car.gif width=125 height=26 border=0></a><img src=b.gif width=5 height=1>');
document.write('<a href=http://www.res99.com/nexres/start-pages/frame.cgi?src=10004159&product=AIR target=_blank><img src=air.gif width=125 height=26 border=0></a><img src=b.gif width=5 height=1><a href=mailto:ontravel@pol.pl><img src=contact.gif width=126 height=25 border=0></a></td></tr>');
document.write('<tr><td colspan=2><img src=b.gif width=1 height=4></td></tr>');
document.write('<tr><td bgcolor=#333366 colspan=2><img src=b.gif width=1 height=1></td></tr></table><img src=b.gif width=1 height=7><br>');
document.write('<b>Welcome to Berlin, Germany!</b>');
document.write(" We present one of the most comprehensive selections of hotels in Berlin available through the web, with detailed information on the hotels   facilities, photos, maps, and secure reservation forms.<Br> Whether you’re on a budget or looking for luxury accommodations in Berlin, our Berlin hotels directory offers a wide range of possibilities for your stay, from cheap hotels, inns, motels, to deluxe hotels. Some of the hotels presented in this directory offer <u>prices lower than the hotel rack rates</u>. These kind of offers are exclusive of <a class=hotel href=http://www.hotelsberlinonline.com>hotelsberlinonline.com</a> and are available only when booked through our secure reservation forms.<br><img src=b.gif width=1 height=10><br></TD></TR>");
document.write('<TR><TD width=50% valign=top class=light><TABLE name=ALLHOTELS width=100% cellspacing=0 cellpadding=0 border=0>');
document.write('<tr><td colspan=4  align=left height=28 valign=top class=title><table cellspacing=0 cellpadding=0 width=100% border=0><tr height=28>');
document.write('<td class=title align=left valign=top><img src=r1.gif width=14 height=9></td>');
document.write('<td class=title> All hotels in Berlin</td><td align=right class=title><font class=a3>Currently <b>46 hotels</b> available</font></td>');
document.write('<td class=title align=right valign=top><img src=r2.gif width=14 height=9></td></table></td></tr>');
document.write('<tr><td colspan=4 bgcolor=#333366><form name=theForm>');
document.write('<table name=marginsearchbox cellspacing=0 cellpadding=0 class=title border=0 width=100%><tr><td><img src=b.gif width=1 height=1></td><td><table width=100% cellspacing=0 cellpadding=2 border=0 class=normal style="font-size:8pt">');
document.write('<tr class=old><td colspan=4><img src=b.gif width=1 height=1></td></tr>');
document.write('<tr class=old><td><img src=b.gif width=3 height=1></td>');
document.write('<td><img src=arrow.gif width=4 height=7>   Category</td>');
document.write('<td align=center><select onchange="listHotels()" style="width:80px;" name=category>');
document.write('<option value="all">all</option><option value="5" '+selCategory[5]+'>5 stars</option><option value="4" '+selCategory[4]+'>4 stars</option><option value="3" '+selCategory[3]+'>3 stars</option><option value="2" '+selCategory[2]+'>2 stars</option>');
document.write('<option value="1" '+selCategory[1]+'>other</option></select></td>');
document.write('<td width=51%><img src=b.gif width=10 height=1><img src=arrow.gif width=4 height=7>   Prices from  <select  style="width:90px;" name=priceRange onchange="listHotels()">');
document.write('<option value="all">all</option><option value="0" '+selPrice[0]+'>< € 50</option><option value="50" '+selPrice[50]+'>€ 50 - € 100</option><option value="100" '+selPrice[100]+'>€ 100 - € 150</option>');
document.write('<option value="150" '+selPrice[150]+'>€ 150 - € 200</option><option value="200" '+selPrice[200]+'>> € 200</option></select></td></tr>');
document.write('<tr class=old><td></td>');
document.write('<td><img src=arrow.gif width=4 height=7>   Location</td>');
document.write('<td  align=center><select  style="width:80px;" name=location onchange="listHotels()">');
document.write('<option value="all">all</option><option value="1" '+selLocation[1]+'>city center</option><option value="2" '+selLocation[2]+'>suburbs</option><option value="3" '+selLocation[3]+'>out of city</option></select></td>');
document.write('<td><img src=b.gif width=10 height=1><img src=arrow.gif width=4 height=7>   Fitness<img src=b.gif width=5 height=1><input type=checkbox name=fitness onclick="listHotels()" '+selFitness+'><img src=b.gif width=10 height=1><img src=arrow.gif width=4 height=7>   Business<img src=b.gif width=5 height=1><input type=checkbox name=business onclick="listHotels()" '+selBusiness+'> </td></tr>');
document.write('<tr class=old><td colspan=4><img src=b.gif width=1 height=1></td></tr>');
document.write('</form></table name=searchbox></td><td><img src=b.gif width=1 height=1></td></tr><tr><td colspan=3><img src=b.gif width=1 height=1></td></table name=marginsearchbox></td></tr>');
document.write('</table name=allhotels></td><td><img src=b.gif width=10></td>');
document.write('<td width=50% valign=top><img src=b.gif width=1 height=7><br><img src=cen2.gif width=13 height=13 align=middle> - city center <br><img src=fit2.gif width=13 height=13 align=middle> - fitness facilities: swimming pool / gym / tennis courts <br><img src=bus2.gif width=13 height=13 align=middle> - business facilities: business center / PC available to guests<br><img src=ins.gif width=13 height=13 align=middle> - instant availability check and reservations</td></tr>');
// Koniec elementow statycznych

// test zmiennych:
// document.write('cat: ' + category + ' loc: ' +locationSearch + ' price: ' + priceRange +' fit: ' + fitness + ' bus: ' + business);

// test sortowanie:
document.write('<tr><td colspan=3 class=light><table name=marginesy cellspacing=0 cellpadding=0 width=100%><tr><td><img src=b.gif width=3 height=0></td><td><table name="wyniki" cellspacing=0 cellpadding=1 border=0 width=100%>');
sortPrice();
sortCategory();
var lastIndex = 99999;
var resCount = 0;
for (k=0;k<hotels.length;k++){ //glowna petla
// Okreslenie price range
skok = 50;
for (r=0;r<5;r++){
if (hotels[k].price<200){ if (hotels[k].price>=r*skok&&hotels[k].price<(r*skok+skok)) hotelPriceRange = r*skok;}
else hotelPriceRange = 200;
}

// warunki
if ((hotels[k].dist==locationSearch||locationSearch=="all")&&(hotels[k].fit=="1"||!fitness)&&(hotels[k].bus=="1"||!business)&&(hotelPriceRange==priceRange||priceRange=="all")&&(hotels[k].cat==category||category=="all"))
{
resCount++;
//zmienne obrazkow
var imgFit, imgBus, imgCen, imgIns
if (hotels[k].fit==1) imgFit = "<img src=fit2.gif width=13 height=13>"; else imgFit ="";
if (hotels[k].bus==1) imgBus = "<img src=bus2.gif width=13 height=13>"; else imgBus ="";
if (hotels[k].dist==1) imgCen = "<img src=cen2.gif width=13 height=13>"; else imgCen ="";
if (hotels[k].instant==1) imgIns = "<img src=ins.gif width=13 height=13>"; else imgIns ="";

	// okreslenie czy to pierwszy hotel w swej kat.
	 if (lastIndex==99999) isFirst="yes";
	 else if(hotels[k].cat!=hotels[lastIndex].cat) {isFirst="yes";}
	 else isFirst="no";
	 lastIndex0 = lastIndex; // kontrola
	 lastIndex=k;

	if (isFirst=="yes") {
if (lastIndex0!=99999)	 document.write('<tr><td colspan=9><hr></td></tr>');
else document.write('<tr><td width=27%></td><td></td><td></td><td width=5%><td><img src=b.gif width=10 height=4></td><td width=27%></td><td></td><td></td><td width=5%></td></tr>');
	document.write('<tr><td colspan=9  align=left ><b class=h3>'+hotels[k].cat+'-star Berlin hotels</b class=h3></td></tr><tr><td colspan=9><hr></td></tr>');}
// wypis hotelu

if (resCount%2!=0) {
//document.write('<br>Hotel:' + hotels[k].name + ' Cat: ' + hotels[k].cat + ' Price: ' + hotels[k].price +' Dist: ' + hotels[k].dist + ' Fit: ' + hotels[k].fit + ' Bus: ' +hotels[k].bus + ' Town: ' + hotels[k].town + ' PriceRange: ' + hotelPriceRange + ' last index: ' + lastIndex0 + imgFit + imgBus + imgCen + imgIns + '1st column' );

document.write('<tr><td width=27% valign=top><a  href="'+hotels[k].dir+'" class=hotel>'+hotels[k].name+'</a></td><td valign=top> '+imgCen+ ' ' +imgFit + ' '+ imgBus + ' '+imgIns+ '  </td><td align=right valign=top>from</td><td align=right valign=top width=5%><b>€ '+hotels[k].price+'</b></td><td><img src=b.gif width=15 height=1></td>');

}
else {
//document.write('<br>Hotel:' + hotels[k].name + ' Cat: ' + hotels[k].cat + ' Price: ' + hotels[k].price +' Dist: ' + hotels[k].dist + ' Fit: ' + hotels[k].fit + ' Bus: ' +hotels[k].bus + ' Town: ' + hotels[k].town + ' PriceRange: ' + hotelPriceRange + ' last index: ' + lastIndex0 + imgFit + imgBus + imgCen + imgIns + '2 nd column');

document.write('<td width=27%  valign=top><a  href="'+hotels[k].dir+'" class=hotel>'+hotels[k].name+'</a></td><td valign=top>  '+imgCen+ ' ' +imgFit + ' '+ imgBus + ' '+imgIns+ '  </td><td align=right valign=top>from</td><td align=right valign=top width=5% ><b>€ '+hotels[k].price+'</b></td></tr>');
}

}


//

}// koniec glownej petli
if (resCount==0) document.write("<img src=b.gif width=1 height=5><br><b><i>No hotels matched your criteria. Please try again.</i></b><br><img src=b.gif width=1 height=5>");
document.write('</table name=wyniki><img src=b.gif width=1 height=5></td><td><img src=b.gif width=3 height=1></td></tr></table name=marginesy></td></tr>');

//legenda

document.write('</TABLE name=LAYOUT>');
document.write('<img src=b.gif width=1 height=5><br><div align=center style="font:8pt;">© 2003 Berlin hotels</i></div>');


}