var messages = new Array();

function hideClass(className) {
    $("div." + className).hide("slow");
}

function bindToolTip() {
	
	if ($('span.help-message').length > 0) {
	
	    $('span.help-message').tooltip({
	        delay:100
	    });
	    
	    $('.no-content').tooltip({ 
	        delay:200,
	        showURL: false
	    });
	    
	}
}

if (typeof(tinyMCE) != 'undefined') {

	tinyMCE.init({ 
	    mode: "specific_textareas",
	    theme: "advanced",
	    plugins:"paste",
	    editor_selector: "wysiwygeditor-simple",
	    theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,undo,redo,|,pastetext,bullist,numlist,",
	    theme_advanced_buttons2: "",
	    theme_advanced_buttons3: "",
	    theme_advanced_toolbar_align:"left",
	    theme_advanced_toolbar_location:"top"
	});
	
}

function loadSifr() {
	
	if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && (!sIFR.UA.bIsWebKit || sIFR.UA.nWebKitVersion >= 100)){sIFR.setup();};
	
	/*---sIFR Settings---*/
	if (typeof sIFR == "function") {
		sIFR.replaceElement(named({
			sSelector: "body #content-container h1 span",
			sFlashSrc: "/public/swf/sifr-arial-rounded-reg.swf",
			sColor: "#7a5622",
			/*sLinkColor: "#000",*/
			/*sBgColor: "#fff",*/
			/*sHoverColor: "#ccc",*/
			/*sCase: "upper",*/
			sWmode: "transparent",
			sFlashVars: "textalign=left" //textalign=center, textalign=right, offsetLeft=6, offsetTop=6, underline=true (seperated by &)
		}));
	};
	if (typeof sIFR == "function") {
		sIFR.replaceElement(named({
			sSelector: "body #poll h1 span",
			sFlashSrc: "/public/swf/sifr-arial-rounded-reg.swf",
			sColor: "#7a5622",
			/*sLinkColor: "#000",*/
			/*sBgColor: "#fff",*/
			/*sHoverColor: "#ccc",*/
			/*sCase: "upper",*/
			sWmode: "transparent",
			sFlashVars: "textalign=left" //textalign=center, textalign=right, offsetLeft=6, offsetTop=6, underline=true (seperated by &)
		}));
	};
	if (typeof sIFR == "function") {
		sIFR.replaceElement(named({
			sSelector: "body #content-container h2 span",
			sFlashSrc: "/public/swf/sifr-arial-rounded-reg.swf",
			sColor: "#f19620",
			sWmode: "transparent",
			sFlashVars: "textalign=left"
		}));
	};
	if (typeof sIFR == "function") {
		sIFR.replaceElement(named({
			sSelector: "body #content-container h3 span",
			sFlashSrc: "/public/swf/sifr-arial-rounded-reg.swf",
			sColor: "#f19620",
			sWmode: "transparent",
			sFlashVars: "textalign=left"
		}));
	};
}

$(document).ready(function() {
						   
	loadSifr();
    
    bindToolTip(); // het binden van de tooltips
    
    $('.clickable-field').each(function() { 
        messages[$(this).attr('id')] = $(this).val();
    });

    $('.clickable-field').focus(function() { 

        if ($(this).val() == messages[($(this).attr('id'))]) {
            $(this).val('');
        }
    });
    
    $('.clickable-field').blur(function() { 
        if ($(this).val() == '') {
            $(this).val(messages[$(this).attr('id')]);
        }
    });
    
    $('.new-window').click(function() { 
        window.open($(this).attr('href'));
    });
    
    $('.inside-window').click(function() { 
        window.location.href = $(this).attr('href');
    });   
    
    $('#add_genietenis').click(function() { 
        
        var aantalGenietenissen = parseInt($('#aantal_genietenissen').html());
        
        $('#aantal_genietenissen').html(aantalGenietenissen + 1);
        $('#genietenis_1').clone().attr('id', 'genietenis_' + (aantalGenietenissen + 1)).appendTo('#genietenissen');
        $('#genietenis_' + (aantalGenietenissen + 1) + ' textarea:first').val('');
    });
     
});
