// !!! jQuery  instead of $ !!!  //

 /* define variables for "if n4 (Netscape 4), if IE (IE 4.x), 
and if dom (if Netscape 6/W3C-DOM compliant)" */

var n4, ie, dom;

/* detecting browser support for certain key objects/methods and 
assembling a custom document object */

var ieversion;
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
ieversion=new Number(RegExp.$1); // capture x.x portion and store as a number
}

var doc,doc2,doc3,sty;

if (document.layers) {
  doc = "document.";
  doc2 = ".document.";
  doc3 = "";
  sty = "";
  n4 = true;
  }
else if (document.all) {
  doc = "document.all.";
  doc2 = "";
  doc3 = "";
  sty = ".style";
  ie = true;
}

else if (document.getElementById) {
  doc = "document.getElementById('";
  doc2 ="')";
  doc3 ="')";
  sty = "').style";
  dom = "true";
 }


jQuery(window).resize(function(){
  fIni('allBox', 'ocBox');
});

var pageNo;

function fIni(elem1,elem2){
	jQuery(document).ready(function() {
	var w_idth  = jQuery('#'+elem1).width();
	var h_eight = jQuery('#'+elem1).height();
	var win_width = jQuery(window).width();
	var win_height = jQuery(window).height();
	var centerH = win_width/2;
	var centerV = win_height/2;
	var posH = centerH -w_idth/2;
	var posV = centerV -h_eight/2;
	if(win_width>w_idth){
	jQuery('#'+elem1).css({left:posH});
	}else{
	jQuery('#'+elem1).css({left:'30px'});
	}
	if(win_height>h_eight){
	jQuery('#'+elem1).css({top:'0px'});  // ({top:posV});
	}else{
	jQuery('#'+elem1).css({top:'0px'});	
	}
	var x;
	x = jQuery('#'+elem1).offset(); 

	jQuery('#'+elem2).css({left: x.left +660+'px'});    //636
	jQuery('#'+elem2).css({top: x.top +305+'px'});    //35
	jQuery('#'+elem2).css({visibility:'visible'});

	if(pageNo==2){fScrollIni('programmBox','programmC','scrollBar','dragImg')};
	
});}





jQuery(function() {
jQuery("#sendContact").mouseenter(function() {
now();
var txt = jQuery("#subject").val(); +vDatum;
jQuery('#subject').val(txt);
});

jQuery("#contentBoot1Right").click(function(event) {
	jQuery('#contentBootBox1').css({display:'none'});
	jQuery('#contentBootBox2').css({display:'block'});
});

jQuery("#contentBoot1Right").mouseenter(function(event) {vAllBoxPos = jQuery('#allBox').offset(); });
jQuery("#contentBoot1Right").click(function(event) {fBootKontaktIE6(); });

});


/* #cf7Name  #cf7Email   #cf7Message   #cf7Send input */

var vAllBoxPos;

// function for positioning contactform on boot
var fBootKontaktIE6 = function(){ 
	if(pageNo==3 && ie==true && ieversion==6){
	jQuery('#allBox').css({left: vAllBoxPos.left +'px'});
	jQuery('#cf7Name').css({left: vAllBoxPos.left -50+'px'});  
	jQuery('#cf7Name').css({top: vAllBoxPos.top +520+'px'}); 
	jQuery('#cf7Email').css({left: vAllBoxPos.left -50+'px'});  
	jQuery('#cf7Email').css({top: vAllBoxPos.top +522+'px'}); 
	jQuery('#cf7Message').css({left: vAllBoxPos.left -20+'px'});  
	jQuery('#cf7Message').css({top: vAllBoxPos.top +550+'px'}); 
	jQuery('#cf7Send input').css({left: vAllBoxPos.left -22+'px'});  
	jQuery('#cf7Send input').css({top: vAllBoxPos.top +550+'px'}); 
}}



//  #######   SCROLL   ################
// Based on srollP.js by geeeet@ghtml.com
// Thanks a lot!!!

var contentClipH; // ContentBox height
var contentClipT;  //ContentBox left
var contentT; //Content layer Y;
var contentH; // Content height
var vOffC = 30; //content.start.top
var scrollBarT  // scrollBarTop
var scrollH;   // scrollBar height
var scrollLength;  // Number of pixels scrollbar should move
var startY; // Keeps track of offset between mouse and div
var dragH;  //  scrollBtnHeight
var dragT;
var vOffBar = 34;  ////diffValue scrollBar.top - draBar.top
var clickDrag;
var mouseX;
var mouseY;




// INI
function fScrollIni(elem1,elem2,elem3,elem4){
	//contentClipT = jQuery('#'+elem1).offset().top;  
	contentClipT = parseInt(jQuery('#'+elem1).css("top"));
	contentClipH = jQuery('#'+elem1).height();	
	
	contentT = 30;  //parseInt(jQuery('#'+elem2).css("top"));  // IE zeigt 'auto'
	contentH = jQuery('#'+elem2).height();
		
	scrollH = jQuery('#'+elem3).height();
	
	//calculating dragBar height
	dragH = scrollH *(contentClipH /contentH);
	
	//applying dragBar height 
	jQuery('#'+elem4).height(dragH);
	
	x = jQuery('#'+elem3).offset().top;
	scrollBarT = 34;  //parseInt(jQuery('#'+elem3).css("top"));  // IE zeigt 'auto'
	
	//dragT = jQuery('#'+elem4).offset().top;
	dragT = 0;  //parseInt(jQuery("#"+elem4).css("top"));  // IE zeigt 'auto'
	
	scrollLength = ((contentH - contentClipH) /(scrollH - dragH) );
	
	
	if(contentH > contentClipH){
	jQuery('#'+elem4).css({visibility:'visible'})
	}else{
	jQuery('#'+elem4).css({visibility:'hidden'})
	}
	
	if(n4){document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);}
	document.onmousedown = fDown;
	document.onmousemove = fMove;
	document.onmouseup = fUp;

}



jQuery(function() {
//  Cursor
jQuery("#dragImg").mouseover(function(){
	jQuery("#dragImg").css({cursor:'pointer'})
    }).mouseout(function(){
     jQuery("#dragImg").css({cursor:'default'}) 
});


// is mouseDown on scrollbtn
jQuery("#dragImg").mousedown(function(e) {
//clickDrag = true; 
//if(ie){mouseY = e.clientY; 
//}else{mouseY = e.pageY;}
startY = (mouseY - dragT); 
});

jQuery().mouseup(function() {
//clickDrag = false; 
});

});


fGetMouse = function(e){
   if(ie)
   {
      mouseY = event.clientY + document.body.scrollTop;
      mouseX = event.clientX + document.body.scrollLeft;
   }
   else if(n4 || dom)
   {
      mouseY = e.pageY;
      mouseX = e.pageX;
   }
}


var fDown = function(e){
	// Needed for Opera --> else no scrolling
	if (navigator.userAgent.indexOf("Opera") == - 1)
	{
      if((document.layers && e.which != 1) || (document.all && event.button != 1)) return true;
      // Enables the right mousebutton
	}
	
	fGetMouse(e);
	startY = (mouseY - dragT); 

	if(jQuery("#dragImg").mouseover()){
      clickDrag = true;
      return false;
   }
}


var fUp = function(e){
clickDrag = false; 
}


 //jQuery("#dragImg").mousemove(function(e){	});
fMove = function(e){
  if(clickDrag && contentH > contentClipH){
		if(ie){
			mouseY = event.clientY; 
		}else{
			mouseY = e.pageY;
		}

		
		dragT = (mouseY - startY);
		if(dragT < (scrollBarT -vOffBar)){dragT = scrollBarT -vOffBar;}
		if(dragT > ((scrollBarT -vOffBar) + scrollH - dragH)){dragT = ((scrollBarT -vOffBar)+ scrollH - dragH);}
		
		contentT = parseInt((((dragT) - (scrollBarT -vOffBar)) * scrollLength));
		contentT = (contentT -30)*(-1);

		jQuery("#programmC").css({top: contentT +'px'});
		jQuery("#dragImg").css({top: dragT+'px'}); 

		// So ie - pc doesn't select gifs
		if(ie){return false;}
	}
}



var vDatum;
function now(){
	zeit = new Date();
	jahr    = zeit.getFullYear();  //getYear
	monat   = zeit.getMonth() +1;
	wochentag=zeit.getDay();
	tag     = zeit.getDate();  
	stunden = zeit.getHours();
	minuten = zeit.getMinutes();
	sekunden= zeit.getSeconds();
	if(monat<10){monat = "0"+monat}	;		
	if(tag<10){tag = "0"+tag};	
	if(stunden<10){stunden = "0"+stunden};	
	if(minuten<10){minuten = "0"+minuten};	
//	aTag = new Array("sonntag","montag","dienstag","mittwoch","donnerstag","freitag","samstag");
	aMon = new Array("Januar","Februar","Maerz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");
//	anzeige1 = stunden+":"+minuten;
//	anzeige2 = aTag[wochentag]+", den"+tag+":"+aMon[int(monat)-1]+":"+jahr;
vDatum = tag+"."+aMon[parseInt(monat)-1]+"."+jahr+" |"+"| "+stunden+":"+minuten;
//document.forms.formKontakt.vDate.value = vDatum;
}

	
	
	
	
	


	
	
	
	
	







		
	