// CurvyCorners
//addEvent(window, 'load', initBCQJ);

// JQuery
$(document).ready(function(){
	 /*
	  * RoudCorner generatoren:
	  * 	http://www.roundedcornr.com/rc5.php
	  * 	http://www.generateit.net/rounded-corner/index.htm?r=8&fg=DFE0E2&f=jpg&w=300&bg=4E5559&h=200&bc=000000&aa=1&bw=1&submit=Generate+It
	  * 	http://wigflip.com/cornershop/
	  * 	http://spiffybox.com/
	  *
	  *		Button Generator:
	  *			http://www.iwebtoolsonline.com/html-and-css-rounded-corner-button-generator
	  *
	  *		JQ RoundCornders Demo:
	  *			http://www.malsup.com/jquery/corner/
	  * 
	  * Techniken:
	  * 	http://www.cssjuice.com/25-rounded-corners-techniques-with-css/
	  *
	  *	Sonstiges: 
	  *		Async laden von JQPlugins: http://hublog.hubmed.org/archives/001816.html (funkt nur mit timer...)
	  */
	
	//alert("Init JQ");

	// Nur zum testen ob JQ funktioniert
	// $("a").click(function(event) { alert("Thanks for visiting!"); });
	   
	// Sample f. JQ Round Corners (Backgroundcolor + Border muss gesetzt sein)
	// $('#navi-sub').corner();
	  
	//csc-header-n2
	initJQToggle();
	initCycle();
	//initCurvyCorners();
	initFancyBox();
	initSuperFishMenu(); // menu-hv-textbasis muss entsprechend konfiguriert sein, 
	//TopUp.init();  
	
	jQuery("#banner-slideshow").css("visibility","visible");
	
	// Spaltenhhe auf Parent ausrichtent...
	// jQuery("div#left").height(jQuery("div#left").parent().height());
});

/* 
 * Andere Frameworks initialisieren
 */
function initBCQJ() {
	//alert("Init other frameworks...");
	//initCurvyCorners();
}

function initCurvyCorners() {
  var settings = {
    tl: { radius: 8 },
    tr: { radius: 8 },
    bl: { radius: 8 },
    br: { radius: 8 },
    antiAlias: true
  	}
  
  curvyCorners(settings, ".roundcorners");
  curvyCorners(settings, ".csc-frame-frame1");
  //curvyCorners(settings, "fieldset");
}

function initJQToggle() {
	if($(".csc-frame-frame2 h1") == false) return;
	
	//Hide (Collapse) the toggle containers on load
	$(".csc-frame-frame2 h1").parent().siblings().hide();

	//Switch the "Open" and "Close" state per click
	$(".csc-frame-frame2 h1").toggle(function(){
		$(this).addClass("toggleopen");
		}, function () {
		$(this).removeClass("toggleopen");
	});

	//Slide up and down on click
	$(".csc-frame-frame2 h1").click(function(){
		$(this).parent().siblings().slideToggle();
	});
  }

 
/*
 * http://medienfreunde.com/lab/innerfade/
 */
function initCycle() { 
	if(jQuery('#slideshow').children().length == 0) { return };
	
	jQuery('#slideshow').cycle({ 
	    fx:    'fade', 
	    speed:  2500 
	 });
}

function initFancyBox() {
	/* This is basic - uses default settings */
	
	//jQuery("a.fancybox").fancybox();
	if(jQuery('a.fancybox').children().length > 0) {
		jQuery("a.fancybox").fancybox({
			'opacity'		: true,
			'overlayShow'	: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'none',
			'hideOnContentClick': true
		});
	}
	/* Using custom settings */
	
	if(jQuery('a#inline').children().length > 0) {
		jQuery("a#inline").fancybox({
			'hideOnContentClick': true
		});
	}
}

function initSuperFishMenu() {
	if(jQuery('ul.sf-menu').children().length == 0) { return };
	
	jQuery("ul.sf-menu").superfish({
        delay:       800,                            // one second delay on mouseout
        animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation
        speed:       'fast',                          // faster animation speed
        autoArrows:  false,                           // disable generation of arrow mark-up
        dropShadows: false                            // disable drop shadows
    }); 
}

