// JavaScript Document
//łśćłżź

/* =================================================== */
/* =================================================== */
/* =================================================== */
/*   Code (HTML/CSS/JavaScript) By: Krystian Lenik     */
/*   Contact:                                          */
/*           GG: 7369412                               */
/*          www: www.webzones.pl                       */
/*       e-mail: brunhild_a_skowronski@o2.pl           */
/*   Date: 06.07.20010                                 */
/*   					                               */
/*   Important Note: 			        		       */
/*	 SCRIPT DEDICATED ONLY FOR DOMAIN www.audiobiel.pl */
/*	 SCRIPT IS NOT FOR RESALE						   */
/* =================================================== */
/* =================================================== */
/* =================================================== */

var DebugQueryMode=true; //Show Alerts
var jDebugMode=false; //Show Alerts
//var IE=false;


var GlobIE8=false;
if(jQuery.browser.msie && jQuery.browser.version == 8){ GlobIE8=true; }
var GlobIE8=false;

/* ================================================================================== */
/* =============================== jquery.ready [START] ============================= */
/* ================================================================================== */
/* =============================== .SliderMVA [START] =============================== */
function jSliderMVA_Set(event){
	try{
		var IDlink=event.data.IDlink;
		var IDslide=event.data.IDslide;
		
		if(jQuery.data(document.body,IDslide).PERM!=true){ return false; }
		else{ jQuery.data(document.body,IDslide,{PERM:false}); }
		
		
		$JQ('#'+IDlink+' li').attr('class','');
		$JQ('#'+IDlink+' li').eq(event.data.LINKindex).attr('class','active');
		var c_fullwidth=parseInt($JQ('#'+IDslide+' ul').css('width'));
		var c_width=parseInt($JQ('#'+IDslide+' li').eq(0).attr('offsetWidth'));
		var c_left=parseInt($JQ('#'+IDslide+' ul').css('left'));
		
		var c_newlt=event.data.LINKindex*c_width*(-1);
		var c_newheight=$JQ('#'+IDslide+' li').eq(event.data.LINKindex).attr('offsetHeight');
		//$JQ('#'+IDslide+' ul').animate({ left:c_newlt },{easing:"easeOutElastic",duration:1500, queue:false, complete:function(){ jQuery.data(document.body,IDslide,{PERM:true});  }}); 
		//$JQ('#'+IDslide).animate({ height:c_newheight },{easing:"swing",duration:750, queue:false, complete:function(){     }}); //setHeight
		
		$JQ('#'+IDslide+' ul').animate({ left:c_newlt },{easing:"easeInOutExpo",duration:1000, queue:false, complete:function(){ jQuery.data(document.body,IDslide,{PERM:true});  }}); 
		$JQ('#'+IDslide).animate({ height:c_newheight },{easing:"swing",duration:750, queue:false, complete:function(){     }}); //setHeight
		//easeInOutExpo
		//alert(c_active);
		return false;
	}catch(err){ if(jDebugMode==true){ alert('jSliderMVA_Set: ' + err); }}
}

function jSliderMVA_Direction(event){
	try{
		var IDlink=event.data.IDlink;
		var c_direction=event.data.Direction;
		
		var elements=$JQ('#'+IDlink+' li');
		var c_active=-1;
		
		for(var i=0;i<elements.length;i++){
			if($JQ(elements).eq(i).attr('class')=='active'){  c_active=i; break; }
		}
		if(c_active==-1){ alert('MVA Error: #50'); return false;  }
		
		switch(c_direction) {
			case 'next': if(c_active<elements.length-1){ c_active+=1; }else{ c_active=0; }  break;
			case 'prev': if(c_active>=1){ c_active-=1; }else{ c_active=elements.length-1; }  break;
			default: return false;
		}
		//alert('ter:'+c_active+' - direction:'+c_direction); 
		if(c_active>=0 && c_active<elements.length){ $JQ(elements).eq(c_active).click(); }
		return false;
	}catch(err){ if(jDebugMode==true){ alert('jSliderMVA_Direction: ' + err); }}
}
			
			
function jSliderMVA(IDprev, IDnext, IDlink, IDslide, Num){
	try{ 
		if(!IDprev || IDprev==''){ return false; }
		if(!IDnext || IDnext==''){ return false; }
		if(!IDlink || IDlink==''){ return false; }
		if(!IDslide || IDslide==''){ return false; }
		if(!Num || Num==''){ Num=-1; }else{ Num=parseInt(Num); }
		
		//alert('test');
		//
		var c_total=$JQ('#'+IDslide+' li').length; //setWidth
		var c_width=parseInt($JQ('#'+IDslide).find('li').eq(0).attr('offsetWidth'));
		var c_height=parseInt($JQ('#'+IDslide).find('li').eq(0).attr('offsetHeight'));
		if(c_total<=0 || c_width<=0){ return false; }

		$JQ('#'+IDslide).animate({ height:c_height },{easing:"swing",duration:750, queue:false, complete:function(){     }}); //setHeight
		$JQ('#'+IDslide+' ul').css('width',parseInt(c_total*c_width));
		$JQ('#'+IDslide+' ul').css('left',0);
		
		
		
		var elements=$JQ('#'+IDlink+' li');
		$JQ(elements).attr('class','');
		if((Num>0 && Num<elements.length) && (c_total==elements.length)){ 
			$JQ(elements).eq(Num).attr('class','active');
			$JQ('#'+IDslide+' ul').css('left',parseInt((-1)*Num*c_width));
			
		}else{ $JQ(elements).eq(0).attr('class','active'); }
		
		jQuery.data(document.body,IDslide,{PERM:true});
		for(var i=0; i<elements.length; i++){
			$JQ(elements).eq(i).bind("click", {IDprev:IDprev, IDnext:IDnext, IDlink:IDlink, IDslide:IDslide, LINKindex:i}, jSliderMVA_Set);
		}
		
		$JQ('#'+IDprev).bind("click", {IDprev:IDprev, IDnext:IDnext, IDlink:IDlink, IDslide:IDslide, Direction:'prev'}, jSliderMVA_Direction);
		$JQ('#'+IDnext).bind("click", {IDprev:IDprev, IDnext:IDnext, IDlink:IDlink, IDslide:IDslide, Direction:'next'}, jSliderMVA_Direction);
		
		jItemHoverAnimation(IDprev);
		jItemHoverAnimation(IDnext);
		//alert($JQ('#'+IDslide+' ul').css('width'));
		//for(var i=0;i<elements.length;i++){
			
		//}
		
		
	}catch(err){ if(jDebugMode==true){ alert('jSliderMVA: ' + err); }}
}
/* =============================== .SliderMVA [END] ================================= */
/* =============================== .SliderMVA2 [START] ============================== */
function jSliderMVA2_Set(event){
	try{
		var IDlink=event.data.IDlink;
		var IDslide=event.data.IDslide;
		
		if(jQuery.data(document.body,IDslide).PERM!=true){ return false; }
		else{ jQuery.data(document.body,IDslide,{PERM:false}); }
		
		
		$JQ('#'+IDlink+' li').attr('class','');
		$JQ('#'+IDlink+' li').eq(event.data.LINKindex).attr('class','active');
		var c_fullwidth=parseInt($JQ('#'+IDslide+' .ul2').css('width'));
		var c_width=parseInt($JQ('#'+IDslide+' .li2').eq(0).attr('offsetWidth'));
		var c_left=parseInt($JQ('#'+IDslide+' .ul2').css('left'));
		
		var c_newlt=event.data.LINKindex*c_width*(-1);
		var c_newheight=$JQ('#'+IDslide+' .li2').eq(event.data.LINKindex).attr('offsetHeight');
		//$JQ('#'+IDslide+' ul').animate({ left:c_newlt },{easing:"easeOutElastic",duration:1500, queue:false, complete:function(){ jQuery.data(document.body,IDslide,{PERM:true});  }}); 
		//$JQ('#'+IDslide).animate({ height:c_newheight },{easing:"swing",duration:750, queue:false, complete:function(){     }}); //setHeight
		
		//$JQ('#'+IDslide+' .ul2').animate({ left:c_newlt },{easing:"easeInOutExpo",duration:1000, queue:false, complete:function(){ jQuery.data(document.body,IDslide,{PERM:true});  }}); 
		
		if(GlobIE8==true){ $JQ('#'+IDslide+' .ul2').find('*').animate({ opacity:0 },{easing:"easeOutSine",duration:300, queue:false }); } //IE8 Path
		$JQ('#'+IDslide+' .ul2').animate({ opacity:0 },{easing:"easeOutSine",duration:300, queue:false, complete:function(){
			$JQ('#'+IDslide+' .ul2').css('left',c_newlt);
			if(GlobIE8==true){ $JQ('#'+IDslide+' .ul2').find('*').animate({ opacity:1 },{easing:"easeInSine",duration:700, queue:false }); } //IE8 Path
			$JQ('#'+IDslide+' .ul2').animate({ opacity:1 },{easing:"easeInSine",duration:700, queue:false, complete:function(){ jQuery.data(document.body,IDslide,{PERM:true});  }}); 
		}}); 
		$JQ('#'+IDslide).animate({ height:c_newheight },{easing:"swing",duration:750, queue:false, complete:function(){     }}); //setHeight
		//easeInOutExpo
		//alert(c_active);
		return false;
	}catch(err){ if(jDebugMode==true){ alert('jSliderMVA2_Set: ' + err); }}
}

function jSliderMVA2_Direction(event){
	try{
		var IDlink=event.data.IDlink;
		var c_direction=event.data.Direction;
		
		var elements=$JQ('#'+IDlink+' li');
		var c_active=-1;
		
		for(var i=0;i<elements.length;i++){
			if($JQ(elements).eq(i).attr('class')=='active'){  c_active=i; break; }
		}
		if(c_active==-1){ alert('MVA2 Error: #50'); return false;  }
		
		switch(c_direction) {
			case 'next': if(c_active<elements.length-1){ c_active+=1; }else{ c_active=0; }  break;
			case 'prev': if(c_active>=1){ c_active-=1; }else{ c_active=elements.length-1; }  break;
			default: return false;
		}
		//alert('ter:'+c_active+' - direction:'+c_direction); 
		if(c_active>=0 && c_active<elements.length){ $JQ(elements).eq(c_active).click(); }
		return false;
	}catch(err){ if(jDebugMode==true){ alert('jSliderMVA2_Direction: ' + err); }}
}
			
			
function jSliderMVA2(IDprev, IDnext, IDlink, IDslide, Num){
	try{ 
		if(!IDprev || IDprev==''){ return false; }
		if(!IDnext || IDnext==''){ return false; }
		if(!IDlink || IDlink==''){ return false; }
		if(!IDslide || IDslide==''){ return false; }
		if(!Num || Num==''){ Num=-1; }else{ Num=parseInt(Num); }
		
		//alert('test');
		//
		var c_total=$JQ('#'+IDslide+' .li2').length; //setWidth
		var c_width=parseInt($JQ('#'+IDslide).find('.li2').eq(0).attr('offsetWidth'));
		if(Num>-1){ var c_height=parseInt($JQ('#'+IDslide).find('.li2').eq(Num).attr('offsetHeight')); }
		else{ var c_height=parseInt($JQ('#'+IDslide).find('.li2').eq(0).attr('offsetHeight')); }
		if(c_total<=0 || c_width<=0){ return false; }

		$JQ('#'+IDslide).animate({ height:c_height },{easing:"swing",duration:750, queue:false, complete:function(){     }}); //setHeight
		$JQ('#'+IDslide).find('.ul2').eq(0).css('width',parseInt(c_total*c_width));
		$JQ('#'+IDslide).find('.ul2').eq(0).css('left',0);
		
		
		var elements=$JQ('#'+IDlink+' li');
		$JQ(elements).attr('class','');
		if((Num>0 && Num<elements.length) && (c_total==elements.length)){ 
			$JQ(elements).eq(Num).attr('class','active');
			$JQ('#'+IDslide+' .ul2').css('left',parseInt((-1)*Num*c_width));
			
		}else{ $JQ(elements).eq(0).attr('class','active'); }
		
		jQuery.data(document.body,IDslide,{PERM:true});
		for(var i=0; i<elements.length; i++){
			$JQ(elements).eq(i).bind("click", {IDprev:IDprev, IDnext:IDnext, IDlink:IDlink, IDslide:IDslide, LINKindex:i}, jSliderMVA2_Set);
		}
		
		$JQ('#'+IDprev).bind("click", {IDprev:IDprev, IDnext:IDnext, IDlink:IDlink, IDslide:IDslide, Direction:'prev'}, jSliderMVA2_Direction);
		$JQ('#'+IDnext).bind("click", {IDprev:IDprev, IDnext:IDnext, IDlink:IDlink, IDslide:IDslide, Direction:'next'}, jSliderMVA2_Direction);
		
		jItemHoverAnimation(IDprev);
		jItemHoverAnimation(IDnext);
		//alert($JQ('#'+IDslide+' ul').css('width'));
		//for(var i=0;i<elements.length;i++){
			
		
		var c_found=false;
		for(var i=0; i<GlobalMVA2Change.length; i++){
			if(GlobalMVA2Change[i]==IDslide){ c_found=true; break; }
		}
		if(c_found==false){
			//alert('sleeper');
			GlobalMVA2Change[GlobalMVA2Change.length]=IDslide;
			jSliderMVA2_Change(IDlink, IDslide);
		}
		//alert(GlobalMVA2Change[0].IDlink);
	}catch(err){ if(jDebugMode==true){ alert('jSliderMVA2: ' + err); }}
}

var GlobalMVA2Change=new Array();
function jSliderMVA2_Change(IDlink, IDslide){
	try{
		if(!IDlink || IDlink==''){ return false; }
		if(!IDslide || IDslide==''){ return false; }
		//alert('test');
		
		elements=$JQ('#'+IDlink+' li');
		var c_found=false;
		for(var i=0; i<elements.length; i++){
			if($JQ(elements).eq(i).attr('class')=='active'){ c_found=true; break; }
		}
		
		if(c_found==true){
			var c_height=parseInt($JQ('#'+IDslide).find('.li2').eq(i).attr('offsetHeight')); 
			$JQ('#'+IDslide).animate({ height:c_height },{easing:"swing",duration:750, queue:false, complete:function(){ self.setTimeout("jSliderMVA2_Change('"+IDlink+"','"+IDslide+"')", 500);  }}); //setHeight
		}else{ self.setTimeout("jSliderMVA2_Change('"+IDlink+"','"+IDslide+"')", 500); }
		
	}catch(err){ if(jDebugMode==true){ alert('jSliderMVA2_Change: ' + err); }}
}
/* =============================== .SliderMVA2 [END] ================================ */
/* =============================== .single [START] ================================== */
function jItemHoverAnimation(Name, Duration){
	try{ 
		if(!Name || Name=='' || Name.length<2){ return false; }
		if(!Duration || Duration==''){ Duration=300; }
		
		switch(Name.charAt(0)){
			case '.': break;
			case '#': break;
			default: Name='#'+Name;
		}
		
		$JQ(Name+' img').css('opacity',0);
		$JQ(Name+' img').css('visibility','visible');
		
		$JQ(Name).hover(function(){
			$JQ(this).find('img').eq(0).animate({ opacity:1 },{easing:"swing",duration:Duration, queue:false, complete:function(){    }});
		},function(){
			$JQ(this).find('img').eq(0).animate({ opacity:0 },{easing:"swing",duration:Duration, queue:false, complete:function(){    }});
		});
		
	}catch(err){ if(jDebugMode==true){ alert('jItemHoverAnimation: ' + err); }}
}

function jMinHeight(Name, Height){
	try{
		if(!Name || Name=='' || Name.length<2){ return false; }
		if(!Height || Height=='' || Height<=0){ return false; }
		
		switch(Name.charAt(0)){
			case '.': break;
			case '#': break;
			default: Name='#'+Name;
		}
		
		var elements=$JQ(Name);
		var c_height;
		
		for(var i=0; i<elements.length;i++){
			//c_height=parseInt($JQ(Name).eq(i).css('height'));
			c_height=parseInt($JQ(Name).eq(i).height()); //IE6 Path;
			if(c_height<Height){ $JQ(Name).eq(i).css('height',Height); }
		}
		return true;
	}catch(err){ if(jDebugMode==true){ alert('jMinHeight: ' + err); }}
}




$JQ(document).ready(function(){

});
/* =============================== .single [END] ==================================== */
/* =============================== .Disabled [START] ================================ */
/* =============================== .Disabled [END] ================================== */
/* ================================================================================== */
/* =============================== jquery.ready [END] =============================== */
/* ================================================================================== */

