// javascript DHMTL - funktionen
// author: alexander stier, cuti & stier gbr
// datum: 09.08.2004


function rollover(Bild)
{
	with (document.images[Bild])
	src = (src.indexOf("0") != -1) ? src.replace(/0/, "1") : src.replace(/1/, "0");
}

function openPopUp(url,name,top,left,width,height,scrollbars,toolbar,status,location)
{
	thirdParameter = 'top=' + top + ',left=' + left + ',width=' + width + ',height=' + height + ',scrollbars=' + scrollbars + ',toolbar=' + toolbar + ',status=' + status + ',location=' + location + ',resizable=1,menubar=no';
	openpUpObj = window.open(url,name,thirdParameter);
	openpUpObj.focus();
}

function ValidateForm(form)
{
	if (form.inh1.value == "") { alert("Bitte geben Sie Ihr Anliegen an."); form.inh1.focus(); return; }
	if (form.inh2.value == "") { alert("Bitte geben Sie Ihren Namen an."); form.inh2.focus(); return; }
	if (form.inh8.value == "") { alert("Bitte geben Sie Ihre e-mail-Adresse an !"); form.inh8.focus(); return;}
 	if (form.inh8.value.indexOf('@', 0) == -1 || form.inh8.value.indexOf('.', 0) == -1) { alert("Bitte geben Sie ein gültige e-mail-Adresse an !"); form.inh8.focus(); return; }
	form.submit();
}

var i = 1;
var bannercount = 2;
var bannertime = 3;
banner = new Array;
bannerGB = new Array;
//banner[1] = "/images/de_header/willkommen_in_koeln.gif";
banner[1] = "/images/de_header/willkommen_im_hotel_uhu.gif";
banner[2] = "/images/de_header/willkommen_raucherlounge.gif";
bannerGB[1] = "/images/gb_header/welcome_in_cologne.gif";
bannerGB[2] = "/images/gb_header/welcome_in_the_hotel_uhu.gif";
links = new Array
linksGB = new Array
links[1] = "index.htm"
links[2] = "index.htm"
linksGB[1] = "index.htm"
linksGB[2] = "index.htm"
targets = new Array
targets[1] = "self"
targets[2] = "self"

function randomStart(){
	var randomnumber = Math.random() ;
	var rand1 = Math.round( (bannercount-1) * randomnumber) + 1 ;
	document.images["banner"].src = banner[rand1];
	i = rand1;
	startTimer();
}

function randomStartGB(){
	var randomnumber = Math.random() ;
	var rand1 = Math.round( (bannercount-1) * randomnumber) + 1 ;
	document.images["banner"].src = bannerGB[rand1];
	i = rand1;
	startTimerGB();
}

function startTimer(){
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	closeTime=hours*3600+mins*60+secs;
	closeTime+=bannertime;
	Timer();
}

function startTimerGB(){
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	closeTime=hours*3600+mins*60+secs;
	closeTime+=bannertime;
	TimerGB();
}

function Timer(){
   	var time= new Date();
    hours= time.getHours();
    mins= time.getMinutes();
    secs= time.getSeconds();
    curTime=hours*3600+mins*60+secs
    if (curTime>=closeTime)
	{
		if (i < bannercount)
		{	
			i++;
			document.images["banner"].src = banner[i];
		}
		else
		{
			i = 1;
			document.images["banner"].src = banner[i];
		}
		startTimer();
	}
    else
	{
   		window.setTimeout("Timer()",1000)
	}
}

function TimerGB(){
   	var time= new Date();
    hours= time.getHours();
    mins= time.getMinutes();
    secs= time.getSeconds();
    curTime=hours*3600+mins*60+secs
    if (curTime>=closeTime)
	{
		if (i < bannercount)
		{	
			i++;
			document.images["banner"].src = bannerGB[i];
		}
		else
		{
			i = 1;
			document.images["banner"].src = bannerGB[i];
		}
		startTimerGB();
	}
    else
	{
   		window.setTimeout("TimerGB()",1000)
	}
}

function clickLink(){
	if (targets[i] != "self")
	{
		window.open(links[i], 'VoucherWindow',  'dependent=yes,directories=no,height=450,width=550,left=5,top=5,location=no,menubar=no,titlebar=no,toolbar=no,resizeable=no,scrollbars=no');
	} else self.location.href = links[i]
}

function clickLinkStart(){
	if (targets[i] != "self")
	{
		window.open(links[i], 'VoucherWindow',  'dependent=yes,directories=no,height=450,width=550,left=5,top=5,location=no,menubar=no,titlebar=no,toolbar=no,resizeable=no,scrollbars=no');
	} else self.location.href = links[i]
}

function gst_winLaunch(theURL,winName,targetName,features){
	eval(winName+"=window.open('"+theURL+"','"+targetName+"','"+features+"')")
}
