$(document).ready(function(){


/* GET URL FROM META TAG */
function metaKeywords() {
metaCollection = document.getElementsByTagName('meta');
for (i=0;i<metaCollection.length;i++) {
nameAttribute = metaCollection[i].name.search(/home/);
if (nameAttribute!= -1) {
return (metaCollection[i].content);
}
}
} 
var loc = metaKeywords()
//alert(loc);
 
 
 
/* This adds a different bottom border to the tour list, just for kicks */
$(".upcoming_shows_list li:even").css({
	'background-image' : 'url('+loc+'public/css/imgs/bg_list_rule_2.png)', 
	'background-position' : 'bottom left',
	'background-repeat' : 'no-repeat'
	});

/* Removed the border from the last in the list */	
$(".upcoming_shows_list li:last").css({
	'background-image' : 'none', 
	});

	$(".entireClick li").click(function(){
	  window.location=$(this).find("a").attr("href"); return false;
	});



/*
$("#twitterFeed").getTwitter({
	userName: "ozomatli",
	numTweets: 3,
	preloaderId: "tweetLoader",
	loaderText: "Loading Ozo tweets...",
	slideIn: false,
	showHeading: false,
	showProfileLink: false
});
*/



$("#twitterFeed").tweet({
 join_text: "auto",
 username: "ozomatli",
 count: 3,
 auto_join_text_default: "", 
 auto_join_text_ed: "",
 auto_join_text_ing: "",
 auto_join_text_reply: "",
 auto_join_text_url: "",
 loading_text: "Loading Ozo tweets..."
});



 $('a[rel="external"]').click( function() {
     window.open( $(this).attr('href') );
     return false;
 });

 $('a[class="external"]').click( function() {
     window.open( $(this).attr('href') );
     return false;
 });






$('.social_icons').tipsy({gravity: 's'});


$('#btn_email4media').click(function() {
  $(this).fadeOut();
  $("#email4media_widget_box").delay(400).fadeIn();
});




	
	//CYCLER
	$('#highlights').cycle({ 
		fx: 'fade', 
		speed: 'slow',
		timeout: 4500,  
		fit: 0, 
		containerResize: 0,    
		pager:  '#slideControl',
		before: getSlideInfo,
		//after:   onAfter,
		//pauseOnPagerHover: true, 
	    pagerAnchorBuilder: function(idx, slide) { 
	        return '<li><a href="#">&#8226;</a></li>'; 
	     } 
	 });

	

	/* This Pull spotlight info from further down the page and put it where it is */
	function getSlideInfo() {
		var title = $('div.slide_desc h3.title', this).text();
		var body = $('div.slide_desc span.desc', this).html();
		var url = $('div.slide_desc span.url', this).html();
			 
			
			$('#dyno_title').html("<a href='" + url + "'>" + title + '</a>');
			$('#dyno_desc').html(body);	
			$("#dyno_url a").attr('href', url);
			
			$(".dyno_caption").click(function(){
			  var val = $(this).find("#dyno_url a").attr("href");
			  location.href=val;
			});
						
			
	}

			$(".dyno_caption").hover(
			  function(){
					$('#dyno_title a').css({'text-decoration' : 'underline'});
					$('#dyno_desc a').css({'text-decoration' : 'underline'});
					$('a#btn_dynoreadmore').addClass("highlight_readmore");
					$(this).css({'cursor' : 'pointer'});			
			  }, 
			  function () {
			    $('#dyno_title a').css({'text-decoration' : 'none'});
			    $('#dyno_desc a').css({'text-decoration' : 'none'});
				 $('a#btn_dynoreadmore').removeClass("highlight_readmore");			    
			  }

			
			
			);	
	

 
});