function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
return [curleft,curtop];
}

/*standort*/
function standort(use_Gmap)
{
var arrayPageSize = getPageSize();
$('#overlay_div').width(arrayPageSize[0]);
$('#overlay_div').height(arrayPageSize[1]);
$('#overlay_div').css({top:'0px', left:'0px', display:'block'});
hideSelectBoxes();
hideFlash();
$('#overlay_div').show();
$('#standort_div').show();
$('#standort_div').load('jax/load_map.jax.php', {'use_Gmap':use_Gmap});
}

function closeStandort(use_Gmap,zoom_out_map)
{
if (use_Gmap==0)
{
$('#map_img').hide();
$('#map_img').src=zoom_out_map;
}
$('#standort_div').hide();
$('#overlay_div').hide();
showSelectBoxes();
showFlash();
}

function change_map_display(use_Gmap)
{
if (use_Gmap=='0') standort(1);
else standort(0);
}

function map_zoom_in(has_Gmap,zoom_in_map)
{
if (has_Gmap==0) {$('#map_img').hide();$('#map_img').src=zoom_in_map;}
else map.zoomIn();
}

function map_zoom_out(has_Gmap,zoom_out_map)
{
if (has_Gmap==0) {$('#map_img').hide();$('#map_img').src=zoom_out_map;}
else map.zoomOut();
}

function map_close(has_Gmap,zoom_out_map)
{
$('#map_img').hide();
if (has_Gmap==0) $('#map_img').src=zoom_out_map;
}

function map_print(use_Gmap)
{
var url_address='map_print.php?use_Gmap='+use_Gmap;
popup = window.open( url_address, 'printpage', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=no,width=' + '708' + ', height=' + '900'  );
popup.focus();
}

/*--------------------------------------------------------------------------*/
/* overlay div */
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.com
//
function getPageScroll(){

var xScroll, yScroll;

if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
xScroll = document.body.scrollLeft;
}

arrayPageScroll = new Array(xScroll,yScroll)
return arrayPageScroll;
}

// -----------------------------------------------------------------------------------

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.com
// Edit for Firefox by pHaez
//
function getPageSize(){

var xScroll, yScroll;

if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}

var windowWidth, windowHeight;

//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);

if (self.innerHeight) {	// all except Explorer
if(document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
} else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}

// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}

//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)

// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = xScroll;
} else {
pageWidth = windowWidth;
}
//	console.log("pageWidth " + pageWidth)

arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}

function showSelectBoxes(){
var selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "visible";
}
}

// ---------------------------------------------------

function hideSelectBoxes(){
var selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "hidden";
}
}

// ---------------------------------------------------

function showFlash(){
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++) {
flashObjects[i].style.visibility = "visible";
}

var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++) {
flashEmbeds[i].style.visibility = "visible";
}
}

// ---------------------------------------------------

function hideFlash(){
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++) {
flashObjects[i].style.visibility = "hidden";
}

var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++) {
flashEmbeds[i].style.visibility = "hidden";
}

}
function setCookie(name, value, expiredays, path, domain, secure) {

if (expiredays) {

var exdate=new Date();

exdate.setDate(exdate.getDate()+expiredays);

var expires = exdate.toGMTString();

}

document.cookie = name + "=" + escape(value) +

((expiredays) ? "; expires=" + expires : "") +

((path) ? "; path=" + path : "") +

((domain) ? "; domain=" + domain : "") +

((secure) ? "; secure" : "");

}

function getCookie(name) {

var cookie = " " + document.cookie;

var search = " " + name + "=";

var setStr = null;

var offset = 0;

var end = 0;

if (cookie.length > 0) {

offset = cookie.indexOf(search);

if (offset != -1) {

offset += search.length;

end = cookie.indexOf(";", offset)

if (end == -1) {

end = cookie.length;

}

setStr = unescape(cookie.substring(offset, end));

}

}

return setStr;

}


