jQuery.fn.exists = function(){return jQuery(this).length>0;}

// =============== ANFANG ================================
$(document).ready(
    function () { 
                        
        // ANFANG ------
        var label = $("#topdeco").html();
        
        // --- MENU -------------------------------
        $(".submenu").hover(
                function(){
            		$(this).parent().children("a.mainTabContent").addClass("highlight");
                },
                function(){
            		$(this).parent().children("a.mainTabContent").removeClass("highlight");
                }
        );
        // --- /MENU -------------------------------        
        
        $("#viewlet-above-content").hide();
                
        // Startpage TABs
        //$('#tabs').tabs();
        
        //hover states on the static widgets
        //$('#dialog_link, ul#icons li').hover(
        //    function() { $(this).addClass('ui-state-hover'); }, 
        //    function() { $(this).removeClass('ui-state-hover'); }
        //);

        //$('a.teaser-link').tinyTips('tiny', 'title');
                
        if ( $("#teaser").exists() ) {        
            mcarousel = $("#teaser").msCarousel({
            		boxClass:'div.box',
            		autoSlide:8000,
            		scrollSpeed:1000,
            		loop:true,
            		height:138, 
            		width:696}).data("msCarousel");
            //add click event
         	$("#next").click(function() {
         		//calling next method
         		mcarousel.next();
         	});
         	$("#previous").click(function() {
         		//calling previous method
         		mcarousel.previous();
         	});	
        };        


        // --- zetis-events - booking ---
        var pdf_upload_field = $('#pdf_upload-field > span > a').html();
        var fees_field = $('#fees-field > span').html();
        var nonfree_field = $('#nonfree-field > span').html();
        
        $('#a_pdf_upload-field').attr({'value': pdf_upload_field});
        $('#a_fees-field').attr({'value': fees_field});
        $('#a_nonfree-field').attr({'value': nonfree_field});

        $('#more-infos').hide();

        if (pdf_upload_field != null) {
            if ( pdf_upload_field.length >= '20') {
                $('#more-infos').show();
            }
        };
    	// --- /booking -------------------
        
        // ENDE ---
    }
); 




