function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function changeimage(bild,c)
{
  counter=c;
  document.getElementById('titel').value = tit[counter];
  document.bild.src = img[counter].src;
}

function CreatePopUp()
{
///var altxt=document.bild.src;
//var altxt=tit[counter]
var img_url   = img_pop[counter].src;
var img_w     = sizew_pop[counter];
var img_h     = sizeh_pop[counter];
var img_title = tit[counter];

var altxt="url: "+img_url+" width: "+img_w+" height: "+img_h+" title: "+img_title;

PopWin(img_url,img_w,img_h,img_title,'','1')
//alert(altxt);
//return false;

}

function getDelayTime(dlTime)
{
   var temp = parseInt(dlTime);
   if(temp != NaN)
   delayTime = temp * 500;
   else
   delayTime = 100;
}

function anim()
{
   if(counter == anzahl_bilder)
   {
       counter = 1; //sets the counter value to 0
	}
	else
	{
	   counter++;
	}
   document.bild.src = img[counter].src;
   document.getElementById('titel').value = tit[counter];
   if(counter == anzahl_bilder)
    counter = 0; //sets the counter value to 0
}

function slide()
{
   with(document.form1)
   {
   start = setInterval('anim()', delayTime);
   stShow.disabled = true;
   spShow.disabled = false;
   }
}

function stopSlide()
{
   clearInterval(start);
   document.form1.stShow.disabled = false;
   document.form1.spShow.disabled = true;
}

var NN3=false;

function on3(name) {
   document[name].src=eval(name+"on.src");
}
function off3(name) {
   document[name].src=eval(name+".src");
}
NN3=true;

function on(name) {
   if (NN3) on3(name);
}
function off(name) {
   if (NN3) off3(name);
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}

function is_odd( $int )
{
  return( $int & 1 );
}

function PopWin(imageName,imageWidth,imageHeight,alt,bgcolor,mode) {

//	alt=alt+"  ** Zum Schließen ins Fenster klicken **"
	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var a = 1;
	var scrHeight = imageHeight;
	var scrHeight = (scrHeight*a) + 15;
	var scrWidth = imageWidth;
	var posLeft=10;
	var posTop=10;
	var titlea="www.KASHANA-Namibia.com, Namibia";
	newWindow = window.open("","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title>');
	newWindow.document.write('<script language="JavaScript">function clwin(){ window.close()}</script></head>');
	newWindow.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');   
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" ');
	newWindow.document.write('align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight); 
	newWindow.document.write(' alt=\"Click\&nbsp\;on\&nbsp\;Picture\&nbsp\;to\&nbsp\;close\&nbsp\;screen.\" >'); 
	newWindow.document.write('</td></tr><tr><td><p align="center"><a href="javascript:clwin();">');
//	newWindow.document.write('<img border="0" src="http://www.kickstartnam.com/images/button_close.gif" width="63" height="13">');
	newWindow.document.write('</a></td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function check_res(theForm, ln)
{
	var a  = ln;
	var t1 = "";
	var t2 = "";
	var t3 = "";
	var t4 = "";

	if (a=="en")
	{
  		t1 = "Please enter your lastname!";
		t2 = "Please enter a way to contact you. (Email, phone, fax or email)";
		t3 = "There is html code in field Request, this is not allowed.";
		t4 = "Please enter number of people. (Total Number of People, Adults and/or Children)";
  		t5 = "Please enter Date of Arrival!";
  		t6 = "Please enter Date of Departure!";
	}
	else
	{
  		t1 = "Bitte geben Sie Ihre Nachname ein!";
		t2 = "Bitte geben Sie eine Kontakt Möglichkeit an. (Email, Telefon, Fax oder Email)";
		t3 = "Das Feld Anfrage enth&auml;lt html-Zeichen, die sind nicht erlaubt.";
		t4 = "Bitte geben Sie Anzahl Personen ein. (Gesamz Anzahl Personen, Erwachsene und /oder Kinder)";
  		t5 = "Bitte geben Sie Ankunftsdatum ein!";
  		t6 = "Bitte geben Sie Abfahrtsdatum ein!";
	}

	if (theForm.kommentar.value != "")
	{
        str=theForm.kommentar.value;
        if(str.match(/([\<])([^\>]{1,})*([\>])/i)==null)
        {
        }
        else
        {
         alert(t3);
		theForm.kommentar.focus();
		return false;
		}
  	}



	if (theForm.nachname.value == "" )
  	{
  		alert(t1);
		theForm.nachname.focus();
		return false;
  	}	

	if (theForm.email.value == "" && theForm.telefon.value == "" && theForm.handy.value == "" && theForm.fax.value == "")
  	{
  		alert(t2);
		theForm.email.focus();
		return false;
  	}

	if (theForm.pax.value == "" && theForm.pax_a.value == "" && theForm.pax_k.value == "")
  	{
  		alert(t4);
		theForm.pax.focus();
		return false;
  	}

	if (theForm.date_an.value == "0000-00-00" )
  	{
  		alert(t5);
		theForm.date_an.focus();
		return false;
  	}	

	if (theForm.date_ab.value == "0000-00-00" )
  	{
  		alert(t6);
		theForm.date_ab.focus();
		return false;
  	}	



}



