// MooTools vertikales ein/ausbrlenden Menu

//window.addEvent('domready', function() {
//	
//	var myVerticalSlide = new Fx.Slide('vertical_slide', {
//		duration: 'long'
//	}).hide();
//	
//	a = document.cookie;
//	var cookiewert = a.substring(a.search('=')+1,a.length);
//	//var cookiewert = a.substring(a.search('=')+1,a.search(';'));
//	//if(cookiewert == '')
//	//{cookiewert = a.substr(a.search('=')+1,a.length);}
//	
//	if(cookiewert=='false') myVerticalSlide.show();
//		
//	$('v_toggle').addEvent('click', function(e){
//		e.stop();
//		myVerticalSlide.toggle();
//		document.cookie = 'menu='+myVerticalSlide.open+';';
//	});
//	
//	
//});


/* --------------------- Tooltip --------------------- */

function toolON(id) {
	wmtt = document.getElementById(id);
	
	if( window.ActiveXObject ) {
		/* Dies hier um "springen" von Bild zu verhindern */ 
		x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
		y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
		if (wmtt != null) {
			wmtt.style.left = (x + 0) + "px";
			wmtt.style.top 	= (y + 10) + "px";
		}
	}


	wmtt.style.display = "block"
	document.onmousemove = toolUPD;
}



function toolUPD(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (wmtt != null) {
		wmtt.style.left = (x + 0) + "px";
		wmtt.style.top 	= (y + 10) + "px";
	}
	
}

function toolOFF() {
	wmtt.style.display = "none";
	document.onmousemove = false;
}

/* --------------------- Tooltip ENDE --------------------- */



function mailsend(divname, a2,a1,a3) {

	var result;
	result = '<a href=\"mailto:' + a1 + '@' + a3 + '.' + a2 + '\">' + a1 + '@' + a3 + '.' + a2 + '</a>';
	
	$(divname).innerHTML  = result;

} 

/* Titel ändern */

function changeTitle(newTitle) { 
	document.title = newTitle;
}

//---------------------------- Formulardaten checken -----------------------------------//
function check_form(frm) {
    var elements = $(frm).getElements();
	var complete = true;
	
	for (var i=0; i<elements.length; i++) {
		if(elements[i].type == 'text' || elements[i].type == 'password' || elements[i].type == 'textarea'){
			if(elements[i].value.empty()){
				elements[i].style.backgroundColor = '#FCC';	
				complete = false;
			}
			else {
				elements[i].style.backgroundColor = '#FFF';	
			}			
		}
		
		if(elements[i].id == "email" && !validEmail(elements[i].value)) {
				elements[i].style.backgroundColor = '#FCC';	
				complete = false;
		}
    }
	
	if(complete) {
		$(frm).submit();
	}
	
	
	function validEmail(email) {
		var strReg = "^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$";
		var regex = new RegExp(strReg);
		return(regex.test(email));

	}
}



