var agt = navigator.userAgent.toLowerCase();
var originalFirstChild;

function createTitle(which, string, x, y)
{
	// Displaykoord
	//x = screen.width;
	//y = screen.Height; 

	// Koord des Objektes
	//x = window.event.offsetX;
	//y = window.event.offsetY; 
	
	//funzt //Ereignis = window.event
	//funzt //x = window.event.x;
	//funzt //y = window.event.y; 

	//alert("x="+x+" y="+y);

	// record the original first child (protection when deleting)
	if (typeof(originalFirstChild) == 'undefined')
	{
		originalFirstChild = document.body.firstChild;
	}

	x = document.all ? (event.clientX + document.body.scrollLeft) : x;
	y = document.all ? (event.clientY + document.body.scrollTop) : y;
	//y = document.all ? (event.clientY) : y;

	//x = document.body.scrollTop;
	//b = event.clientY;
	//y = y;
	
	//alert("body="+x+" y="+y);

	element = document.createElement('div');
	element.style.position = 'absolute';
	element.style.zIndex = 1000;
	element.style.visibility = 'hidden';
	excessWidth = 0;
	
	if (document.all)
	{
		excessWidth = 50;
	}
	excessHeight = 20;
	element.innerHTML = '<div class="bodyline"><table width="200" cellspacing="0" cellpadding="0" border="0"><tr><td><table width="100%"><tr><td><span class="gen">' + string + '<\/span><\/td><\/tr><\/table><\/td><\/tr><\/table><\/div>';
	renderedElement = document.body.insertBefore(element, document.body.firstChild);
	renderedWidth = renderedElement.offsetWidth;
	renderedHeight = renderedElement.offsetHeight;
	if(typeof window.innerHeight == 'undefined')
	{
		wiH=0;
	}
	else{
		wiH=window.innerHeight;
	}

	if(typeof window.pageYOffset == 'undefined')
	{
		wpO=0;
		overFlowY = renderedHeight;
	}
	else{
		wpO=window.pageYOffset;
		// fix overflowing off the bottom of the screen
		overFlowY = y + renderedHeight + excessHeight - wiH - wpO;
	}
	if(typeof document.body.offsetWidth == 'undefined')
	{
		dboW=0;
		overFlowX = renderedWidth;
	}
	else{
		dboW=document.body.offsetWidth;
		// fix overflowing off the right side of the screen
		overFlowX = x + renderedWidth + excessWidth - dboW;
	}
	x = overFlowX > 0 ? x - overFlowX : x;
	y = overFlowY > 0 ? y - overFlowY : y;
	if (y<0) y=0;
	if (x<0) x=0;
  
  //alert("x="+x+" y="+y);

	renderedElement.style.top = (y + 15) + 'px';
	renderedElement.style.left = (x + 15) + 'px';

	// windows versions of mozilla are like too fast here...we have to slow it down
	if (agt.indexOf('gecko') != -1 && agt.indexOf('win') != -1)
	{
		setTimeout("renderedElement.style.visibility = 'visible'", 2);
	}
	else
	{
		renderedElement.style.visibility = 'visible';
	}
}

function destroyTitle()
{
	// make sure we don't delete the actual page contents (javascript can get out of alignment)
	if (document.body.firstChild != originalFirstChild)
	{
		document.body.removeChild(document.body.firstChild);
	}
}
function createTitle_swf(which, string, x, y)
{
	w_x = x;
	h_y = y;
	// Displaykoord
	//x = screen.width;
	//y = screen.Height; 

	// Koord des Objektes
	//x = window.event.offsetX;
	//y = window.event.offsetY; 
	
	//funzt //Ereignis = window.event
	//funzt //x = window.event.x;
	//funzt //y = window.event.y; 

	//alert("x="+x+" y="+y);

	// record the original first child (protection when deleting)
	if (typeof(originalFirstChild) == 'undefined')
	{
		originalFirstChild = document.body.firstChild;
	}

	x = document.all ? (event.clientX + document.body.scrollLeft) : x;
	y = document.all ? (event.clientY + document.body.scrollTop) : y;
	//y = document.all ? (event.clientY) : y;

	//x = document.body.scrollTop;
	//b = event.clientY;
	//y = y;
	
	//alert("body="+x+" y="+y);

	element = document.createElement('div');
	element.style.position = 'absolute';
	element.style.zIndex = 1000;
	element.style.visibility = 'hidden';
	excessWidth = 0;
	
	if (document.all)
	{
		excessWidth = 50;
	}
	excessHeight = 20;
	element.innerHTML = '<div><object type="application/x-shockwave-flash" data="' + string + '" WIDTH=' + w_x + 'px HEIGHT=' + h_y +'px><param name="movie" value="' + string + '"><\/object><\/div>'
	renderedElement = document.body.insertBefore(element, document.body.firstChild);
	renderedWidth = renderedElement.offsetWidth;
	renderedHeight = renderedElement.offsetHeight;
	if(typeof window.innerHeight == 'undefined')
	{
		wiH=0;
	}
	else{
		wiH=window.innerHeight;
	}

	if(typeof window.pageYOffset == 'undefined')
	{
		wpO=0;
		overFlowY = renderedHeight;
	}
	else{
		wpO=window.pageYOffset;
		// fix overflowing off the bottom of the screen
		overFlowY = y + renderedHeight + excessHeight - wiH - wpO;
	}
	if(typeof document.body.offsetWidth == 'undefined')
	{
		dboW=0;
		overFlowX = renderedWidth;
	}
	else{
		dboW=document.body.offsetWidth;
		// fix overflowing off the right side of the screen
		overFlowX = x + renderedWidth + excessWidth - dboW;
	}
	x = overFlowX > 0 ? x - overFlowX : x;
	y = overFlowY > 0 ? y - overFlowY : y;
	if (y<0) y=0;
	if (x<0) x=0;
  
  //alert("x="+x+" y="+y);

	renderedElement.style.top = (y + 15) + 'px';
	renderedElement.style.left = (x + 15) + 'px';

	// windows versions of mozilla are like too fast here...we have to slow it down
	if (agt.indexOf('gecko') != -1 && agt.indexOf('win') != -1)
	{
		setTimeout("renderedElement.style.visibility = 'visible'", 2);
	}
	else
	{
		renderedElement.style.visibility = 'visible';
	}
}

function destroyTitle()
{
	// make sure we don't delete the actual page contents (javascript can get out of alignment)
	if (document.body.firstChild != originalFirstChild)
	{
		document.body.removeChild(document.body.firstChild);
	}
}

function position(Ereignis) {
	if(document.all){
		alert("Browser: InternetExplorer\nX:" + window.event.clientX + " - Y:" + window.event.clientY);
		//document.location.href="setting.php?x="+window.event.clientX+"&y="+window.event.clientY;
	} else {
		alert("Browser: Mozilla und Co \nX:" + Ereignis.pageX + " - Y:" + Ereignis.pageY);
		//document.location.href="setting.php?x="+Ereignis.pageX+"&y="+Ereignis.pageY;
	}
}


function getMouseXY(e) {
  var pos = new Coord(0,0);
  if(e.pageX){
    pos.x = e.pageX;	
    pos.y = e.pageY;
  } else if(window.event && window.event.clientX) {
    var isStrictMode = document.compatMode 
        && document.compatMode != 'BackCompat' ? true : false;
    var scrollX = isStrictMode ? 
        document.documentElement.scrollLeft : document.body.scrollLeft;
    var scrollY	= isStrictMode ? 
        document.documentElement.scrollTop : document.body.scrollTop;
    pos.x = window.event.clientX + scrollX;
    pos.y = window.event.clientY + scrollY;
  }
  return pos;
}

function FensterOeffnen (Adresse) {
  MeinFenster = window.open(Adresse, "Zweitfenster", "width=100%,height=100%,left=0,top=0");
  MeinFenster.focus();
}

function mouseX(evt) {
mx = 0;
if (evt.pageX) return evt.pageX;
else if (evt.clientX)
   mx = evt.clientX + (document.documentElement.scrollLeft ?
   document.documentElement.scrollLeft :
   document.body.scrollLeft);
else mx = null;
	alert("x="+mx);
return mx;
}

function mouseY(evt) {
my = 0;
if (evt.pageY) return evt.pageY;
else if (evt.clientY)
   my = evt.clientY + (document.documentElement.scrollTop ?
   document.documentElement.scrollTop :
   document.body.scrollTop);
else my = null;
	alert("y="+my);
return my;
}

var mousex
var mousey;
function getXY(e) {
    if(!e) e = window.event;
    var body = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ?
    window.document.documentElement : window.document.body || null;
    
    mousey = e.pageY ? e.pageY : e.clientY + body.scrollTop;
    mousex = e.pageX ? e.pageX : e.clientX + body.scrollLeft;
window.status = "xMousePos=" + mousex + ", yMousePos=" + mousey;
} 


/*
Dynamic countdown Script- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS,
visit http://www.dynamicdrive.com
*/

function setcountdown(theyear,themonth,theday){
yr=theyear;mo=themonth;da=theday
}

//////////CONFIGURE THE COUNTDOWN SCRIPT HERE//////////////////

//STEP 1: Configure the countdown-to date, in the format year, month, day:
setcountdown(2008,06,28)

//STEP 2: Change the two text below to reflect the occasion, and message to display on that occasion, respectively
var occasion="Beginn der Festwoche (28.06.2008-06.07.2008)!"
var message_on_occasion="Besucht uns JETZT in Merkers!"

//STEP 3: Configure the below 5 variables to set the width, height, background color, and text style of the countdown area
var countdownwidth='480px'
var countdownheight='18px'
var countdownbgcolor='white'
var opentags='<font face="Verdana"><small>'
var closetags='</small></font>'

//////////DO NOT EDIT PASS THIS LINE//////////////////

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var crosscount=''

function start_countdown(){
if (document.layers)
document.countdownnsmain.visibility="show"
else if (document.all||document.getElementById)
crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdownie
countdown()
}

if (document.all||document.getElementById)
document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')

function countdown(){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
futurestring=montharray[mo-1]+" "+da+", "+yr
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
//if on day of occasion
if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=1&&todayd==da){
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+message_on_occasion+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+message_on_occasion+closetags
return
}
//if passed day of occasion
else if (dday<=-1){
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+"Beginn verpasst! "+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+"Beginn verpasst! "+closetags
return
}
//else, if not yet
else{
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+dday+ " Tage, "+dhour+" Stunden, "+dmin+" Minuten, und "+dsec+" Sekunden bis zumS "+occasion+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+dday+ " Tage, "+dhour+" Stunden, "+dmin+" Minuten, und "+dsec+" Sekunden bis zum "+occasion+closetags
}
setTimeout("countdown()",1000)
}
