/*
this method finds position of id-elements in page
*/

popupWindow_style = new Array();

function getPageCoords (elementId) {
	var coords = {x: 0, y: 0}
	var element;
	if (document.all)
		element = document.all[elementId];
	else if (document.getElementById)
		element = document.getElementById(elementId);
	while (element) {
		coords.x += element.offsetLeft;
		coords.y += element.offsetTop;
		element = element.offsetParent;
	}
	return coords;
}

/*
this method find out height of possible space for content, sets maximum height for content
*/
function setHeight() {
	var coordstop = getPageCoords("div_postop");
	var coordsbottom = getPageCoords("div_posbottom");
	var completeHeight = coordsbottom.y - coordstop.y
	var maxHeight = completeHeight-180;
	// this is the way the standards work
	document.getElementById('content').style.height=maxHeight+"px";
}

/*
this method set cursor-type for area map
*/
function changeTypeofCursor (whicharea, cursortype) {
	document.getElementById(whicharea).style.cursor=cursortype;
}


/*Ticker*/
var tWidth='175px';                  // width (in pixels)
var tHeight='17px';                  // height (in pixels)
var tTop='5px';                      // width (in pixels)
var tLeft='6px';                     // height (in pixels)
var tcolour='transparent';           // background colour:
var moStop=true;                     // pause on mouseover (true or false)
var fontfamily = 'arial,sans-serif'; // font for content
var fsz = 11                         // font size
var tSpeed=2;                        // scroll speed (1 = slow, 5 = fast)

// enter your ticker content here (use \/ and \' in place of / and ' respectively)
var cont1 = '<a href="\/mitgliedschaft\/viele_gute_gruende" style="font-weight:bold; color:#D40E1B; text-decoration:none;">Ab 1. September Mitgliedschaft 2010 zum halben Preis!<\/a>';
var cont2 = '';
var cont3 = '';
var cont4 = '';
var cont5 = '';
var content = cont1+cont2+cont3+cont4+cont5;

// Simple Marquee / Ticker Script
// copyright 3rd January 2006, Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the below code in this script (including this
// comment) is used without any alteration
var cps=tSpeed; var aw, mq;
function startticker(){
	if (document.getElementById && document.getElementById('ticker')) {
		var tick = '<div style="position:relative;top:'+tTop+';left:'+tLeft+';width:'+tWidth+';height:'+tHeight+';overflow:hidden;background-color:'+tcolour+'"'; 
		if (moStop) tick += ' onmouseover="cps=0" onmouseout="cps=tSpeed"'; tick +='><div id="mq" style="position:absolute;left:0px;top:0px;font-family:'+fontfamily+';font-size:'+fsz+'px;white-space:nowrap;"><\/div><\/div>'; 
		document.getElementById('ticker').innerHTML = tick; mq = document.getElementById("mq"); mq.style.left=(parseInt(tWidth)+10)+"px"; mq.innerHTML='<span id="tx">'+content+'<\/span>'; aw = document.getElementById("tx").offsetWidth; lefttime=setInterval("scrollticker()",50);
	}
}
function scrollticker(){
	mq.style.left = (parseInt(mq.style.left)>(-10 - aw)) ?parseInt(mq.style.left)-cps+"px" : parseInt(tWidth)+10+"px";
}
window.onload=startticker;

/* begin image change ***********************************************************/
var interval = 3000; // delay between rotating images (in seconds)
var random_display = 1;


var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("/styles/images/js_slide/dav_beitrag.jpg");

var number_of_image = image_list.length;
function imageItem(image_location) {
	this.image_item = new Image();
	this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
	return(imageObj.image_item.src)
}
function generate(x, y) {
	var range = y - x + 1;
	return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
	if (random_display) {
		image_index = generate(0, number_of_image-1);
	}
	else {
		image_index = (image_index+1) % number_of_image;
	}
	var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
	var new_image = getNextImage();
	document[place].src = new_image;
	var recur_call = "rotateImage('"+place+"')";
	setTimeout(recur_call, interval);
}

/* end image change ************************************************************/


/* begin image change ***********************************************************/
function switchImage(imgName, imgSrc) {
	if (document.getElementById) {
		if (imgSrc != "none") {
			document.getElementById(imgName).src = imgSrc;
		}
	}
}
/* end image change ************************************************************/