function insertSMFlash(){
	$("head").append("<link>");
    css = $("head").children(":last");
    css.attr({
      rel:  "stylesheet",
      type: "text/css",
      href: "sm2/flashblock.css"
    });
}

function insertSMCSS(){
	$("head").append("<link>");
    css = $("head").children(":last");
    css.attr({
      rel:  "stylesheet",
      type: "text/css",
      href: "sm2/360player.css"
    });
}

function addPajinate(){
	$('#listing').pajinate({
		items_per_page : 10,
		num_page_links_to_display : 0,
		//nav_label_first : 'First',
		//nav_label_last : 'Last',
		nav_label_prev : 'Previous Events',
		nav_label_next : 'Upcoming Events'		
	});
	goto(lastPage);
}

function insertSMCSSVis(){
	$("head").append("<link>");
    css = $("head").children(":last");
    css.attr({
      rel:  "stylesheet",
      type: "text/css",
      href: "sm2/360player-visualization.css"
    });
}

function insertSMIEJS(){
	var headTag = document.getElementsByTagName("head").item(0);
	var s1 = document.createElement('script');
	s1.type = "text/javascript";
	s1.src = 'sm2/excanvas.js';
	headTag.appendChild(s1);
}

function insertBAnimator(){
	var headTag = document.getElementsByTagName("head").item(0);
	var s2 = document.createElement('script');
	s2.type = "text/javascript";
	s2.src = 'sm2/berniecode-animator.js';
	//$('head').append(s2);
	headTag.appendChild(s2);
}

function insertSM2(){
	var headTag = document.getElementsByTagName("head").item(0);
	var s3 = document.createElement('script');
	s3.type = "text/javascript";
	s3.src = 'sm2/soundmanager2.js';
	headTag.appendChild(s3);
}
function insert360Player(){
	var headTag = document.getElementsByTagName("head").item(0);
	var s4 = document.createElement('script');
	s4.type = "text/javascript";
	s4.src = 'sm2/360player.js';
	headTag.appendChild(s4);
}

function loadHeadlessFlash(){
	var headTag = document.getElementsByTagName("head").item(0);
	var s5 = document.createElement('script');
	s5.type = "text/javascript";
	s5.src = 'sm2/headlessflash.js';
	headTag.appendChild(s5);
}

$(document).ready(function() {
	$('li#home').css('cursor', 'pointer');
    $('li#music').css('cursor', 'pointer');
    $('li#about').css('cursor', 'pointer');
    $('li#shows').css('cursor', 'pointer');
    $('li#lyrics').css('cursor', 'pointer');
    $('li#pics').css('cursor', 'pointer');
    $('li#contact').css('cursor', 'pointer');
    $('li#shop').css('cursor', 'pointer');
    $('li#thankyou').css('cursor', 'pointer');
    
    var feedbackTab = {
 
    speed:300,
    containerWidth:$('.feedback-panel').outerWidth(),
    containerHeight:$('.feedback-panel').outerHeight(),
    tabWidth:$('.feedback-tab').outerWidth(),
 
 
    init:function(){
        $('.feedback-panel').css('height',feedbackTab.containerHeight + 'px');
 
        $('a.feedback-tab').click(function(event){
            if ($('.feedback-panel').hasClass('open')) {
                $('.feedback-panel')
                .animate({left:'-' + feedbackTab.containerWidth}, feedbackTab.speed)
                .removeClass('open');
            } else {
                $('.feedback-panel')
                .animate({left:'0'},  feedbackTab.speed)
                .addClass('open');
            }
            event.preventDefault();
        });
    }
};
 
feedbackTab.init();
   
    function formatTitle(title, currentArray, currentIndex, currentOpts) {
	    return '<div id="tip7-title"><span><a href="javascript:;" onclick="$.fancybox.close();"><img src="images/closelabel.gif" border="0" /></a></span>' + (title && title.length ? '<b>' + title + '</b>' : '' ) + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
	}	
$("#albumshoot").live('click', function() {
		jQuery.fancybox([
			{
				'href'	: 'images/albumshoot/0.jpg'
			},
			{
				'href'	: 'images/albumshoot/1.jpg'
			},
			{
				'href'	: 'images/albumshoot/2.jpg'
			},
			{
				'href'	: 'images/albumshoot/3.jpg'
			},
			{
				'href'	: 'images/albumshoot/4.jpg'
			},
			{
				'href'	: 'images/albumshoot/5.jpg'
			},
			{
				'href'	: 'images/albumshoot/6.jpg'
			},
			{
				'href'	: 'images/albumshoot/7.jpg'
			},
			{
				'href'	: 'images/albumshoot/8.jpg'
			},
			{
				'href'	: 'images/albumshoot/9.jpg'
			},
			{
				'href'	: 'images/albumshoot/10.jpg'
			},
			{
				'href'	: 'images/albumshoot/11.jpg'
			},
			{
				'href'	: 'images/albumshoot/12.jpg'
			},
			{
				'href'	: 'images/albumshoot/13.jpg'
			},
			{
				'href'	: 'images/albumshoot/14.jpg'
			},
			{
				'href'	: 'images/albumshoot/15.jpg'
			}
			
		], {
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'title'   		    : 'King Of Cups Photo Shoot',
			'showCloseButton'   : false,
			'titlePosition' 	: 'inside',
			'titleFormat'		: formatTitle
			
		});
		return false;
	});
	
 $("#live").live('click', function() {
		jQuery.fancybox([
			{
				'href'	: 'images/live/0.jpg'
			},
			{
				'href'	: 'images/live/1.jpg'
			},
			{
				'href'	: 'images/live/2.jpg'
			},
			{
				'href'	: 'images/live/3.jpg'
			},
			{
				'href'	: 'images/live/4.jpg'
			},
			{
				'href'	: 'images/live/5.jpg'
			},
			{
				'href'	: 'images/live/6.jpg'
			},
			{
				'href'	: 'images/live/7.jpg'
			},
			{
				'href'	: 'images/live/8.jpg'
			},
			{
				'href'	: 'images/live/9.jpg'
			},
			{
				'href'	: 'images/live/10.jpg'
			},
			{
				'href'	: 'images/live/11.jpg'
			},
			{
				'href'	: 'images/live/12.jpg'
			},
			{
				'href'	: 'images/live/13.jpg'
			}
		], {
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'title'   		    : 'Live',
			'showCloseButton'   : false,
			'titlePosition' 	: 'inside',
			'titleFormat'		: formatTitle
			
		});
		return false;
});
	
$("#cdrelease").live('click', function() {
		jQuery.fancybox([
			{
				'href'	: 'images/cdrelease/0.jpg'
			},
			{
				'href'	: 'images/cdrelease/1.jpg'
			},
			{
				'href'	: 'images/cdrelease/2.jpg'
			},
			{
				'href'	: 'images/cdrelease/3.jpg'
			},
			{
				'href'	: 'images/cdrelease/4.jpg'
			},
			{
				'href'	: 'images/cdrelease/5.jpg'
			},
			{
				'href'	: 'images/cdrelease/6.jpg'
			},
			{
				'href'	: 'images/cdrelease/7.jpg'
			},
			{
				'href'	: 'images/cdrelease/8.jpg'
			},
			{
				'href'	: 'images/cdrelease/9.jpg'
			},
			{
				'href'	: 'images/cdrelease/10.jpg'
			},
			{
				'href'	: 'images/cdrelease/11.jpg'
			},
			{
				'href'	: 'images/cdrelease/12.jpg'
			},
			{
				'href'	: 'images/cdrelease/13.jpg'
			},
			{
				'href'	: 'images/cdrelease/14.jpg'
			},
			{
				'href'	: 'images/cdrelease/15.jpg'
			},
			{
				'href'	: 'images/cdrelease/16.jpg'
			},
			{
				'href'	: 'images/cdrelease/17.jpg'
			},
			{
				'href'	: 'images/cdrelease/18.jpg'
			},
			{
				'href'	: 'images/cdrelease/19.jpg'
			},
			{
				'href'	: 'images/cdrelease/20.jpg'
			},
			{
				'href'	: 'images/cdrelease/21.jpg'
			},
			{
				'href'	: 'images/cdrelease/22.jpg'
			},
			{
				'href'	: 'images/cdrelease/23.jpg'
			}
		], {
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'title'   		    : 'CD Release 2007',
			'showCloseButton'   : false,
			'titlePosition' 	: 'inside',
			'titleFormat'		: formatTitle
			
		});
		return false;
});

$("#randoms").live('click', function() {
		jQuery.fancybox([
			{
				'href'	: 'images/randoms/0.jpg'
			},
			{
				'href'	: 'images/randoms/1.jpg'
			},
			{
				'href'	: 'images/randoms/2.jpg'
			},
			{
				'href'	: 'images/randoms/3.jpg'
			},
			{
				'href'	: 'images/randoms/4.jpg'
			},
			{
				'href'	: 'images/randoms/5.jpg'
			},
			{
				'href'	: 'images/randoms/6.jpg'
			},
			{
				'href'	: 'images/randoms/7.jpg'
			}
		], {
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'title'   		    : 'Randoms',
			'showCloseButton'   : false,
			'titlePosition' 	: 'inside',
			'titleFormat'		: formatTitle
			
		});
		return false;
});
    $('a#lyric').live('click', function(){
		jQuery.fancybox({
				'autoDimensions'    : true,
				'autoScale'			: false,
				'opacity'			: true,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'href'              : $(this).attr('href'),
				'type'				: 'iframe'
		});
		return false;
	});
	
	
	$('#gethome').click(function(event) {
  		$('#content').load("php/functions.php?s=home");
	});
	
	$('#getmusic').click(function(event) {
  		insertSMFlash();
  		insertSMCSS();
  		insertSMCSSVis();
  		if($.browser.msie){
  			insertSMIEJS();
  		}
  		insertBAnimator();
  		insertSM2();
  		insert360Player();
  		loadHeadlessFlash();
  		$('#content').load("php/functions.php?s=music");
	});
	
	$('#getabout').click(function(event) {
  		$('#content').load("php/functions.php?s=about");
	});
	
	$('#getshows').click(function(event) {
  		$('#content').load("php/functions.php?s=shows", addPajinate);
	});
	
	$('#getlyrics').click(function(event) {
  		$('#content').load("php/functions.php?s=lyrics");
	});
	
	$('#getpics').click(function(event) {
  		$('#content').load("php/functions.php?s=pics");
	});
	
	$('#getcontact').click(function(event) {
  		$('#content').load("php/functions.php?s=contact");
	});
	
	$('#getshop').click(function(event) {
  		$('#content').load("php/functions.php?s=shop");
	});
	
	$('#getthanks').click(function(event) {
  		$('#content').load("php/functions.php?s=thanks");
	});
	
	
});

