$(document).ready(function() {

$('#tabs').tabs();

// Main Menu
//function menu(obj) {
//if (!obj.length) return;
//$('#menu').removeClass('use-hover');
//
//}
    
//    $('#menu > li > ul')
//		.hide()
//		.click(function(e){
//			e.stopPropagation();
//		})
//		
//		$('#menu > li').toggle( function() {
//			$(this).find('ul').slideDown();
//		}, function() {
//			$(this).find('ul').slideUp();
//		});

  //General Shuffle function for an array
  $.shuffle = function(arr) {
  for (
  var j, x, i = arr.length; i;
  j = parseInt(Math.random() * i),
  x = arr[--i],arr[i] = arr[j],arr[j] = x
  );
  return arr;
  };
  
  //Song titel;
  var myTitles=new Array();
  myTitles[0]="Fluid To Gas - Fire";
  myTitles[1]="Fuse And - What Is The Mood for a Song";
  myTitles[2]="Blockshot - A girl's toolbox";
  
  
  
 // Song Counter:
  var mySongs=new Array();
  mySongs[0]="http://www.f-spin.de/bands/fluidtogas/mp3/lemons for lunch/Fluid To Gas - Fire.mp3";
  mySongs[1]="http://www.f-spin.de/bands/fuseand/mp3/what_is_the_mood.mp3";
  mySongs[2]="http://www.f-spin.de/blockshot/Blockshot - After The Beep - 09 A girl's toolbox.mp3";

  var shuffledSongs= $.shuffle(mySongs);
  
  //Show Songtitle

	//jPlayer previous Button
	var i = 0;
	$('.jp-prev')
	.click( function(){
		if( i <= 0 ){
			i = 0;
			$('#jquery_jplayer_1').jPlayer("stop");
			current_song = shuffledSongs[i];		
			$('#jquery_jplayer_1').jPlayer("setMedia", {
					mp3: shuffledSongs[i],
			})
			.jPlayer("stop");
		}	else {
				$('#jquery_jplayer_1').jPlayer("stop");
				i--;
				current_song = mySongs[i];		
				$('#jquery_jplayer_1').jPlayer("setMedia", {
						mp3: shuffledSongs[i]
				})
				.jPlayer("play");		
		}

	});    
    
	
	//jPlayer next Button
	var i = 0;
	$('.jp-next')
	.click( function(){
		if ( i >= 2 ) {
			i = 2;
			$('#jquery_jplayer_1').jPlayer("stop");
			current_song = shuffledSongs[i];		
			$('#jquery_jplayer_1').jPlayer("setMedia", {
					mp3: shuffledSongs[i],
			})
			.jPlayer("stop");			
		} else {
			$('#jquery_jplayer_1').jPlayer("stop");
			i++;
			current_song = shuffledSongs[i];		
			$('#jquery_jplayer_1').jPlayer("setMedia", {
					mp3: shuffledSongs[i],
			})
			.jPlayer("play");
		}
	});

    
    
  //The jPlayer   
  	
    
	$('#jquery_jplayer_1').jPlayer({
		ready: function () {
			$(this).jPlayer("setMedia", {
				mp3: shuffledSongs[i],
			})
			.jPlayer("play");
		},
		ended: function (event) {
			$(this).jPlayer("stop");
		},
		volume: "0.8",
		swfPath: "../js",
		supplied: "mp3"
		
	});	
	
   $('.hide_content').click( function() {
	 	$('.content').toggle()
	 });
	
	
	// Bandpage
//	$('span.img_p')
//	.next()
//	.hide();
//	
//	
//	$('span.img_p').mouseover( function() {
//		$(this).next().show();
//	});
//	$('span.img_p').mouseout( function() {
//		$(this).next().hide();
//	});
	

	
	//Lightbox

//	$(function() {
//	  $('a.lightbox').lightBox(); // Select all links with lightbox class
//	});
	
	//Socialshareprivacy
	$('#socialshareprivacy').socialSharePrivacy({
	  services : {
	    facebook : {
	      'app_id'      : '172493556160215', 
	      'perma_option': 'off'
	    }, 
	    twitter : {
	        'status' : 'off'
	    },
	    gplus : {
	      'display_name' : 'Google Plus'
	    }
	  },
	  'cookie_domain' : 'f-spin.de'
	});	
	
	
});
 		
