// JS function for uncrypting spam-protected emails
// http://jumk.de/nospam/
function UnCryptMailto(s) {	
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	return r;
}  
function linkTo_UnCryptMailto(s) {
	location.href=UnCryptMailto(s);
} 
noSpam = function( user, domain ) {
document.location = 'mailto:' + user + '@' + domain;
} 
  
  
// Zeichenzähler Textarea (AddMentor, EditMentor)  
function ShowLength(text, field) {
    document.getElementById(text).innerHTML = document.getElementById(field).value.length;
}  
  
  
// jQuery
$(function() {
    $('#no_js').hide();
    
    // startInfos
    $('#startInfos div p.top').show();
    $('#startInfos a').css({ cursor:"pointer" });
    
    $('#startInfos a.more').click(function() {  
        // toggle the <div>: <a></a><div>
        //console.log($(this).next().text());    
        $(this).next().toggle("normal"); 
        $(this).toggleClass("selected");        
        }).next().hide(); 
        
    $('#startInfos a.more_p').click(function() {  
        // toggle the <div>: <p><a></a></p><div>
        //console.log($(this).parent().next().text());         
        $(this).parent().next().toggle("normal");
        $(this).toggleClass("selected");        
        }).parent().next().hide();     
    
    $('#startInfos p.top a').click(function() {  
        // toggle the <div>: <div><p><a></a></p></div>      
        $(this).parent().parent().toggle("normal");         
        $('#startInfos a').removeClass("selected");    
        }).parent().parent().hide(); 
    
    
    // zertifikat
    $('#zertifikat div p.top').show();
    $('#zertifikat a').css({ cursor:"pointer" });
    
    $('#zertifikat a.more').click(function() {        
        $(this).parent().next().toggle("normal");
        $(this).toggleClass("selected");        
        }).parent().next().hide(); 
    
    $('#zertifikat p.top a').click(function() {    
        $(this).parent().parent().toggle("normal");         
        $('#zertifikat a.more').removeClass("selected");    
        }).parent().parent().hide(); 
        
    // kurse
    $('#col2 div.kurs a.more').show();
    $('#col2 div.kurs a.more').css({ cursor:"pointer" });
    
    $('#col2 div.kurs a.more').click(function() {        
        $(this).parent().next().slideToggle("normal");
        $(this).toggleClass("selected"); 
        $(this).parent().toggleClass("selected"); 
       
        var myclasses = $(this).attr("class");
        var a_myclasses = myclasses.split(" ");
        var kurstyp = a_myclasses[1]; // 'Grund' oder 'Aufbau'        
        $(this).toggleText("« schließen", "weitere " + kurstyp + "kurse »");
        
        }).parent().next().hide();        
    
    $.fn.toggleText = function(a, b) {
        return this.each(function() {
        $(this).text($(this).text() == a ? b : a);   
        });  
    };


    
    
});
  
