// JavaScript Document
// JavaScript Document
var oldSection='home';

function setupshows(){
			var accordion = new Accordion('h3.atStart', 'div.atStart', {
				opacity: false,
				onActive: function(toggler, element){
					toggler.setStyle('color', '#ff3300');
					toggler.setStyle('background-image', 'url(images/tour_bar2_bkg.gif)');
					
				},
				
				onBackground: function(toggler, element){
					toggler.setStyle('color', '#222');
					toggler.setStyle('background-image', 'url(images/tour_bar_bkg.gif)');
					
				}
			}, $('accordion'));
			
			
		
		}


function getSection(section){
	
	if(section=='green'){
	
				$("body").animate({backgroundColor:'#4B7B31'}, 1000);
				$(".jScrollPaneContainer").animate({backgroundColor:'#B1D89B'}, 1000);
			}else{
				
				$("body").animate({backgroundColor:'#292929'}, 1000);
				$(".jScrollPaneContainer").animate({backgroundColor:'#D8D8D8'}, 1000);
			}
	/**
	
	updateBody = function(request) {
				$('bodycontainer').setHTML(request); 
			 var fx =new Fx.Style('bodycontainer', 'opacity', {duration: 200} );
				function fadeIn(el){
    		(function(){fx.start(1)}).delay(350, this);
				}
		
			
			
			fadeIn('bodycontainer');
			
			if(section=='shows'){
			 setupshows();
			}
			if(section=='home'){
			 prepForm();
			}
			 }
	
		
	 $('bodycontainer').setHTML("<img src='../images/ajax-loader.gif' border=0>");
	
		new Ajax('includes/get_section.php?section='+section, {onComplete: updateBody, method:'get'}).request();
	
	
	**/
	if(oldSection=='shows' || oldSection=='band' || oldSection=='songs'){
	 $('#bodycontainer').html("<img src='../images/ajax-loader.gif' border=0>");
	}else{
		 $('#mainContentHolderx').html("<img src='../images/ajax-loader-grey.gif' border=0>");
	}
	$.ajax({
	   type: "GET",
	   url: "includes/get_section2.php",
	   data: "section="+section+'&oldSection='+oldSection,
	   success: function(html){
		    $('#changeStyle').attr({href:'css/brown.css'});
		  
	   		
	if(section=='shows' || section=='band' || section=='media' || section=='songs' || section=='photos' || section=='video' || section=='green'){
	$('#bodycontainer').html(html);
	initScroller();
	}else{
		
		
		if(oldSection=='news' || oldSection=='albums' || oldSection=='shirts' ||oldSection=='buttons' || oldSection=='other' || oldSection=='singles' || oldSection=='posters' || oldSection=='contact' || oldSection=='links' || oldSection=='home' || oldSection=='green'){
				
				
		 	$('#mainContentHolderx').html(html); 
			initScroller();
			
				
			}else{
			$('#bodycontainer').html(html); 
			
			initScroller();	
			}
		
		
		
	}
			oldSection=section;
			initScroller();
			 $('a.okgallery').lightBox({fixedNavigation:true});
			if(section=='shows'){
			// setupshows();
			}
			if(section=='green'){
	
				$("body").animate({backgroundColor:'#4B7B31'}, 1000);
				$(".jScrollPaneContainer").animate({backgroundColor:'#B1D89B'}, 1000);
			}else{
				
				$("body").animate({backgroundColor:'#292929'}, 0);
				$(".jScrollPaneContainer").animate({backgroundColor:'#D8D8D8'}, 0);
			}
			 prepForm();
			
		 
	   }
 });
	
}



function getVideo(videoId){

	
	$('#mediacolumntwo').html("<img src='../images/ajax-loader.gif' border=0>");
	$.ajax({
		type: "GET",
		url: "includes/get_video.php",
		data: "video_id="+videoId,
		success: function(html){
			$("#mediacolumntwo").html(html);
		}
	});

	
}
	
	
	
function getImages(cat_id,startrecord){
	var startrecord = (startrecord == null) ? 0 : startrecord;
	$('#mediacolumntwo').html("<img src='../images/ajax-loader.gif' border=0>");
	$.ajax({
	   type: "GET",
	   url: "includes/get_photos2.php",
	   data: "cat_id="+cat_id+'&startrecord='+startrecord,
	   success: function(html){
	   
		 $("#mediacolumntwo").html(html);
		 $('a.okgallery').lightBox({fixedNavigation:true});

	   }
 	});


}
	
	
	
	
	
		
function getLyrics(song_id){

	$('#mediacolumntwo').html("<img src='../images/ajax-loader.gif' border=0>");
	$.ajax({
	   type: "GET",
	   url: "includes/get_song.php",
	   data: "song_id="+song_id,
	   success: function(html){
	   
		 $("#mediacolumntwo").html(html);
		 
	   }
 	});
	
	
}
	
	
function getAccounts(catalog_id){

	$('#mediacolumntwo').html("<img src='../images/ajax-loader.gif' border=0>");
		$.ajax({
		type: "GET",
		url: "includes/get_accounts.php",
		data: 'catalog_id='+catalog_id,
		success: function(html){
		
		 	$("#mediacolumntwo").html(html);
		 
		}
	});


}
	
function playSong(url,namex) {
    thisMovie("headerPlayer").playSpecificSong(url,namex);
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}


// JavaScript Document

function prepForm(){


//////

   var options = { 
        target:        '#mailinglistmessage',   // target element(s) to be updated with server response 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse  // post-submit callback 
 
        // other available options: 
        //url:       url         // override for form's 'action' attribute 
        //type:      type        // 'get' or 'post', override for form's 'method' attribute 
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        //clearForm: true        // clear all form fields after successful submit 
        //resetForm: true        // reset the form after successful submit 
 
        // $.ajax options can be used here too, for example: 
        //timeout:   3000 
    }; 
 
    // bind form using 'ajaxForm' 
    $('#myForm').ajaxForm(options); 

//

}




$(document).ready(function() { 
 prepForm();
}); 
 
// pre-submit callback 
function showRequest(formData, jqForm, options) { 
    // formData is an array; here we use $.param to convert it to a string to display it 
    // but the form plugin does this for you automatically when it submits the data 
    var queryString = $.param(formData); 
 
    // jqForm is a jQuery object encapsulating the form element.  To access the 
    // DOM element for the form do this: 
    // var formElement = jqForm[0]; 
 
  //  alert('About to submit: \n\n' + queryString); 
 
    // here we could return false to prevent the form from being submitted; 
    // returning anything other than false will allow the form submit to continue 
	$('#mailinglistmessage').html("<img src='../images/ajax-loader.gif' border=0>");
    return true; 
} 
 
// post-submit callback 
function showResponse(responseText, statusText)  { 
    // for normal html responses, the first argument to the success callback 
    // is the XMLHttpRequest object's responseText property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'xml' then the first argument to the success callback 
    // is the XMLHttpRequest object's responseXML property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'json' then the first argument to the success callback 
    // is the json data object returned by the server 
	if(responseText!='Sorry, your email address is not valid. ')	$('#myForm').fadeOut('slow');
    //alert('status: ' + statusText + '\n\nresponseText: \n'+responseText+'\n\nThe output div should have already been updated with the responseText.'); 
} 