//<!-- 


varLeft = 0;
varTop = 0;

function showImageBig(imageObject,img) {
	//getPosition(imageObject) ;
	var imageMouseoverObject = document.getElementById('imageMouseover');
	imageMouseoverObject.onload = function() { 	
		var imageMouseoverObject = document.getElementById('imageMouseover');
		//höhe zentrieren
		imageMouseoverObject.style.top = (( getBodyHeight() - imageMouseoverObject.height) / 2 ) + 'px' ;
	};
	imageMouseoverObject.src = img ;
	imageMouseoverObject.style.display = 'block' ;
	imageMouseoverObject.style.left = varLeft - 150 + 'px' ;
}

function hideImageBig(path) {
	var imageMouseoverObject = document.getElementById('imageMouseover');
	imageMouseoverObject.src = path+'spacer.gif' ;
	imageMouseoverObject.style.display = 'none' ;
}

function getPosition(e) {   
	varTop = 0 ;
	varLeft = 0 ;
	
	if (!e) { e = window.event; }   
	
	var myTarget = e.currentTarget;   
	
	if (!myTarget) {    myTarget = e.srcElement;   }   
	else if (myTarget == "undefined") {    myTarget = e.srcElement;   } 
	
	while(myTarget!= document.body) {      
		//varTop += myTarget.offsetTop;      
		varLeft += myTarget.offsetLeft;      
		myTarget = myTarget.offsetParent;   
	}
} 

function getInnerSize() {
	var winW = 630, winH = 460;
	
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = window.innerWidth;
	  winH = window.innerHeight;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.documentElement.clientWidth;
	  winH = document.documentElement.clientHeight;
	 }
	}
	return [winW, winH] ;
}

function getBodyHeight() {
  if( window.innerHeight && window.scrollMaxY ) {// Firefox  
		pageHeight = window.innerHeight + window.scrollMaxY;
	} else if( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac
		pageHeight = document.body.scrollHeight;
	}	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		pageHeight = document.body.offsetHeight + document.body.offsetTop; 
	}
	return pageHeight ;
}

function getBodyWidth() {
  if( window.innerWidth && window.scrollMaxX ) {// Firefox  
		pageWidth = window.innerWidth + window.scrollMaxX;
	} else if( document.body.scrollWidth > document.body.offsetWidth ) { // all but Explorer Mac
		pageWidth = document.body.scrollWidth;
	}	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
	}
	return pageWidth ;
}

function getScrollHeight() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfY ; //[ scrOfX, scrOfY ];
}

function getScrollWidth() {
	 var scrOfX = 0, scrOfY = 0;
	  if( typeof( window.pageYOffset ) == 'number' ) {
	    //Netscape compliant
	    scrOfY = window.pageYOffset;
	    scrOfX = window.pageXOffset;
	  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	    //DOM compliant
	    scrOfY = document.body.scrollTop;
	    scrOfX = document.body.scrollLeft;
	  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	    //IE6 standards compliant mode
	    scrOfY = document.documentElement.scrollTop;
	    scrOfX = document.documentElement.scrollLeft;
	  }
	  return scrOfX ; //[ scrOfX, scrOfY ];
}

function doOnload() {
	document.onmousedown=dragHandler; 
	initDrag(); 
	
	doOnloadSpecial();
}

function doOnloadSpecial() {
	//dummy: do nothing... will be overwritten in page
}

function showContactForm() {
	displayContactForm('small') ;
	setContentAJAX('kontakt', libpath+'/include/contact_form.php') ;
}

function displayContactForm( size ) {
	var objDiv = document.getElementById('kontakt') ;
	//alert(objDiv);
	if( size != null && size=='big' ) {
		objDiv.style.width = '570px' ;
		objDiv.style.height = '670px' ;
		objDiv.style.left = '350px' ;
		objDiv.style.backgroundImage = 'url('+libpath+'/img/back_eigungscheck.png)';
	} else {
		objDiv.style.width = '500px' ;
		objDiv.style.height = '670px' ;
		objDiv.style.left = '500px' ;
		objDiv.style.backgroundImage = 'url('+libpath+'/img/back_kontakt_500.png)';
	}
	objDiv.style.display = 'block' ;
	objDiv.style.top	= getScrollHeight() + 30 + 'px' ;
	
}
function hideContactForm() {
	document.getElementById('kontakt').style.display = 'none' ;
}

function setContentAJAX(divId, page) {
	var data = '' ;
	//alert(arguments.length);
	
	if(arguments.length>2) {
		try {
			for(var i=2; i<arguments.length; i=i+2) {
				data += arguments[i]+'='+arguments[i+1]+'&' ;
			}
		} catch(e) {
			//alert(e);
		}
	}
	//alert(page) ;
	
	if( $.ajax != null ) { //iQuery
		$.ajax({
			type: "POST",
			url: page,
			data: data,
			//context: document.body,
			success: function(msg){
				$('#'+divId).html(msg);
			}
		});
	} else { //prototype
		new Ajax.Updater(divId, page, 
			{
				method: 'post',
				parameters: data
			}
		);
	}
}

var subnavheadid ;
function showSubNavTop(id) {
	hideSubNavTop() ;
	var objDiv = document.getElementById('subnav'+id) ;
	if(objDiv!=null) {
		objDiv.style.display = 'block';
		subnavheadid = 'subnav' + id ;
	}
}

function hideSubNavTop() {
	if(subnavheadid != null) {
		var objDivStyle = document.getElementById(subnavheadid).style ;
		objDivStyle.display = 'none';
	}
}

//Image Menu
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_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_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 searchFocus( objField ) {
	//alert( objField.value );
	if( objField.value == 'Suche' ) {
		objField.value 			= '' ;
		objField.style.color 	= '#9a9a9a' ;
	} else {
		objField.style.color 	= '#000000' ;
	}
		
}
function searchBlur( objField ) {
	//alert( objField.value );
	if( objField.value == '' ) {
		objField.value 			= 'Suche' ;
		objField.style.color 	= '#9a9a9a' ;
	} else {
		objField.style.color 	= '#000000' ;
	}
}

function loadLink(parameter, valueNew) {
	link   	= document.location.href.substring(0,document.location.href.indexOf('?') ) ;
	link 	+= '?' ;
	if(document.location.search.length > 0) {
      var get_param_str = document.location.search.substring(1, location.search.length);
      var get_params = get_param_str.split("&");
      for(i = 0; i < get_params.length; i++) {
         var key_value = get_params[i].split("=");
         if(key_value.length == 2) {
            var key = key_value[0];
            var value = key_value[1];
            if(key!=parameter) link 	+= key+'='+value+'&' ;
         }
      }      
   }
    link 	+= parameter+'='+valueNew ;
	//alert(link);
	document.location.href = link ;
}
// -->
