Cufon.replace('h1.mainheader', { fontFamily: 'philosopher', textShadow: '#000 2px 2px'});
Cufon.replace('.bio-stuff h1', { fontFamily: 'philosopher', textShadow: '#000 2px 2px'});
Cufon.replace('.bio-stuff h2', { fontFamily: 'philosopher', textShadow: '#000 2px 2px'});
Cufon.replace('.bio-stuff h3', { fontFamily: 'philosopher', textShadow: '#000 2px 2px'});


$(document).ready(function() {


	// video player -  playbutton  
	$("img.splash_play_button").fadeTo(1, 0.25);
	$("img.splash_play_button").hover( function(){
		$(this).stop().fadeTo(250, 1.0);
	},function(){
		$(this).stop().fadeTo(250, 0.25);
	});

	
	
	// newsletter overlay
	$("#newsletter a img[rel]").overlay({ expose:{ color:'#000', loadSpeed:200, opacity: 0.7 }, effect:'apple', speed:500, top:'35%', api:true });
	var newsletterApi = $("#newsletter a img[rel]").overlay();
	if (openNL == "1"){
		newsletterApi.load();
	}
	
	// browser-error overlay
	$("#browsererror a[rel]").overlay({ expose:{ color:'#000', loadSpeed:200, opacity: 0.9 }, top:'35%', closeOnClick:false, closeOnEsc:false, api:true });
	var browserError = $("#browsererror a[rel]").overlay();
	
	if ((badBrowser()) || (showError != "")){
		browserError.load();
	}
	
	// upcoming concert - fix for "start:.."
	$("#cbox2 h3").each(function(){
		var d2width = $(this).prev().prev(".date1").width();
		$(this).css("marginLeft",d2width+10);
	});
	
	
	// lightbox on rel="lightbox"
	$("a[rel='lightbox']").lightBox({
		imageLoading: theThemeUrl+'/img/lb/ico-loading.gif',
		imageBtnClose: theThemeUrl+'/img/lb/btn-close.gif',
		imageBtnPrev: theThemeUrl+'/img/lb/btn-prev.gif',
		imageBtnNext: theThemeUrl+'/img/lb/btn-next.gif',
		imageBlank: theThemeUrl+'/img/lb/blank.gif'
   });
	
	// SCROLL TO to sign in guestbook
	$("#guestbooksign").click(function(){
			var targetE = $(this).attr("rel");
			$("#cbox6 .contentleft .boxmask")[0].scrollTo(targetE);
			
			if( $("#author").attr("type") != "hidden" ){
				$("#author").focus();
			}else{
				$("#comment").focus();
			};
			return false;
	});
	
	// SCROLL TO theband
	$("#menuitem1 > a, #logobox1").click(function(){
		$("#menuitem1 > a").addClass("current");
		$("#ddmitem1 > a, #ddmitem2 > a, #ddmitem3 > a, #menuitem2 > a, #menuitem3 > a, #menuitem4 > a, #menuitem5 > a, #menuitem6 > a").removeClass("current");
		flowpane.seekTo(0);
		$("#cbox1 .contentleft .boxmask")[0].scrollTo(0);
		$("#cbox1 .contentright .boxmask")[0].scrollTo(0);
		return false;
	});
	// SCROLL TO streetshows
	$("#ddmitem1 > a").click(function(){
		$("#ddmitem1 > a, #menuitem1 > a").addClass("current");
		$("#ddmitem2 > a, #ddmitem3 > a, #menuitem2 > a, #menuitem3 > a, #menuitem4 > a, #menuitem5 > a, #menuitem6 > a").removeClass("current");
		flowpane.seekTo(0);
		$("#cbox1 .contentleft .boxmask")[0].scrollTo(523);
		$("#cbox1 .contentright .boxmask")[0].scrollTo(0);
		return false;
	});
	// SCROLL TO concerts
	$("#menuitem2 > a").click(function(){
		$("#menuitem2 > a").addClass("current");
		$("#ddmitem1 > a, #ddmitem2 > a, #ddmitem3 > a, #menuitem1 > a, #menuitem3 > a, #menuitem4 > a, #menuitem5 > a, #menuitem6 > a").removeClass("current");
		$("#cbox2 .contentleft .boxmask")[0].scrollTo(0);
		$("#cbox2 .contentright .boxmask")[0].scrollTo(0);
		return false;
	});
	// SCROLL TO media / gallery
	$("#menuitem3 > a, #ddmitem2 > a").click(function(){
		$("#menuitem3 > a, #ddmitem2 > a").addClass("current");
		$("#ddmitem1 > a, #ddmitem3 > a, #menuitem1 > a, #menuitem2 > a, #menuitem4 > a, #menuitem5 > a, #menuitem6 > a").removeClass("current");
		flowpane.seekTo(2);
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(0);
		$("#cbox3 .contentright .boxmask")[0].scrollTo(0);
		return false;
	});
	// SCROLL TO gallery1
	$("#cbox3 #gallery1").click(function(){
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(0);
		return false;
	});
	// SCROLL TO gallery2
	$("#cbox3 #gallery2").click(function(){
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(523);
		return false;
	});
	// SCROLL TO gallery3
	$("#cbox3 #gallery3").click(function(){
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(1046);
		return false;
	});
	// SCROLL TO gallery4
	$("#cbox3 #gallery4").click(function(){
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(1569);
		return false;
	});
	
	// SCROLL TO videos
	$("#ddmitem3 > a").click(function(){
		$("#menuitem3 > a, #ddmitem3 > a").addClass("current");
		$("#ddmitem1 > a, #ddmitem2 > a, #menuitem1 > a, #menuitem2 > a, #menuitem4 > a, #menuitem5 > a, #menuitem6 > a").removeClass("current");
		flowpane.seekTo(2);
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(1046);
		$("#cbox3 .contentright .boxmask")[0].scrollTo(1046);
		return false;
	});
	
	// SCROLL TO video1
	$("#cbox3 #video1").click(function(){
		//$("#cbox3 .contentleft .boxmask")[0].scrollTo(2090);
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(1046);
		return false;
	});
	// SCROLL TO video2
	$("#cbox3 #video2").click(function(){
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(2090);
		//$("#cbox3 .contentleft .boxmask")[0].scrollTo(2610);
		return false;
	});
	// SCROLL TO video3
	$("#cbox3 #video3").click(function(){
		//$("#cbox3 .contentleft .boxmask")[0].scrollTo(3130);
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(2610);
		return false;
	});
	// SCROLL TO video4
	$("#cbox3 #video4").click(function(){
		//$("#cbox3 .contentleft .boxmask")[0].scrollTo(3650);
		$("#cbox3 .contentleft .boxmask")[0].scrollTo(3130);
		return false;
	});
	
	
	// SCROLL TO music
	$("#menuitem4 > a").click(function(){
		$("#menuitem4 > a").addClass("current");
		$("#ddmitem1 > a, #ddmitem2 > a, #ddmitem3 > a, #menuitem1 > a, #menuitem2 > a, #menuitem3 > a, #menuitem5 > a, #menuitem6 > a").removeClass("current");
		$("#cbox4 .contentleft .boxmask")[0].scrollTo(0);
		$("#cbox4 .contentright .boxmask")[0].scrollTo(0);
		return false;
	});
	// SCROLL TO music - vagabonds tale
	$("#cbox4 #album-vagabonds-tale").click(function(){
		$("#cbox4 .contentleft .boxmask")[0].scrollTo(0);
		return false;
	});
	// SCROLL TO music - cobario island
	$("#cbox4 #album-cobario-island").click(function(){
		$("#cbox4 .contentleft .boxmask")[0].scrollTo(523);
		return false;
	});
	// SCROLL TO music - insight
	$("#cbox4 #album-insight").click(function(){
		$("#cbox4 .contentleft .boxmask")[0].scrollTo(1046);
		return false;
	});
	// SCROLL TO shop
	$("#menuitem5 > a").click(function(){
		$("#menuitem5 > a").addClass("current");
		$("#ddmitem1 > a, #ddmitem2 > a, #ddmitem3 > a, #menuitem1 > a, #menuitem2 > a, #menuitem3 > a, #menuitem4 > a, #menuitem6 > a").removeClass("current");
		$("#cbox5 .contentleft .boxmask")[0].scrollTo(0);
		$("#cbox5 .contentright .boxmask")[0].scrollTo(0);
		return false;
	});
	
	
	
	// SCROLL TO shop - full
	$("#cbox5 #full-edition").click(function(){
		$("#cbox5 .contentleft .boxmask")[0].scrollTo(0);
		return false;
	});
	// SCROLL TO shop - double
	$("#cbox5 #double-pack").click(function(){
		$("#cbox5 .contentleft .boxmask")[0].scrollTo(523);
		return false;
	});
	// SCROLL TO shop - vagabonds
	$("#cbox5 #vagabonds-tale").click(function(){
		$("#cbox5 .contentleft .boxmask")[0].scrollTo(1046);
		return false;
	});
	// SCROLL TO shop - cobario island
	$("#cbox5 #cobario-island").click(function(){
		$("#cbox5 .contentleft .boxmask")[0].scrollTo(1569);
		return false;
	});
	// SCROLL TO shop - insight
	$("#cbox5 #insight").click(function(){
		$("#cbox5 .contentleft .boxmask")[0].scrollTo(2092);
		return false;
	});
	
	
	
	// SCROLL TO contact
	$("#menuitem6 > a").click(function(){
		$("#menuitem6 > a").addClass("current");
		$("#ddmitem1 > a, #ddmitem2 > a, #ddmitem3 > a, #menuitem1 > a, #menuitem2 > a, #menuitem3 > a, #menuitem4 > a, #menuitem5 > a").removeClass("current");
		$("#cbox6 .contentleft .boxmask")[0].scrollTo(0);
		$("#cbox6 .contentright .boxmask")[0].scrollTo(0);
		return false;
	});



	// contactform check name for errors
	$("#contactname").keyup(function(){
		var contactName = $(this).val();
		if ((contactName == "") || (contactName.length < 2)){
			$(this).css("border","1px solid red");
		}else{
			$(this).css("border","1px solid black");
		}
	});
	// contactform check mail for errors
	$("#contactmail").keyup(function(){
		var contactMail = $(this).val();
		if ((contactMail == "") || (contactMail.length < 6) || (isValidEmail(contactMail) == false)){
			$(this).css("border","1px solid red");
		}else{
			$(this).css("border","1px solid black");
		}
	});
	// contactform check message for errors
	$("#contactmsg").keyup(function(){
		var contactMsg = $(this).val();
		if ((contactMsg == "") || (contactMsg.length < 10)){
			$(this).css("border","1px solid red");
		}else{
			$(this).css("border","1px solid black");
		}
	});
	
	// contactform submit & check
	$("#submitcontact").click(function(){
		var contactName = $("#contactname").val();
		var contactMail = $("#contactmail").val();
		var contactMsg = $("#contactmsg").val();
		
		if ((contactName == "") || (contactName.length < 2)){
			$("#contactname").focus();
			$("#contactname").css("border","1px solid red");
			return false;
		}
		if ((contactMail == "") || (contactMail.length < 6) || (isValidEmail(contactMail) == false)){
			$("#contactmail").focus();
			$("#contactmail").css("border","1px solid red");
			return false;
		}
		if ((contactMsg == "") || (contactMsg.length < 10)){
			$("#contactmsg").focus();
			$("#contactmsg").css("border","1px solid red");
			return false;
		}
		
		var contactString = $("#contactform").serialize();
		$.ajax({
			beforeSend: function(){
				$("#contactform").append("<div id='loadingtext'>" + loadingtext + "</div>");
				$("#contactname, #contactmail, #contactmsg, #submitcontact").attr("disabled","disabled");
			},
			type:"POST",
			url:theThemeUrl+"/contactform.php",
			data: contactString,
			success: function(){
				$('#contactform').html("<div id='Cmessage'></div>");  
				$('#Cmessage').html("<h2>" + thankstitle + "</h2>")  
				.append("<p>" + thankstext1 + "</p>")  
				.hide().fadeIn(1500);
			}
		});
		return false;
	});
	
	
	
	// GUESTBOOK check name for errors
	$("#author").keyup(function(){
		var guestsName = $(this).val();
		if ((guestsName == "") || (guestsName.length < 2)){
			$(this).css("border","1px solid red");
		}else{
			$(this).css("border","1px solid black");
		}
	});
	// GUESTBOOK check mail for errors
	$("#email").keyup(function(){
		var guestsMail = $(this).val();
		if ((guestsMail == "") || (guestsMail.length < 6) || (isValidEmail(guestsMail) == false)){
			$(this).css("border","1px solid red");
		}else{
			$(this).css("border","1px solid black");
		}
	});
	// GUESTBOOK check message for errors
	$("#comment").keyup(function(){
		var guestsMsg = $(this).val();
		if ((guestsMsg == "") || (guestsMsg.length < 3)){
			$(this).css("border","1px solid red");
		}else{
			$(this).css("border","1px solid black");
		}
	});
	
	// GUESTBOOK
	$("#submit").click(function(){
		var guestsName = $("#author").val();
		var guestsMail = $("#email").val();
		var guestsUrl = $("#url").val();
		var guestsMsg = $("#comment").val();
		
		if ((guestsName == "") || (guestsName.length < 2)){
			$("#author").css("border","1px solid red");
			return false;
		}
		if ((guestsMail == "") || (guestsMail.length < 6) || (isValidEmail(guestsMail) == false)){
			$("#email").css("border","1px solid red");
			return false;
		}
		if ((guestsMsg == "") || (guestsMsg.length < 3)){
			$("#comment").css("border","1px solid red");
			return false;
		}
		
		var guestString = $("#commentform").serialize();

		$.ajax({
			beforeSend: function(){
				$("#commentform").append("<div id='loadingtext'>" + loadingtext + "</div>");
				$("#author, #email, #url, #comment, #submit").attr("disabled","disabled");
			},
			type:"POST",
			url:theBlogUrl+"/wp-comments-post.php",
			data: guestString,
			success: function(data){
			     var response = $("<ol>").html(data);
				$('.commentlist').prepend(response.find('.commentlist li:first').hide().fadeIn(5000));
				
				$('#commentform').html("<div id='Gmessage'></div>");  
				$('#Gmessage').html("<h2>" + guestthankstitle + "</h2>")  
				.append("<p>" + guestthankstext1 + "</p>")  
				.hide().fadeIn(2000);
				
				$("#cbox6 .contentleft .boxmask")[0].scrollTo(0);
			}
		});
		return false;
	});
	
	
	
	
	// validate e-mail
	function isValidEmail(emailAddress) {
		var pattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/;
		return pattern.test(emailAddress);
	}

	// all links to oben in new window defined here
	$(".commentlist a, a.post-edit-link, a.comment-edit-link, #myspace a, #facebook a").attr("target","_blank");


	// scrollbars
	$(".boxmask").jScrollPane({ scrollbarWidth:7, scrollbarMargin:0, wheelSpeed:20, showArrows:false, animateTo:true });
	$("#cbox1 .contentleft .jScrollPaneTrack").hide();
	$("#cbox3 .contentleft .jScrollPaneTrack").hide();
	$("#cbox3 .contentright .jScrollPaneTrack").hide();
	$("#cbox4 .contentleft .jScrollPaneTrack").hide();
	$("#cbox5 .contentleft .jScrollPaneTrack").hide();
	 
	 
	//flowpane
	$("#flowpane").scrollable({size:1, clickable:false, keyboard:false }).navigator({items:'.contentitems', navi:'#menuitems', naviItem:'.mitem > a', activeClass:'current'});
	var flowpane = $("#flowpane").scrollable({api:true, speed:1000 }); 
	
	//arrow
	var stopclouds = true;
	$("#arrow").click(function(){
		if($(this).hasClass("totop")){
			$(this).removeClass("totop").addClass("tobottom");
			$("#woodcontainer").animate({marginTop:"-640px"},1000, "easeOutExpo");
			$("#logobox1").animate({marginLeft:0, left:"20px", top:"20px", width:"150px", height:"60px"},1000, "easeOutExpo");
			$("#logobox2").animate({marginLeft:0, left:"115px", top:"80px", width:"30px", height:"40px"},1000, "easeOutExpo");
			$(continiouclouds);
		}else{
			$(this).removeClass("tobottom").addClass("totop");
			$("#woodcontainer").animate({marginTop:"100px"},1000, "easeOutExpo");
			$("#logobox1").animate({marginLeft:"-475px", left:"50%", top:"20px", width:"300px", height:"120px"},1000, "easeOutExpo");
			$("#logobox2").animate({marginLeft:"-285px", left:"50%", top:"140px", width:"60px", height:"80px"},1000, "easeOutExpo");
			$("#cloud1, #cloud2, #cloud3, #cloud4, #cloud5").stop();
		};
		return false;
	});
	
	
	
	// toplinks fade
	$(".toplink").hover(function(){
		$(this).stop().fadeTo(250,1);
	},function() {
		$(this).stop().fadeTo(250,0.5);
	});
	$(".stylehover").hover(function(){
		if (!$(this).hasClass("active")) {
			var picOver = $(this).find("img").attr("src");
			$(this).css({'background': 'url(' + picOver + ') no-repeat left bottom'});
			$(this).find("span").stop().fadeTo('normal', 0, function(){$(this).hide()});
		};
	},function() {
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
	
	
	// menu dropdowns
	$(".dropdown").each(function(){
		$(this).parent().eq(0).hoverIntent({
			timeout: 250,
			sensitivity: 6,
			over: function(){
				var current = $(".dropdown:eq(0)", this);
				current.slideDown(100);
			},
			out: function(){
				var current = $(".dropdown:eq(0)", this);
				current.fadeOut(400);
			}
		});
	});
	
	
	
	// band-bio tooltips
	$("#rioche").tooltip({tip:'#rioche-bio', effect:'slide', slideInSpeed:750, slideOutSpeed:250, position:'top center', offset:[10,0],
		onBeforeShow:function(){
			$("#rioche span").fadeTo(500, 0);
		},onShow:function(){
			$("#rioche-bio .bioscroll").jScrollPane({ scrollbarWidth:7, scrollbarMargin:0, wheelSpeed:20, animateInterval:30, animateStep:9, showArrows:false, animateTo:true });
		},events: {
			def: "click,mouseout"
		},onBeforeHide:function(){
			$("#rioche span").fadeTo(500, 1);
		},onHide:function(){
			$("#rioche-bio .bioscroll").jScrollPaneRemove();
		}
	});
	$("#herwigos").tooltip({tip:'#herwigos-bio', effect:'slide', slideInSpeed:750, slideOutSpeed:250, position:'top center', offset:[10,0],
		onBeforeShow:function(){
			$("#herwigos span").fadeTo(500, 0);
		},onShow:function(){
			$("#herwigos-bio .bioscroll").jScrollPane({ scrollbarWidth:7, scrollbarMargin:0, wheelSpeed:20, animateInterval:30, animateStep:9, showArrows:false, animateTo:true });
		},events: {
			def: "click,mouseout"
		},onBeforeHide:function(){
			$("#herwigos span").fadeTo(500, 1);
		},onHide:function(){
			$("#herwigos-bio .bioscroll").jScrollPaneRemove();
		}
	});
	$("#elcoba").tooltip({tip:'#elcoba-bio', effect:'slide', slideInSpeed:750, slideOutSpeed:250, position:'top center', offset:[10,0],
		onBeforeShow:function(){
			$("#elcoba span").fadeTo(500, 0);
		},onShow:function(){
			$("#elcoba-bio .bioscroll").jScrollPane({ scrollbarWidth:7, scrollbarMargin:0, wheelSpeed:20, animateInterval:30, animateStep:9, showArrows:false, animateTo:true });
		},events: {
			def: "click,mouseout"
		},onBeforeHide:function(){
			$("#elcoba span").fadeTo(500, 1);
		},onHide:function(){
			$("#elcoba-bio .bioscroll").jScrollPaneRemove();
		}
	});
	
	///// let the music flow
	$(".note1, .note2, .note3, .note4").fadeTo(0, 0);
	var rand1 = Math.floor(Math.random()*500)
	var rand2 = Math.floor(Math.random()*650)
	var rand3 = Math.floor(Math.random()*800)
	var rand4 = Math.floor(Math.random()*1000)
	
	var SineWave1 = function() {
	  this.css = function(p) {
		var s = Math.sin(p*7)
		var x = 150 - p * 150
		var y = s * 50 + 55
		var o = Math.sin(p*3)
		return {bottom: x + "px", left: y + "px", opacity: o}
	}};
	var SineWave2 = function() {
	  this.css = function(p) {
		var s = Math.sin(p*6)
		var x = 150 - p * 140
		var y = s * 50 + 55
		var o = Math.sin(p*3)
		return {bottom: x + "px", left: y + "px", opacity: o}
	}};
	var CosWave1 = function() {
	  this.css = function(p) {
		var s = Math.cos(p*7)
		var x = 150 - p * 150
		var y = s * 50 + 55
		var o = Math.sin(p*3)
		return {bottom: x + "px", left: y + "px", opacity: o}
	}};
	var CosWave2 = function() {
	  this.css = function(p) {
		var s = Math.cos(p*6)
		var x = 150 - p * 140
		var y = s * 50 + 55
		var o = Math.sin(p*3)
		return {bottom: x + "px", left: y + "px", opacity: o}
	}};
	
	function riomusic1(){ $("#musiccontainer1 > .note1").animate({ path: new SineWave1 }, 1900+rand1, riomusic1); };
	function riomusic2(){ $("#musiccontainer1 > .note2").animate({ path: new CosWave2 }, 1400+rand2, riomusic2); };
	function riomusic3(){ $("#musiccontainer1 > .note3").animate({ path: new SineWave1 }, 2100+rand3, riomusic3); }; 
	function riomusic4(){ $("#musiccontainer1 > .note4").animate({ path: new CosWave2 }, 1600+rand4, riomusic4); };
	
	function herwigosmusic1(){ $("#musiccontainer2 > .note4").animate({ path: new SineWave1 }, 1900+rand1, herwigosmusic1); };
	function herwigosmusic2(){ $("#musiccontainer2 > .note3").animate({ path: new CosWave2 }, 1400+rand2, herwigosmusic2); };
	function herwigosmusic3(){ $("#musiccontainer2 > .note2").animate({ path: new SineWave1 }, 2100+rand3, herwigosmusic3); }; 
	function herwigosmusic4(){ $("#musiccontainer2 > .note1").animate({ path: new CosWave2 }, 1600+rand4, herwigosmusic4); };
	
	function elcobamusic1(){ $("#musiccontainer3 > .note1").animate({ path: new SineWave1 }, 1900+rand1, elcobamusic1); };
	function elcobamusic2(){ $("#musiccontainer3 > .note3").animate({ path: new CosWave2 }, 1400+rand2, elcobamusic2); };
	function elcobamusic3(){ $("#musiccontainer3 > .note2").animate({ path: new SineWave1 }, 2100+rand3, elcobamusic3); }; 
	function elcobamusic4(){ $("#musiccontainer3 > .note4").animate({ path: new CosWave2 }, 1600+rand4, elcobamusic4); };
	
	function initRioMusic(){ riomusic1(); riomusic2(); riomusic3(); riomusic4(); };
	function initHerwigosMusic(){ herwigosmusic1(); herwigosmusic2(); herwigosmusic3(); herwigosmusic4(); };
	function initElcobaMusic(){ elcobamusic1(); elcobamusic2(); elcobamusic3(); elcobamusic4(); };
	

	$("#rioche span img").bind("mouseenter", function(){
		$("#musiccontainer1 > *, #musiccontainer2 > *, #musiccontainer3 > *").fadeTo(0, 0).stop();
		initRioMusic();
	});
	$("#rioche span img").bind("mouseleave", function(){
		$("#musiccontainer1 > *").fadeTo(300, 0).stop();
	});
	
	
	$("#herwigos span img").bind("mouseenter", function(){
		$("#musiccontainer1 > *, #musiccontainer2 > *, #musiccontainer3 > *").fadeTo(0, 0).stop();
		initHerwigosMusic();
	});
	$("#herwigos span img").bind("mouseleave", function(){
		$("#musiccontainer2 > *").fadeTo(300, 0).stop();
	});
	
	
	$("#elcoba span img").bind("mouseenter", function(){
		$("#musiccontainer1 > *, #musiccontainer2 > *, #musiccontainer3 > *").fadeTo(0, 0).stop();
		initElcobaMusic();
	});
	$("#elcoba span img").bind("mouseleave", function(){
		$("#musiccontainer3 > *").fadeTo(300, 0).stop();
	});

/*
	initRioMusic();
	initHerwigosMusic();
	initElcobaMusic();
*/
	
	
	

	
	
	// no JS closer
	$("#activateJS .closerX").click(function(){
		$("#activateJS").fadeOut(500);
		return false;
	});
	
	// INITIAL SETUP
	$(".toplink").fadeTo(0,0.5);	// fadeout toplinks
	$("#activateJS").hide()			// hide noJS box
	$("#maincontainer").fullbg();	// full bg
});




/* DETECT OLD BROWSERS */
function badBrowser() {
	var userAgent = navigator.userAgent.toLowerCase();
	
	// Check for Microsoft Internet Explorer <= 7
	if ($.browser.msie && parseInt($.browser.version, 10) <= 7) {
		return true;
	}
	// Check for Opera 9.5
	if ($.browser.opera && ($.browser.version *10) <= 95) {
		return true;
	}
	// Check for Mozilla Firefox 3.0
	if (/firefox[\/\s](\d+\.\d+)/.test(userAgent)) {
		var ffversion = Number(RegExp.$1);
		if ((ffversion *1) < 3) {
			return true;
		}
	}
	// Check for Safari < Version 4.0
	if (/safari[\/\s](\d+\.\d+)/.test(userAgent) && !/chrome[\/\s](\d+\.\d+)/.test(userAgent)) {
		var safari = userAgent.indexOf('version');
		if (safari > -1) {
			var snip1 = safari+8;
			var version = userAgent.substring(snip1, (snip1+1));
			if (version < 4) {
				return true;
			}
		}
	}
	// Check for Chrome < Version 2.0
	var chrome = userAgent.indexOf('chrome');
	if ($.browser.webkit) {
		chromeVersion = userAgent.substring(userAgent.indexOf('chrome/') +7);
		chromeVersion = chromeVersion.substring(0,userAgent.indexOf('.'));	
		if(chromeVersion >= 10){
			return true;
		}
	}
    return false;
}



/* FULLBG */
(function($){
	$.fn.fullbg = function() {
		var options = $.extend($.fn.fullbg.defaults, $.fn.fullbg.options);
		$(window).bind("load", function(){ $('#maincontainer').fadeIn('fast'); });				
		$(document).ready(function() { $('#maincontainer').resizenow(); });		
		$(window).bind("resize", function(){ $('#maincontainer').resizenow(); });
		$('#maincontainer').hide();
	};
	$.fn.resizenow = function() {
		var options = $.extend($.fn.fullbg.defaults, $.fn.fullbg.options);
	  	return this.each(function() {
			var ratio = options.startheight/options.startwidth;
			var imagewidth = $(this).width();
			var imageheight = $(this).height();
			var browserwidth = $(window).width();
			var browserheight = $(window).height();
			if ((browserheight/browserwidth) > ratio){
			    $(this).height(browserheight);
			    $(this).width(browserheight / ratio);
			} else {
			    $(this).width(browserwidth);
			    $(this).height(browserwidth * ratio);
			}
			return false;
		});
	};
	$.fn.fullbg.defaults = { startwidth:1400, startheight:985 };
})(jQuery);


/* jQuery Easing v1.3 */

jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});



/* mouse-weel v3.0 */
(function($){$.event.special.mousewheel={setup:function(){var handler=$.event.special.mousewheel.handler;if($.browser.mozilla)$(this).bind('mousemove.mousewheel',function(event){$.data(this,'mwcursorposdata',{pageX:event.pageX,pageY:event.pageY,clientX:event.clientX,clientY:event.clientY})});if(this.addEventListener)this.addEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else this.onmousewheel=handler},teardown:function(){var handler=$.event.special.mousewheel.handler;$(this).unbind('mousemove.mousewheel');if(this.removeEventListener)this.removeEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else this.onmousewheel=function(){};$.removeData(this,'mwcursorposdata')},handler:function(event){var args=Array.prototype.slice.call(arguments,1);event=$.event.fix(event||window.event);$.extend(event,$.data(this,'mwcursorposdata')||{});var delta=0,returnValue=true;if(event.wheelDelta)delta=event.wheelDelta/120;if(event.detail)delta=-event.detail/3;event.data=event.data||{};event.type="mousewheel";args.unshift(delta);args.unshift(event);return $.event.handle.apply(this,args)}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}})})(jQuery);

/* jQEm v1.0 */
jQuery(function($){var eventName='emchange';$.em=$.extend({version:'1.0',delay:200,element:$('<div />').css({left:'-100em',position:'absolute',width:'100em'}).prependTo('body')[0],action:function(){var currentWidth=$.em.element.offsetWidth/100;if(currentWidth!=$.em.current){$.em.previous=$.em.current;$.em.current=currentWidth;$.event.trigger(eventName,[$.em.current,$.em.previous])}}},$.em);$.fn[eventName]=function(fn){return fn?this.bind(eventName,fn):this.trigger(eventName)};$.em.current=$.em.element.offsetWidth/100;$.em.iid=setInterval($.em.action,$.em.delay)});

/* jScrollPane */
(function($){$.jScrollPane={active:[]};$.fn.jScrollPane=function(settings){settings=$.extend({},$.fn.jScrollPane.defaults,settings);var rf=function(){return false;};return this.each(function(){var $this=$(this);var paneEle=this;var currentScrollPosition=0;var paneWidth;var paneHeight;var trackHeight;var trackOffset=settings.topCapHeight;if($(this).parent().is('.jScrollPaneContainer')){currentScrollPosition=settings.maintainPosition?$this.position().top:0;var $c=$(this).parent();paneWidth=$c.innerWidth();paneHeight=$c.outerHeight();$('>.jScrollPaneTrack,>.jScrollArrowUp,>.jScrollArrowDown,>.jScrollCap',$c).remove();$this.css({'top':0});}else{$this.data('originalStyleTag',$this.attr('style'));$this.css('overflow','hidden');this.originalPadding=$this.css('paddingTop')+' '+$this.css('paddingRight')+' '+$this.css('paddingBottom')+' '+$this.css('paddingLeft');this.originalSidePaddingTotal=(parseInt($this.css('paddingLeft'))||0)+(parseInt($this.css('paddingRight'))||0);paneWidth=$this.innerWidth();paneHeight=$this.innerHeight();var $container=$('<div></div>').attr({'className':'jScrollPaneContainer'}).css({'height':paneHeight+'px','width':paneWidth+'px'});if(settings.enableKeyboardNavigation){$container.attr('tabindex',settings.tabIndex);}$this.wrap($container);$(document).bind('emchange',function(e,cur,prev){$this.jScrollPane(settings);});}trackHeight=paneHeight;if(settings.reinitialiseOnImageLoad){var $imagesToLoad=$.data(paneEle,'jScrollPaneImagesToLoad')||$('img',$this);var loadedImages=[];if($imagesToLoad.length){$imagesToLoad.each(function(i, val){$(this).bind('load readystatechange',function(){if($.inArray(i, loadedImages)==-1){loadedImages.push(val);$imagesToLoad=$.grep($imagesToLoad,function(n, i){return n != val;});$.data(paneEle,'jScrollPaneImagesToLoad',$imagesToLoad);var s2=$.extend(settings, {reinitialiseOnImageLoad:false});$this.jScrollPane(s2);}}).each(function(i, val){if(this.complete||this.complete===undefined){this.src=this.src;}});});};}var p=this.originalSidePaddingTotal;var realPaneWidth=paneWidth-settings.scrollbarWidth-settings.scrollbarMargin-p;var cssToApply={'height':'auto','width':realPaneWidth+'px'}
 if(settings.scrollbarOnLeft){cssToApply.paddingLeft=settings.scrollbarMargin+settings.scrollbarWidth+'px';} else {cssToApply.paddingRight=settings.scrollbarMargin+'px';}$this.css(cssToApply);var contentHeight=$this.outerHeight();var percentInView=paneHeight/contentHeight;
if(percentInView<.99){var $container=$this.parent();$container.append($('<div></div>').addClass('jScrollCap jScrollCapTop').css({height:settings.topCapHeight}),$('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append($('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append($('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),$('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'}))),$('<div></div>').addClass('jScrollCap jScrollCapBottom').css({height:settings.bottomCapHeight}));var $track=$('>.jScrollPaneTrack',$container);var $drag=$('>.jScrollPaneTrack .jScrollPaneDrag',$container);var currentArrowDirection;var currentArrowTimerArr=[];var currentArrowInc;var whileArrowButtonDown=function(){ if(currentArrowInc>4||currentArrowInc%4==0){positionDrag(dragPosition+currentArrowDirection*mouseWheelMultiplier);}currentArrowInc++;};if(settings.enableKeyboardNavigation){$container.bind('keydown.jscrollpane',function(e){switch(e.keyCode){case 38:currentArrowDirection=-1;currentArrowInc=0;whileArrowButtonDown();currentArrowTimerArr[currentArrowTimerArr.length]=setInterval(whileArrowButtonDown,100);return false;case 40:currentArrowDirection=1;currentArrowInc=0;whileArrowButtonDown();currentArrowTimerArr[currentArrowTimerArr.length]=setInterval(whileArrowButtonDown,100);return false;case 33:case 34:return false;default:}}).bind('keyup.jscrollpane',function(e){if(e.keyCode==38||e.keyCode==40){for(var i=0;i<currentArrowTimerArr.length;i++){clearInterval(currentArrowTimerArr[i]);}return false;}});}if(settings.showArrows){var currentArrowButton;var currentArrowInterval;var onArrowMouseUp=function(event){$('html').unbind('mouseup',onArrowMouseUp);currentArrowButton.removeClass('jScrollActiveArrowButton');clearInterval(currentArrowInterval);};var onArrowMouseDown=function(){$('html').bind('mouseup',onArrowMouseUp);currentArrowButton.addClass('jScrollActiveArrowButton');currentArrowInc=0;whileArrowButtonDown();currentArrowInterval=setInterval(whileArrowButtonDown,100);};$container.append($('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowUp','tabindex':-1}).css({'width':settings.scrollbarWidth+'px','top':settings.topCapHeight+'px'}).html('Scroll up').bind('mousedown',function(){currentArrowButton=$(this);currentArrowDirection=-1;onArrowMouseDown();this.blur();return false;}).bind('click',rf),$('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowDown','tabindex':-1}).css({'width':settings.scrollbarWidth+'px','bottom':settings.bottomCapHeight+'px'}).html('Scroll down').bind('mousedown',function(){currentArrowButton=$(this);currentArrowDirection=1;onArrowMouseDown();this.blur();return false;}).bind('click',rf));var $upArrow=$('>.jScrollArrowUp',$container);var $downArrow=$('>.jScrollArrowDown',$container);}if(settings.arrowSize){trackHeight=paneHeight-settings.arrowSize-settings.arrowSize;trackOffset+=settings.arrowSize;}else if($upArrow){var topArrowHeight=$upArrow.height();settings.arrowSize=topArrowHeight;trackHeight=paneHeight-topArrowHeight-$downArrow.height();trackOffset+=topArrowHeight;}trackHeight-=settings.topCapHeight+settings.bottomCapHeight;$track.css({'height':trackHeight+'px',top:trackOffset+'px'})
var $pane=$(this).css({'position':'absolute','overflow':'visible'});var currentOffset;var maxY;var mouseWheelMultiplier;var dragPosition=0;var dragMiddle=percentInView*paneHeight/2;var getPos=function(event, c){var p=c=='X'?'Left':'Top';return event['page'+c]||(event['client'+c]+(document.documentElement['scroll'+p]||document.body['scroll'+p]))||0;};var ignoreNativeDrag=function(){return false;};var initDrag=function(){ceaseAnimation();currentOffset=$drag.offset(false);currentOffset.top-=dragPosition;maxY=trackHeight-$drag[0].offsetHeight;mouseWheelMultiplier=2*settings.wheelSpeed*maxY/contentHeight;};var onStartDrag=function(event){initDrag();dragMiddle=getPos(event,'Y')-dragPosition-currentOffset.top;$('html').bind('mouseup',onStopDrag).bind('mousemove',updateScroll);if($.browser.msie){$('html').bind('dragstart',ignoreNativeDrag).bind('selectstart',ignoreNativeDrag);}return false;};var onStopDrag=function(){$('html').unbind('mouseup',onStopDrag).unbind('mousemove',updateScroll);dragMiddle=percentInView*paneHeight/2;if($.browser.msie){$('html').unbind('dragstart',ignoreNativeDrag).unbind('selectstart',ignoreNativeDrag);}};var positionDrag=function(destY){$container.scrollTop(0);destY=destY<0?0:(destY>maxY?maxY:destY);dragPosition=destY;$drag.css({'top':destY+'px'});var p=destY/maxY;$this.data('jScrollPanePosition',(paneHeight-contentHeight)*-p);$pane.css({'top':((paneHeight-contentHeight)*p)+'px'});$this.trigger('scroll');if(settings.showArrows){$upArrow[destY==0?'addClass':'removeClass']('disabled');$downArrow[destY==maxY?'addClass':'removeClass']('disabled');}};var updateScroll=function(e){positionDrag(getPos(e,'Y')-currentOffset.top-dragMiddle);};var dragH=Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2),settings.dragMaxHeight),settings.dragMinHeight);$drag.css({'height':dragH+'px'}).bind('mousedown',onStartDrag);var trackScrollInterval;var trackScrollInc;var trackScrollMousePos;var doTrackScroll=function(){if(trackScrollInc>8||trackScrollInc%4==0){positionDrag((dragPosition-((dragPosition-trackScrollMousePos)/2)));}trackScrollInc ++;};var onStopTrackClick=function(){clearInterval(trackScrollInterval);$('html').unbind('mouseup',onStopTrackClick).unbind('mousemove',onTrackMouseMove);};var onTrackMouseMove=function(event){trackScrollMousePos=getPos(event,'Y')-currentOffset.top-dragMiddle;};var onTrackClick=function(event){initDrag();onTrackMouseMove(event);trackScrollInc=0;$('html').bind('mouseup',onStopTrackClick).bind('mousemove',onTrackMouseMove);trackScrollInterval=setInterval(doTrackScroll,100);doTrackScroll();return false;};$track.bind('mousedown',onTrackClick);$container.bind('mousewheel',function(event,delta){delta=delta||(event.wheelDelta?event.wheelDelta/120:(event.detail)?-event.detail/3:0);initDrag();ceaseAnimation();var d=dragPosition;positionDrag(dragPosition-delta*mouseWheelMultiplier);var dragOccured=d!=dragPosition;return!dragOccured;});var _animateToPosition;var _animateToInterval;function animateToPosition(){var diff=(_animateToPosition-dragPosition)/settings.animateStep;if(diff>1||diff<-1){positionDrag(dragPosition+diff);}else{positionDrag(_animateToPosition);ceaseAnimation();}}var ceaseAnimation=function(){if(_animateToInterval){clearInterval(_animateToInterval);delete _animateToPosition;}};var scrollTo=function(pos,preventAni){if(typeof pos=="string"){$e=$(pos,$this);if(!$e.length) return;pos=$e.offset().top-$this.offset().top;}ceaseAnimation();var maxScroll=contentHeight-paneHeight;pos=pos>maxScroll?maxScroll:pos;$this.data('jScrollPaneMaxScroll',maxScroll);var destDragPosition=pos/maxScroll*maxY;if(preventAni||!settings.animateTo){positionDrag(destDragPosition);}else{$container.scrollTop(0);_animateToPosition=destDragPosition;_animateToInterval=setInterval(animateToPosition,settings.animateInterval);}};$this[0].scrollTo=scrollTo;$this[0].scrollBy=function(delta){var currentPos=-parseInt($pane.css('top'))||0;scrollTo(currentPos+delta);};initDrag();scrollTo(-currentScrollPosition,true);$('*',this).bind('focus',function(event){var $e=$(this);var eleTop=0;while($e[0]!=$this[0]){eleTop+=$e.position().top;$e=$e.offsetParent();}var viewportTop=-parseInt($pane.css('top'))||0;var maxVisibleEleTop=viewportTop+paneHeight;var eleInView=eleTop>viewportTop&&eleTop<maxVisibleEleTop;if(!eleInView){var destPos=eleTop-settings.scrollbarMargin;if(eleTop>viewportTop){destPos+=$(this).height()+15+settings.scrollbarMargin-paneHeight;}scrollTo(destPos);}})
if(location.hash&&location.hash.length>1){setTimeout(function(){scrollTo(location.hash);},$.browser.safari?100:0);}$(document).bind('click',function(e){$target=$(e.target);if($target.is('a')){var h=$target.attr('href');if(h&&h.substr(0,1)=='#'&&h.length>1){setTimeout(function(){scrollTo(h,!settings.animateToInternalLinks);},$.browser.safari?100:0);}}});function onSelectScrollMouseDown(e){$(document).bind('mousemove.jScrollPaneDragging',onTextSelectionScrollMouseMove);$(document).bind('mouseup.jScrollPaneDragging',onSelectScrollMouseUp);}var textDragDistanceAway;var textSelectionInterval;function onTextSelectionInterval(){direction=textDragDistanceAway<0?-1:1;$this[0].scrollBy(textDragDistanceAway/2);}function clearTextSelectionInterval(){if(textSelectionInterval){clearInterval(textSelectionInterval);textSelectionInterval=undefined;}}function onTextSelectionScrollMouseMove(e){var offset=$this.parent().offset().top;var maxOffset=offset+paneHeight;var mouseOffset=getPos(e,'Y');textDragDistanceAway=mouseOffset<offset?mouseOffset-offset:(mouseOffset>maxOffset?mouseOffset-maxOffset:0);if(textDragDistanceAway==0){clearTextSelectionInterval();}else{if(!textSelectionInterval){textSelectionInterval=setInterval(onTextSelectionInterval,100);}}}function onSelectScrollMouseUp(e){$(document).unbind('mousemove.jScrollPaneDragging').unbind('mouseup.jScrollPaneDragging');clearTextSelectionInterval();}$container.bind('mousedown.jScrollPane',onSelectScrollMouseDown);$.jScrollPane.active.push($this[0]);}else{$this.css({'height':paneHeight+'px','width':paneWidth-this.originalSidePaddingTotal+'px','padding':this.originalPadding});$this[0].scrollTo=$this[0].scrollBy=function(){};$this.parent().unbind('mousewheel').unbind('mousedown.jScrollPane').unbind('keydown.jscrollpane').unbind('keyup.jscrollpane');}})};$.fn.jScrollPaneRemove=function(){$(this).each(function(){$this=$(this);var $c=$this.parent();if($c.is('.jScrollPaneContainer')){$this.css({'top':'','height':'','width':'','padding':'','overflow':'','position':''});$this.attr('style',$this.data('originalStyleTag'));$c.after($this).remove();}});}
$.fn.jScrollPane.defaults={scrollbarWidth:10,scrollbarMargin:5,wheelSpeed:18,showArrows:false,arrowSize:0,animateTo:false,dragMinHeight:1,dragMaxHeight:99999,animateInterval:100,animateStep:3,maintainPosition:true,scrollbarOnLeft:false,reinitialiseOnImageLoad:false,tabIndex:0,enableKeyboardNavigation:true,animateToInternalLinks:false,topCapHeight:0,bottomCapHeight:0};$(window).bind('unload',function(){var els=$.jScrollPane.active;for(var i=0;i<els.length;i++){els[i].scrollTo=els[i].scrollBy=null;}});})(jQuery);



