document.write('<iframe id="DivShim" src="/img/pixel.gif" scrolling="no" frameborder="0" style="position:absolute;top:0px;left:0px;display:none;"></iframe>');
var DatArray = new Array("So","Mo","Di","Mi","Do","Fr","Sa","??" )
var NameArray= new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag","??" );
var MonArray = new Array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember","??");
var MonArray = new Array("Jan.","Feb.","Mär.","Apr.","Mai","Jun.","Jul.","Aug.","Sep.","Okt.","Nov.","Dez.","??");
var RegionKey = "/ASI/SPP/KNA/BLE/KIK/KRE/TRA/";
var allBerlin = "/THF/SXF/TXL/";
var randnum=new Date().getTime();
var PlusTage=28;
var Wunchdatum='';
var progressStep= 5;
var progressStop= 180;
var progressAt= progressStep;
var progressColor= '#000000';
var progressInterval= 1000;
var progressTimer;

function ml(){
 document.write('info@lastminute.tv');
}

function progress_clear() {
 clearTimeout(progressTimer);
 document.getElementById('progress').style.backgroundColor = 'transparent';
 progressAt=0, klick=0;
}

function progress_work() {
 progressAt+= progressStep;
 if(progressAt >progressStop) progressAt= progressStep,klick=0,progress_clear();
 if(document.getElementById('progress')){
  document.getElementById('progress').style.backgroundColor = 'transparent';
  document.getElementById('progress').style.width = progressAt;
  document.getElementById('progress').style.backgroundColor = progressColor;
  progressTimer = setTimeout('progress_work()',progressInterval);
 }else{
  progress_clear();
 }
}


var hh = 0;
var mousex = 0;
var mousey = 0;
document.onmousemove=saveMousePosition;
var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1);
var isIE6Strict = (document.documentElement);

function saveMousePosition(mouseEvent) {
if (!mouseEvent) mouseEvent = window.event;
var posx,posy;
 if (mouseEvent.pageX || mouseEvent.pageY) {
  mousex = mouseEvent.pageX;
  mousey = mouseEvent.pageY;
 }else if (mouseEvent.clientX || mouseEvent.clientY){
  mousex = mouseEvent.clientX;
  mousey = mouseEvent.clientY;
 if (isIE){
  mousex += document.body.scrollLeft;
  mousey += document.body.scrollTop;
 }
 if (isIE6Strict) {
  mousex += document.documentElement.scrollLeft;
  mousey += document.documentElement.scrollTop;
 }
}
else return;
}

function ggetElementById(id) {
 if (document.getElementById) return document.getElementById(id);
 if (document.all) return document.all[id];
 if (document.layers) return document.layers[id];
 return null
}

function auf(aText) {
 id='alertinfobox'
 setVisibility(id, 'visible', aText);
}

function zu() {
 id='alertinfobox'
 setVisibility(id, 'hidden','');
}

function setVisibility(id, vis, txt) {
 var element = ggetElementById(id);
 var IfrRef = ggetElementById('DivShim');
 var style = element;
 if (element.style) {
 element.innerHTML = txt;
  if (element) {
   element.style.visibility=vis;
   element.style.width = 150;
   element.style.height = 50;
   element.style.top = mousey;
   element.style.left = (mousex + 10);
   element.style.zIndex = 2000;

	if(vis=='hidden'){
	 IfrRef.style.display = "none";
	}else{
	 IfrRef.style.width = element.style.width
	 IfrRef.style.height = element.style.height;
	 IfrRef.style.top = mousey+6;
	 IfrRef.style.left = element.style.left;
	 IfrRef.style.display = "block";
	}

  }
 }
}


function mOver(thisObj) {
 thisObj.bgColor='e8e8e8';
}

function mOut(thisObj) {
 thisObj.bgColor='ffffff';
}

function DatumBox(n,wa){
out=''
 for (i=1; i<=100;i++){
 if(i>=n) out+='<option value="'+DatumParm(i)+'"'+((DatumParm(i)==wa)? ' selected':'')+'>'+MakeDatum(i)+'</option>'
 }
return(out);
}

function DatumPlus(n,wa){
out=''
 for (i=1; i<=100;i++){
 if(i>=n) out+='<option value="'+i+'"'+((i==wa)? ' selected':'')+'>'+MakeDatum(i)+'</option>'
 }
return(out);
}

function MakeSelect(Object,Wert) {
 for (i = 0;  i < Object.length;  i++) {
  if(Object.options[i].value==Wert) {
   Object.selectedIndex=i;
   Object.options[i].defaultSelected=true;
  }
 }
}

function reDatum(start,n){
 for(i=1; i<300;i++){
  ab= DatumParm(i)
  if(start==ab) return( DatumParm(i+n) )
 }
return( DatumParm(n) )
}

function MakeDatum(days){
 time = new Date
 time.setTime( time.getTime()+days*86400000)
 dd= ((time.getDate() >9) ? "":"0")+time.getDate()
 return DatArray[time.getDay()]+', '+dd+'. '+MonArray[time.getMonth()]+' '+(2000+(time.getYear()%100))
}

function DatumParm(days){
 time = new Date
 time.setTime( time.getTime()+days*86400000)
 dd= ((time.getDate() >9) ? "":"0")+time.getDate()
 mm= ((1+time.getMonth() >9) ? "":"0")+(1+time.getMonth())
 return dd+mm+(2000+(time.getYear()%100))
}

function SelectZiele(s,a) {
if(a=='PKW'){
  Lco='';
  tt='<option value="---">alle nur Hotel Reiseziele</option>';
  for (i=0; i< ea; i++) {
	if(LC[i] != Lco){
	tt+='<option value="'+LC[i]+'-"'+((LC[i]+'-' == s)? ' selected':'')+'>'+LD[i]+'</option>';
	Lco=LC[i];
	}
	tt+='<option value="'+ZC[i]+'"'+((ZC[i] == s)? ' selected':'')+'> -- '+RG[i]+'</option>'
  }

}else{

  tt='<option value="---">alle Reiseziele</option>';
  for (i=1; i<= ll; i++) {
   tt+='<option value="'+Lcode[i]+'-"'+((Lcode[i]+'-' == s)? ' selected':'')+'>'+Land[i]+'</option>'
   for (z=1; z<= zz; z++) {
     if(Lcode[i]==Lco[z]){
	tt+='<option value="'+Zic[z]+'"'+((Zic[z] == s)? ' selected':'')+'> -- '+Zif[z]+'</option>'
     }
   }
  }
}
return(tt);
}

var listet= new Array();
function ExistAP(ap){
  for(t=0; t < listet.length; t++) {
    if(listet[t]==ap) return(true);
  }
 listet[t]=ap;
 return(false)
}

function SelectAbflug(s){
if(s=='PKW'){
 tt='<option value="PKW" selected>mit eigene Anreise</option>';
}else{
 tt='<option value="---"'+((s=='---') ? ' selected':'')+'>alle Abflughafen</option>',bb=true;
 nn='<option value="NNN"'+((s=='NNN') ? ' selected':'')+'>Nord</option>',ExistAP('NNN');
 ss='<option value="SSS"'+((s=='SSS') ? ' selected':'')+'>Süd</option>',ExistAP('SSS');
 ww='<option value="WWW"'+((s=='WWW') ? ' selected':'')+'>West</option>',ExistAP('WWW');
 oo='<option value="OOO"'+((s=='OOO') ? ' selected':'')+'>Ost</option>',ExistAP('OOO');

  for (i=1; i<= aa; i++) {
   for(r=0; r< WWW.length;r++){
      if(abc[i]==WWW[r])
	if(!ExistAP(abc[i])) ww+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
   }
  }
  tt+= ww;
  for (i=1; i<= aa; i++) {
   for(r=0; r< OOO.length;r++){
      if(bb && allBerlin.indexOf(abc[i]) >0) oo+='<option value="BER"'+((s=='BER') ? ' selected':'')+'> -- Berlin</option>',bb=false;
      if(abc[i]==OOO[r]) {
	if(!ExistAP(abc[i])) oo+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
      }
   }
  }
  tt+= oo;
  for (i=1; i<= aa; i++) {
   for(r=0; r< NNN.length;r++){
      if(abc[i]==NNN[r])
	if(!ExistAP(abc[i])) nn+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
   }
  }
  tt+= nn;
  for (i=1; i<= aa; i++) {
   for(r=0; r< SSS.length;r++){
      if(abc[i]==SSS[r])
	if(!ExistAP(abc[i])) ss+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
   }
  }
  tt+= ss;
  tt+= '<option value="BE-"'+((s=='BE-') ? ' selected':'')+'>Belgien</option>';
  for (i=1; i<= aa; i++) {
   for(r=0; r< LBE.length;r++){
      if(abc[i]==LBE[r])
	if(!ExistAP(abc[i])) tt+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
   }
  }
  tt+= '<option value="FR-"'+((s=='FR-') ? ' selected':'')+'>Frankreich</option>';
  for (i=1; i<= aa; i++) {
   for(r=0; r< LFR.length;r++){
      if(abc[i]==LFR[r])
	if(!ExistAP(abc[i])) tt+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
   }
  }
  tt+= '<option value="NL-"'+((s=='NL-') ? ' selected':'')+'>Niederlande</option>';
  for (i=1; i<= aa; i++) {
   for(r=0; r< LNL.length;r++){
      if(abc[i]==LNL[r])
	if(!ExistAP(abc[i])) tt+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
   }
  }
  tt+= '<option value="AT-"'+((s=='AT-') ? ' selected':'')+'>Österreich</option>';
  for (i=1; i<= aa; i++) {
   for(r=0; r< LAT.length;r++){
      if(abc[i]==LAT[r])
	if(!ExistAP(abc[i])) tt+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
   }
  }
  tt+= '<option value="CH-"'+((s=='CH-') ? ' selected':'')+'>Schweiz</option>';
  for (i=1; i<= aa; i++) {
   for(r=0; r< LCH.length;r++){
      if(abc[i]==LCH[r])
	if(!ExistAP(abc[i])) tt+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'> -- '+ainf[i]+'</option>';
   }
  }
  for (i=1; i<= aa; i++) {
   if(!ExistAP(abc[i])) tt+='<option value="'+abc[i]+'"'+((s==abc[i]) ? ' selected':'')+'>'+ainf[i]+'</option>';
  }
 }
return(tt);
}

function DauerBox(n){
 mx=30;
 out='<option value="00">beliebig</option>';
 n=parseInt(n);
 for (i=1; i<=mx;i++) out+='<option value='+((i>9) ? i:'0'+i)+((i==n) ? ' selected':'')+'>'+i+((i==1) ? ' Tag':' Tage')+'</option>';
 document.write(out)
}


function SelectDauer(s){
tt='<option value="00"'+(s=="00" ? 'selected':'')+'>beliebig</option>'
+'<option value="03"'+(s=="03" ? 'selected':'')+'> von 1 - 3 Tage</option>'
+'<option value="05"'+(s=="05" ? 'selected':'')+'> von 4 - 5 Tage</option>'
+'<option value="08"'+(s=="08" ? 'selected':'')+'> von 6 - 8 Tage</option>'
+'<option value="07"'+(s=="07" ? 'selected':'')+'> genau 1 Woche</option>'
+'<option value="11"'+(s=="11" ? 'selected':'')+'> von 9 -11 Tage</option>'
+'<option value="15"'+(s=="15" ? 'selected':'')+'> von 12-15 Tage</option>'
+'<option value="14"'+(s=="14" ? 'selected':'')+'> genau 2 Wochen</option>'
+'<option value="22"'+(s=="22" ? 'selected':'')+'> von 16-22 Tage</option>'
+'<option value="21"'+(s=="21" ? 'selected':'')+'> genau 3 Wochen</option>'
+'<option value="23"'+(s=="23" ? 'selected':'')+'> ab 22 Tage</option>';
return(tt);
}

function SelectPax(s){
tt='<option value="100"'+(s=="100" ? 'selected':'')+'>1 Erw.'
+'<option value="200"'+(s=="200" ? 'selected':'')+'>2 Erw.'
+'<option value="300"'+(s=="300" ? 'selected':'')+'>3 Erw.'
+'<option value="400"'+(s=="400" ? 'selected':'')+'>4 Erw.'
+'<option value="500"'+(s=="500" ? 'selected':'')+'>5 Erw.'
+'<option value="110"'+(s=="110" ? 'selected':'')+'>1 Erw. 1 Kind'
+'<option value="120"'+(s=="120" ? 'selected':'')+'>1 Erw. 2 Kinder'
+'<option value="210"'+(s=="210" ? 'selected':'')+'>2 Erw. 1 Kind'
+'<option value="220"'+(s=="220" ? 'selected':'')+'>2 Erw. 2 Kinder'
+'<option value="230"'+(s=="230" ? 'selected':'')+'>2 Erw. 3 Kinder'
+'<option value="310"'+(s=="310" ? 'selected':'')+'>3 Erw. 1 Kind'
+'<option value="320"'+(s=="320" ? 'selected':'')+'>3 Erw. 2 Kinder'
+'<option value="410"'+(s=="410" ? 'selected':'')+'>4 Erw. 1 Kind'
+'<option value="420"'+(s=="420" ? 'selected':'')+'>4 Erw. 2 Kinder';
return(tt);
}

function SelectStar(s){
tt='<option value="0"'+ (s=="0" ? 'selected':'')+'>beliebig'
+'<option value="1"'+ (s=="1" ? 'selected':'')+'>min. 1 Stern'
+'<option value="2"'+ (s=="2" ? 'selected':'')+'>min. 2 Sterne'
+'<option value="3"'+ (s=="3" ? 'selected':'')+'>min. 3 Sterne'
+'<option value="4"'+ (s=="4" ? 'selected':'')+'>min. 4 Sterne'
+'<option value="5"'+ (s=="5" ? 'selected':'')+'>min. 5 Sterne';
return(tt);
}

function SelectFood(s){
tt='<option value="OO"'+(s=="OO" ? 'selected':'')+'>beliebig'
+'<option value="OV"'+(s=="OV" ? 'selected':'')+'>nur Unterkunft'
+'<option value="UF"'+(s=="UF" ? 'selected':'')+'>Frühstück'
+'<option value="HP"'+(s=="HP" ? 'selected':'')+'>Halbpension'
+'<option value="VP"'+(s=="VP" ? 'selected':'')+'>Vollpension'
+'<option value="AI"'+(s=="AI" ? 'selected':'')+'>alles inklusive';
return(tt);
}

function Suchmaske(Query,plus){
abfl = Query.substr( 0,3).toUpperCase();
ziel = Query.substr( 3,3).toUpperCase();
erwa = Query.substr( 6,1).toUpperCase();
kind = Query.substr( 7,1).toUpperCase();
baby = Query.substr( 8,1).toUpperCase();
stay = Query.substr( 9,2).toUpperCase();
star = Query.substr(11,1).toUpperCase();
room = Query.substr(12,2).toUpperCase();
food = Query.substr(14,2).toUpperCase();
tag  = Query.substr(16,2).toUpperCase();
monat= Query.substr(18,2).toUpperCase();
jahr = Query.substr(20,4).toUpperCase();
preis= Query.substr(24,4).toUpperCase();
tour = Query.substr(28,4).toUpperCase();

reDat= reDatum(tag+monat+jahr,plus)
rTag = reDat.substr(0,2)
rMon = reDat.substr(2,2)
rJah = reDat.substr(4,4)
nix=''
xx='<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>'
+'<form class=menuForm name="aform" id="aform">'
+'<TR>'
+'<TD class=menuTD id=wb>Wählen Sie Ihr Reiseziel</TD>'
+'<TD class=menuTDright><SELECT onChange="document.aform.hotsuch.value=nix;" class=menuSelect name="Ziel">'+ SelectZiele(ziel)+'</SELECT></TD></TR>'
+'<TR>'
+'<TD class=menuTD id=wb>Wählen Sie Ihren Abflughafen</TD>'
+'<TD class=menuTDright><SELECT class=menuSelect name="Abflug">'+ SelectAbflug(abfl)+'</SELECT></TD></TR>'
+'<TR>'
+'<TD colspan=2>'
+'<TABLE cellSpacing=0 cellPadding=0 border=0>'
+'<td class=menuTD id=wb>Urlaub ab</td>'
+'<td class=menuTD ><input type=text class=menuSelectSmall name="ABDATUM" value="'+tag+'.'+monat+'.'+jahr+'"></td>'
+'<td class=menuTD><a href="#" onclick="PopUp(\'Kalender.htm?f=1\');return false"><img src="image/Kalender.gif" border=0></a></td>'
+'<td class=menuTD id=wb>max. bis</TD>'
+'<TD class=menuTD><input type=text class=menuSelectSmall name="REDATUM" value="'+rTag+'.'+rMon+'.'+rJah+'"></TD>'
+'<td class=menuTD><a href="#" onclick="PopUp(\'Kalender.htm?f=2\');return false"><img src="image/Kalender.gif" border=0></a></td></table>'
+'</td></TR>'
+'<TR>'
+'<TD class=menuTD id=wb>Aufenthaltsdauer</TD>'
+'<TD class=menuTDright><SELECT class=menuSelect name="Dauer">'+SelectDauer(stay)+'</SELECT></TD></TR>'
+'<TR>'
+'<td class=menuTD id=wb>Reiseteilnehmer</TD>'
+'<td class=menuTDright><SELECT class=menuSelect name="Pax">'+SelectPax(erwa+kind+baby)+'</SELECT></TD></TR>'
+'<TR>'
+'<td class=menuTD id=wb>Kategorie</TD>'
+'<td class=menuTDright><SELECT class=menuSelect name="Sterne">'+SelectStar(star)+'</SELECT></TD></TR>'
+'<TR>'
+'<td class=menuTD id=wb>Leistung/Verpflegung</SPAN></TD>'
+'<td class=menuTDright><SELECT class=menuSelect name="Leistung">'+SelectFood(food)+'</SELECT></TD></TR>'
+'<TR><td colspan=2 class=menuTD>'
+'<TABLE cellSpacing=0 cellPadding=0 border=0>'
+'<td id=wb>Ihre Hotelauswahl:&nbsp;</TD>'
+'<td><input type=text class=menuSelect readonly="true" style="WIDTH:215px;BORDER:0px;padding-left:4px" name=hotsuch value=""></td></table></TD></TR>'
+'<TR>'
+'<td class=menuTD><span id="progress">&nbsp;</span></TD>'
+'<td class=menuTDright><INPUT id=btn type=button value="Urlaub finden" onclick="startsuche(1)"></TD></TR>'
+'</form></TABLE>';
document.write(xx);
}


function allCitys(wi,su){
if(su.length==3) return(true);
 for (z=1; z<= zz; z++) {
  if(Lco[z]==su && Zic[z]==wi) return(true);
 }
return(false);
}

function infCity(su,wi){
 for (z=1; z<= zz; z++) {
  if(Zic[z]==su){
   if(wi==0){
     return(Zif[z]);
   }else{
    for(i=1; i<= ll; i++) {
     if(Lcode[i] == Lco[z]) return(Land[i]);
    }
   }
  }
 }
return(false);
}


function HdI(URL){
 wName="HotelInfo";
 window.open(URL,wName,'width=862,height=576,resizable=yes,toolbar=no,scrollbars=no')
}

function startsuche(n){
  if(n==0) document.aform.hotsuch.value='';
  if(n==2) document.aform.Ziel.value='---';
  get(document.aform.elements);
}


function get(obj,wo) {
 if(klick==0){
 var getstr = "?";
 if((typeof obj)=='object'){
	for (i=0; i<obj.length; i++) {
	if (obj[i].tagName == "INPUT") {
            if (obj[i].type == "text" || obj[i].type == "hidden") {
               getstr += obj[i].name + "=" + escape(obj[i].value) + "&";
            }
            if (obj[i].type == "checkbox") {
               if (obj[i].checked) {
                  getstr += obj[i].name + "=" + escape(obj[i].value) + "&";
               } else {
                  getstr += obj[i].name + "=&";
               }
            }
            if (obj[i].type == "radio") {
               if (obj[i].checked) {
                  getstr += obj[i].name + "=" + escape(obj[i].value) + "&";
               }
            }
         }

         if (obj[i].tagName == "TEXTAREA") {
            getstr += obj[i].name + "=" + escape(obj[i].value) + "&";
         }

         if (obj[i].tagName == "SELECT") {
            var sel = obj[i];
            getstr += sel.name + "=" + escape(sel.options[sel.selectedIndex].value) + "&";
         }
	}
  }else{
	getstr += obj;
  }
  klick=1;
  getstr += "&cch="+Math.random()
  if(wo==null) progress_work();
  loadContent('search.asp',getstr,wo);
 }
}


function Refresh(){
  //document.Sort.submit();
  get(document.Sort.elements)
}

function More(PageNumber){
  document.Sort.ANR.value= '';
  document.Sort.Page.value = PageNumber;
  Refresh();
}

function Sortieren(SortString){
  document.Sort.ANR.value= '';
  document.Sort.SortBy.value = SortString;
  document.Sort.ReSort.value = "yes";
  Refresh();
}

function detail(anr){
  document.Sort.ANR.value= anr;
  Refresh();
}

function buchen(anr,gp){
  document.einAngebot.ANR.value= anr;
  document.einAngebot.GPREIS.value= gp;
  document.einAngebot.submit();
}

function Star(s){
st=''
 if( (s == "0") || (s.length == 0) )
  return('&nbsp;')
 else
  for(i=0; i<parseInt(s);i++){
  st+= '*&nbsp;';
  }
return(st);
}

function playclip(f,h,l,o,k){
 fenst=',width=540,height=400'
 cpURL='http://www.lastminute.tv/video.asp'
 cpURL+='?i='+escape(f)
 +'&h='+escape(h)
 +'&l='+escape(l)
 +'&o='+escape(o)
 +'&k='+escape(k);
 clip = window.open(cpURL,'VideoClip','scrollbars=no,toolbar=no,location=no,status=no,menubar=no,resizable=no'+fenst);
}

function PopUp(url) {
 if(window.event){
	Ereignis= window.event;
	X=Ereignis.screenX;
	Y=Ereignis.screenY;
 }
 Calwin= window.open(url,'Kalender','height=185,Width=165,status=no,dependent=yes');
 if(X >0) Calwin.moveTo(X,Y);
}

function FlugZeit(theUrl){
 window.open(theUrl, 'fZeit', 'scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=510,height=200');
}

function edt(theUrl){
 window.open(theUrl, 'webedit', 'scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=550,height=250');
}

