history.navigationMode = 'compatible';
var text;
var url;
var site;

/* share links on facebook & twitter */
function ShareThis(site, url, text) {
	if (url.indexOf('http:') == -1) {
		url = 'http://www.notchonline.com/' + url;
	}
	if (site == 'facebook') {
		var shareUrl = 'http://www.facebook.com/sharer.php?u=' + url + '&&t=' + text;
		var width = '626';
		var height = '436';
	} else if (site == 'twitter') {
		var shareUrl = 'http://twitter.com/share?url=' + url + '&&text=' + text + '&via=notchonline';
		var width = '550';
		var height = '450';
	}
	var win = window.open(shareUrl,'share'+site,'toolbar=0,status=0,width=' + width + ',height=' + height);
	if (win) {
		win.focus();
	} else {
		return win;
	}
}


$(document).ready(function(){
	
	$("table#tour tr:odd").addClass("odd");

	$('ul#sidebar li #tweet ul li:last').each(function(){
		$(this).addClass('last');
	});

	$("#slider").easySlider({
		auto: false, 
		continuous: true,
		orientation: 'fade'
	});

	$(".tracklist li:odd").addClass("alt");
	$(".albums li.album:first").css("display","block");
	
	$(".infiniteCarousel ul li a").click(function () {
		var album = $(this).attr("name");
		
		$(".albums li.album").css("display","none");
		$("#" + album ).css("display","block");
		
		return false;
		
	});
	

	// change videos
	$(".changevid").click(function () {
		
		 var list = $("ul.vidlist li a");
		 var newid = $(this).attr("name");
		 var newtitle = $(this).attr("title");
		 var newdescription = $(this).attr("rel");
		 
		 var videocode = '<object width="662" height="373"><param name="movie" value="http://www.youtube.com/v/'+newid+'&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="autoplay" value="1"></param><param name="showinfo" value="0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' +newid+'&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" autoplay="1" showinfo="0" allowscriptaccess="always" allowfullscreen="true" width="662" height="373"></embed></object>';
		 
		 var newdesctext = '<h4 style="margin-bottom:0px;">'+newtitle+'</h4>'+newdescription;
		 
		 var newtext = videocode;
	    $(".replacevideo").replaceWith("<div class='replacevideo'>" + newtext + "</div>");
	    $(".replacedescription").replaceWith("<div class='replacedescription'>" + newdesctext + "</div>");
	    
	    $(list).each(function(){ 
	    	$(this).removeClass("active");
	    })
	    
	    $(this).addClass("active");
	    
	    return false;
	    
	    
	    
	});




});


