﻿/* START jquery */

jQuery(document).ready(function () {
	jQuery("ul.menu_body li:even").addClass("alt");

	jQuery("div.menu_head").click
	/*jQuery("div.menu").hoverIntent
	jQuery("div.menu").click*/
	(
		function()
		{
			jQuery("ul.menu_body").toggle("fast");
		}
		/*,
		function()
		{
			jQuery("ul.menu_body").slideUp();
		}
		*/
	);
	
	
	

	jQuery('ul.menu_body li a').mouseover(function () {
		jQuery(this).animate({ fontSize: "20px", paddingTop: "7px" }, 100);
    });
	
	jQuery('ul.menu_body li a').mouseout(function () {
		jQuery(this).animate({ fontSize: "16px", paddingTop: "7px" }, 100 );
    });
	
		
		
	jQuery("div.projekt").hover(	
		function () 
		{
			jQuery(this).animate({backgroundColor: '#eee'}, 100 );
		},
		function () {
			jQuery(this).animate({backgroundColor: '#fafafa'}, 300 );
		}	
	);
	
	
	
	
	jQuery("a h1").hover(	
		function () 
		{
			jQuery(this).animate({ color:"#bbb"}, 100 );

		},
		function () {
			jQuery(this).animate({ color: "#888"}, 300 );
		}	
	);
	
	
		jQuery(".menu_head").hover(	
		function () 
		{
			jQuery(this).animate({ color:"#aaa"}, 100 );

		},
		function () {
			jQuery(this).animate({ color: "#eee"}, 300 );
		}	
	);
	
	/*
	jQuery('a').tooltip({ 
    track: true, 
    delay: 400, 
    showURL: false, 
    showBody: " - ", 
    fade: 150 
	});
*/

	
});
/* ENDE jquery */


/* Funktion tuneInputs():
	- legt fuer eine beliebige Anzahl an Feldern das Klick-Verhalten fest
	- loescht beim Aktivieren eines Feldes den Default-Value und stellt ihn
	  wieder her, wenn nichts eigegeben wurde
	- erweiterbar, indem dem Array "fields" die IDs der Felder angehaengt werden,
	  die ueberprueft werden sollen
*/


function tuneInputs() {

	fields = new Array();
	fields[0] = "searchQuery";
	
	limit = fields.length;
	currPos = 0;
	
	for (i=0; i<=limit; i++) {
		if(document.getElementById(fields[currPos]) == null) {
			fields.splice(currPos, 1);
			}
		else currPos++;
	}
	
	defaultValue = new Array();
	
	if(fields.length>0) {
		for (c=0; c<fields.length; c++) {
			defaultValue.push(document.getElementById(fields[c]).value);
			document.getElementById(fields[c]).onclick = function () {
				for (c=0; c<fields.length; c++) {
					if(fields[c] == this.id) break;
					}
				if(this.value == defaultValue[c]) this.value = '';
				else return false;
				}
			document.getElementById(fields[c]).onfocus = function () {
				for (c=0; c<fields.length; c++) {
					if(fields[c] == this.id) break;
					}
				if(this.value == defaultValue[c]) this.value = '';
				else return false;
				}
			document.getElementById(fields[c]).onblur = function () {
				if(this.value == '') this.value = defaultValue[c];
				else return false;
			}
		}
	}
}
