jQuery(function ($) {
	/*$(".expand").click(
		function(){
			$(this).parent().animate({'height':100},1000);
		};
	);*/
	var originalTop=0;
	var originalHeight=0;
	$('.expand').click(function() {
			if(originalTop==0){
				originalTop=$(this).position().top;	
				originalHeight = $(this).parent().height();
			}
			
			//alert($(this).parent().parent().height());
			if($(this).parent().height()==originalHeight){
				$(this).parent().css("z-index:1000");
				var newHeight = ($(this).next().next().height() + $(this).next().next().next().height())*1.1;
				$(this).parent().animate({'height': newHeight}, 1000);
				$(this).animate({'top':newHeight-$(this).height()*.6},1000);
				$(this).html('less');
			}else{
				$(this).parent().css("z-index:1");
				$(this).parent().animate({"height":originalHeight},1000);
				$(this).animate({'top':originalTop},1000);
				$(this).html('more');
			}
	});
	$('.musicexpander').each(function(){
			$(this).html('<div class="plusminus">&nbsp;+&nbsp;</div>&nbsp;&nbsp;'+$(this).attr('alt'));									  
	});
	$('.musicexpander').click(function(){
		if($(this).next().is(':visible')){
			$(this).next().hide();
			$(this).html('<div class="plusminus">&nbsp;+&nbsp;</div>&nbsp;&nbsp;'+$(this).attr('alt'));
		}else{
			$(this).next().show();	
			$(this).html('<div class="plusminus">&nbsp;-&nbsp;</div>&nbsp;&nbsp;'+$(this).attr('alt'));
		}
	});
});



function launchDaveworldApps(){
	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
		location.href="http://itunes.com/apps/daveworldinc";
	}else{
		location.href="http://itunes.apple.com/us/artist/daveworld-inc/id301995954";	
	}
	return false;
}


var driveImagePage=1;
var driveImageMax=8;
var drag=false;

function PrevPage(imgId){
	var imgElem=document.getElementById(imgId);
	var maxImgIdx=eval(imgId+"Max");
	if(driveImagePage==1)
		driveImagePage=maxImgIdx;
	else
		driveImagePage=(driveImagePage-1);
	imgElem.src="/music/images/"+imgId+driveImagePage+".jpg";
}

function NextPage(imgId){
	var imgElem=document.getElementById(imgId);
	var maxImgIdx=eval(imgId+"Max");
	if(driveImagePage==maxImgIdx)
		driveImagePage=1;
	else
		driveImagePage=(driveImagePage+1);
	imgElem.src="/music/images/"+imgId+driveImagePage+".jpg";
}
