/* ------------------------------------------------------------------------------------------ */
/* Tiptip: http://code.drewwilson.com/entry/tiptip-jquery-plugin */
/* ------------------------------------------------------------------------------------------ */
$(function(){
	$("ul#flyers_list li .flyer_name").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: "Click on this flyer if you wish to see more informations related to this event"
	});
	$("ul#flyers_list li .flyer_thumb").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: "Click on this flyer if you wish to see more informations related to this event"
	});
/* ------------------------------------------------------------------------------------------ */	
	$("a.side_banner").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "left",
		content: "Visit our partners: by doing so, a new tab/page will open allowing you to keep browsing on Ibizaontv"
	});	
	$("a.bottom_banner_thumb").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: "Visit our partners: by doing so, a new tab/page will open allowing you to keep browsing on Ibizaontv"
	});		
	$("#home_random_banners a").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: "Visit our partners: by doing so, a new tab/page will open allowing you to keep browsing on Ibizaontv"
	});		
	$("#home_static_banners a").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: "Visit our partners: by doing so, a new tab/page will open allowing you to keep browsing on Ibizaontv"
	});		
/* ------------------------------------------------------------------------------------------ */
	$("div#social_panel a").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 10, 
		defaultPosition: "top",
		content: ""
	});	
	/* ------------------------------------------------------------------------------------------ */
	$("div#footer_bottom a").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: ""
	});	
	$("a#streaming_logo").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: "Visit us at www.ibizaontv.com"
	});		
});
/* ------------------------------------------------------------------------------------------ */
/* Jquery Cycle: http://malsup.com/jquery/cycle/ */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() {
	$('#facebox_pic').cycle({
		fx: 'fade'
	});
}); 
/*$(document).ready(function() {
	$('div#tv').cycle({
		fx: 'fade',
		speed:  5000 
	});
});*/
/* ------------------------------------------------------------------------------------------ */
/* Table rows: allows to set a specific class for table's rows */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() {
	$('table tbody tr:not([th]):even').addClass('even');
	$('table tbody tr:not([th]):odd').addClass('odd');
});

/* ------------------------------------------------------------------------------------------ */
/* Jquery Hover */
/* ------------------------------------------------------------------------------------------ */
	jQuery(document).ready(function() {				
		flyers_list();
		flyers_single();	
		side_banner_list();
		bottom_banner_list();
		home_random_banner();
		home_static_banner();
		footer_logo_ibiza();
		footer_logo_eugama();
		footer_logo_digitalcubox();
		logoback();
		video_list();
		wp_gallery();
		streaming_banner();
		video_accordion();
	});
	
	function flyers_list() {
	jQuery('ul#flyers_list li a img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}
	function flyers_single() {
	jQuery('div.single-flyer_thumb a.preview_thumb img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}	

	function side_banner_list() {
	jQuery('a.side_banner img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}
	
	function bottom_banner_list() {
	jQuery('a.bottom_banner_thumb img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}
		
		
	function home_random_banner() {
	jQuery('div#home_random_banners a img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}
	function home_static_banner() {
	jQuery('div#home_static_banners a img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}
	function footer_logo_ibiza() {
	jQuery('div#ibizaontv_logo a img').hover(function(){
			jQuery(this).stop().fadeTo(1500, 0);
		}, function() {
			jQuery(this).stop().fadeTo(1000, 1);
		});
	}
	function footer_logo_eugama() {
	jQuery('div#ibizaontv_madeby a img').hover(function(){
			jQuery(this).stop().fadeTo(1500, 0);
		}, function() {
			jQuery(this).stop().fadeTo(1000, 1);
		});
	}	
	function footer_logo_digitalcubox() {
	jQuery('a#footer_logo_digitalcubox img').hover(function(){
			jQuery(this).stop().fadeTo(1500, 0);
		}, function() {
			jQuery(this).stop().fadeTo(1000, 1);
		});
	}		
	
	
	function logoback() {
	jQuery('div#header a#logoback').hover(function(){
			jQuery(this).stop().fadeTo(500, 1);
		}, function() {
			jQuery(this).stop().fadeTo(500, 0);
		});
	}		
	
	function video_list() {
	jQuery('ul#video_list li a img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}	
	function wp_gallery() {
	jQuery('div.gallery a img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}		
	
	function streaming_banner() {
	jQuery('div#streaming_banners ul li a img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}	
	function video_accordion() {
	jQuery('ul.accordion_video_list li a img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}		
/* ------------------------------------------------------------------------------------------ */
/* Transitions */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() { 
	$("ul#gallery li a").hover(function() {
		$(this).stop().animate({ backgroundColor: "#eeeeee"}, 500);
	}, function() {
		$(this).stop().animate({ backgroundColor: "#141617"}, 500);	
	});
});






/* ------------------------------------------------------------------------------------------ */
/* Popup window */
/* ------------------------------------------------------------------------------------------ */
function popup_window(url,w,h)
{
	var width=w;
	var height=h;
	var from_top=250;
	var from_left=250;
	var toolbar='no';
	var location='no';
	var directories='no';
	var status='no';
	var menubar='no';
	var scrollbars='false';
	var resizable='no';
	var atts='width='+width+'show,height='+height+',top='+from_top+',screenY=';
	atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar;
	atts+=',location='+location+',directories='+directories+',status='+status;
	atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable;
	window.open(url,'win_name',atts);
}

 
 
 
 
/* ------------------------------------------------------------------------------------------ */
/* jQuery SmoothScroll | Version 11-03-14 */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() {

   $('a[href*=#]').click(function() {

      // duration in ms
      var duration=1000;

      // easing values: swing | linear
      var easing='swing';

      // get / set parameters
      var newHash=this.hash;
      var target=$(this.hash+', a[name='+this.hash.slice(1)+']').offset().top;
      var oldLocation=window.location.href.replace(window.location.hash, '');
      var newLocation=this;

      // make sure it's the same location      
      if(oldLocation+newHash==newLocation)
      {
         // set selector
         if($.browser.safari) var animationSelector='body:not(:animated)';
         else var animationSelector='html:not(:animated)';

         // animate to target and set the hash to the window.location after the animation
         $(animationSelector).animate({ scrollTop: target }, duration, easing, function() {

            // add new hash to the browser location
            window.location.href=newLocation;
         });

         // cancel default click action
         return false;
      }
   });

});


