/*  #####################################################
**  Domain:    www.sh-business.de
**  Datei:     basic_front.js
**  Funktion:  grundlegender JavaScript Code für frontdoor

**  Erstellt:  03.12.2008

**  Autor:     Michael Degener
**  copyright: infomax websolutions GmbH
##################################################### */

/*  =========================================================

- Login [animieren]
- Teaser Marketing-Mixer [animieren]
- Filter Marketing-Mixer [animieren]
- Teaser-Karussell [animieren]
- Teaser-Angebote [animieren]
- Tagcloud [animieren]

========================================================== */


	//accordion sprachauswahl
	jQuery.fn.extend({
	
  	accordion: function(value,direction,speed,callback){
			if(direction == "v"){
				newHeight = value + "px";
				return this.animate({height: newHeight}, speed, callback);
			}else{
				newWidth = value + "px";
				return this.animate({width: newWidth}, speed, callback);
			}
		}
	});



	//Initialize mixer:
	ddaccordion.init({
			headerclass: "mixer", //Shared CSS class name of headers group
			contentclass: "mixer_item", //Shared CSS class name of contents group
			revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover"
			mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
			collapseprev: false, //Collapse previous content (so only one open at any time)? true/false 
			defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
			onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
			animatedefault: false, //Should contents open by default be animated into view?
			persiststate: false, //persist state of opened contents within browser session?
			toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
			togglehtml: ["suffix", "<img src='img/basket/mixer_closed.gif' /> ", "<img src='img/basket/mixer_open.gif' /> "], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
			animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
			oninit:function(expandedindices){ //custom code to run when headers have initalized
			//do nothing
			},
			onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
			//do nothing
			}
	})
			
	//Initialize filter:
	ddaccordion.init({
			headerclass: "filter_item", //Shared CSS class name of headers group
			contentclass: "filter", //Shared CSS class name of contents group
			revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover"
			mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
			collapseprev: false, //Collapse previous content (so only one open at any time)? true/false 
			defaultexpanded: [0,1,2,3], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
			onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
			animatedefault: false, //Should contents open by default be animated into view?
			persiststate: false, //persist state of opened contents within browser session?
			toggleclass: ["closed", "open"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
			togglehtml: ["prefix", "<img src='img/basket/arrow_closed.gif' /> ", "<img src='img/basket/arrow_open.gif' /> "], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
			animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
			oninit:function(expandedindices){ //custom code to run when headers have initalized
			//do nothing
			},
			onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
			//do nothing
			}
	})
		
			
			
	// teaser-karussell
			
	// tabs
	$(function() {
              $('#karussell').tabs({ fxFade: true, fxSpeed: 'fast' });
        });
			
	// karussell 1
	stepcarousel.setup({
			galleryid: 'carousel1', //id of carousel DIV
			beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
			panelclass: 'contentdiv', //class of panel DIVs each holding content
			autostep: {enable:true, moveby:1, pause:9000},
			panelbehavior: {speed:200, wraparound:false, persist:true},
			defaultbuttons: {enable: false, moveby: 1, leftnav: ['', 0, 0], rightnav: ['', 0, 0]},
			statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
			contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
			})					
						
	// karussell 2
	stepcarousel.setup({
			galleryid: 'carousel2', //id of carousel DIV
			beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
			panelclass: 'contentdiv', //class of panel DIVs each holding content
			autostep: {enable:true, moveby:1, pause:9000},
			panelbehavior: {speed:200, wraparound:false, persist:true},
			defaultbuttons: {enable: false, moveby: 1, leftnav: ['', 0, 0], rightnav: ['', 0, 0]},
			statusvars: ['reportA', 'reportB', 'reportC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
			contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
			})
						
	// karussell 3
	stepcarousel.setup({
			galleryid: 'carousel3', //id of carousel DIV
			beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
			panelclass: 'contentdiv', //class of panel DIVs each holding content
			autostep: {enable:true, moveby:1, pause:9000},
			panelbehavior: {speed:200, wraparound:false, persist:true},
			defaultbuttons: {enable: false, moveby: 1, leftnav: ['', 0, 0], rightnav: ['', 0, 0]},
			statusvars: ['pageA', 'pageB', 'pageC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
			contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
			})
			


$(window).load(function(){
	

	//Slidereffekt für Login
	$("#sprachwahl").accordion("10","v");
	$("#sprachwahl").bind("mouseenter", function(){
		if($("#sprachwahl").height() == "10"){
			$("#sprachwahl").accordion("200","v");
		}
	}).bind("mouseleave", function(){
		$("#sprachwahl").accordion("10","v");
	});
	
	
	//tagcloud
	$("#cloud1").tagcloud({type:"sphere",height:130,power:.4});
	$("#cloud2").tagcloud({type:"sphere",height:130,power:.4});
	$("#cloud3").tagcloud({type:"sphere",height:130,power:.4});
	$("#cloud4").tagcloud({type:"sphere",height:130,power:.4});
	

});

$(document).ready(function(){					   
	//Bild-Teaser Angebotsauswahl
	$("#offer_1").click(function () {
        $("#offer_2").animate({"left": "+=900px"}, "slow"); 
		$("#offer_3").animate({"left": "+=900px"}, "slow");
		$("#offer_4").animate({"left": "+=900px"}, "slow");
		$("#offer_1").fadeOut(2000);
		$("#tagcloud2").css({'display' : 'none'});
		$("#tagcloud3").css({'display' : 'none'});
		$("#tagcloud4").css({'display' : 'none'});
		$("#tagcloud1 .layer").fadeOut(1500);
    });	
	$("#offer_2").click(function () {
        $("#offer_1").animate({"left": "-=900px"}, "slow"); 
		$("#offer_3").animate({"left": "+=900px"}, "slow");
		$("#offer_4").animate({"left": "+=900px"}, "slow");
		$("#offer_2").fadeOut(2000);
		$("#tagcloud1").css({'display' : 'none'});
		$("#tagcloud3").css({'display' : 'none'});
		$("#tagcloud4").css({'display' : 'none'});
		$("#tagcloud2 .layer").fadeOut(1500);
    });	
	$("#offer_3").click(function () {
        $("#offer_1").animate({"left": "-=900px"}, "slow"); 
		$("#offer_2").animate({"left": "-=900px"}, "slow");
		$("#offer_4").animate({"left": "+=900px"}, "slow");
		$("#offer_3").fadeOut(2000);
		$("#tagcloud1").css({'display' : 'none'});
		$("#tagcloud2").css({'display' : 'none'});
		$("#tagcloud4").css({'display' : 'none'});
		$("#tagcloud3 .layer").fadeOut(1500);
    });	
	$("#offer_4").click(function () {
        $("#offer_1").animate({"left": "-=900px"}, "slow"); 
		$("#offer_2").animate({"left": "-=900px"}, "slow");
		$("#offer_3").animate({"left": "-=900px"}, "slow");
		$("#offer_4").fadeOut(2000);
		$("#tagcloud1").css({'display' : 'none'});
		$("#tagcloud2").css({'display' : 'none'});
		$("#tagcloud3").css({'display' : 'none'});
		$("#tagcloud4 .layer").fadeOut(1500);
    });
});

