	
	//alert('begin');
	
	$(document).ready(function(){
		 
			initHome();
			
			
			
			

			
			
			
			
			
			
			
			
			
			

			$('#menu img').click(function() { 
			
			//start function when any link is clicked

			$("#bgn_content").fadeOut("fast");
			
			var content_show = $(this).attr("title");
			
			//alert(content_show);
			
			thepage = "http://www.billgentrynation.com";
			
			
			if (content_show == "sixpack"){
			
			mydata = "sixpack_download.html";
			
			}
			
			
			if (content_show == "Bill Gentry News"){
			
			mydata = "bill-gentry-news.html";	
			
			}
			
		
			if (content_show == "Bill Gentry Music"){

			mydata = "bill-gentry-music.html";	
					
			}
	
			if (content_show == "About Bill Gentry"){

			mydata = "about-bill-gentry.html";	
					
			}	
			
			if (content_show == "Bill Gentry Media"){

			mydata = "bill-gentry-media.html";
			
			//alert(content_show);
					
			}			
			
			if (content_show == "Bill Gentry Tour Dates"){

			mydata = "bill-gentry-tour-dates.html";	
					
			}	
			
			if (content_show == "Bill Gentry Store"){

			mydata = "home_content.html";		
					
			}			
			
			footercode = "<div id=\"footer\">&nbsp;</div>";
			
			//alert(thepage);
			
			$.ajax({
							
			method: "get",url: thepage, data: mydata,

			beforeSend: function(){

			$('#loading').fadeIn('slow');

			},
			//show loading just when link is clicked

			complete: function(){

			$('#loading').fadeOut('slow');

			},
			//stop showing loading when the process is complete
			
			
			

			success: function(html){
						//so, if data is retrieved, store it in html

				//alert(html);

				$('#bgn_content').fadeIn('slow'); //animation
				$('#bgn_content').html(html); //show the html inside .content div
				$('#fh').html(footercode);
				refixLinks();
				initLytebox();
				}
					 
			 }); //close $.ajax(


			 }); //close click
			 

		

		 
		 
function initHome(){

thepage = "http://www.billgentrynation.com";

footercode = "<div id=\"footer\">&nbsp;</div>";

myhomedata="home_content.html"

jQuery("#bgn_content").fadeOut("slow");

$.ajax({
							
	method: "get",url: thepage, data: myhomedata,

	beforeSend: function(){

	$('#loading').fadeIn('slow');

	},
	//show loading just when link is clicked

	complete: function(){

	$('#loading').fadeOut('slow');

	},
	//stop showing loading when the process is complete




	success: function(html){
				//so, if data is retrieved, store it in html

		//alert(html);

		$('#bgn_content').fadeIn('slow'); //animation
		$('#bgn_content').html(html); //show the html inside .content div
		$('#fh').html(footercode);
		
		refixLinks();
		initLytebox();
		}

	 }); //close $.ajax(


}
		 
}); //close $(


function refixLinks()
  {
    if (!document.getElementsByTagName) {
      return null;
    }
    
    var anchors = document.getElementsByTagName("a");
    
    for(var i=0; i < anchors.length; i++){
    
     	var a = anchors[i];
     	
     	var href = a.href;
     	var aclassname = a.className;
     	
     	//alert("a was: " + href + " and classname was " + aclassname);
      
	//var index = href.indexOf("#") + 1;
	var index = 0;
	
	//alert ("for link "+href+" index is " + href.indexOf("http://"));

	

	//	DO NOT MAKE INTO SELF-PORTING JS LINK....
	//	IF:
	//	TWITTER, OR JAVASCRIPTED ALREADY..
		

	if (href.indexOf("twitter") != -1){
		
		// this IS a gallery page....
		
	} else if (href.indexOf("http://www.tol23design.com") != -1){
	
		//is already changed...
	
	} else if (href.indexOf("javascript") != -1){
	
		//is already changed...
	
	} else if (aclassname){
	
		//alert("a was: " + href + " and classname was " + aclassname);

		//is included in the twitter
	
	} else if (href.indexOf("billgentrynation.com") == -1){ 
	
		
	
	
	} else if (href.indexOf("@") != -1){ 
	
		
	
	
	}
	
	
	else {	
	
	href = "javascript:doLink('" +
	href.substring(index) + "');";
	a.setAttribute("href",href);
	
	} 
        
     }   	

    
  }
  
 function doLink(theurl){
 
 mydataarray = theurl.split("?");
 
 thepage = mydataarray[0];
 mydata = mydataarray[1];
 
	$.ajax({

	method: "get",url: thepage, data: mydata,

	beforeSend: function(){

	$('#loading').fadeIn('slow');

	},
	//show loading just when link is clicked

	complete: function(){

	$('#loading').fadeOut('slow');

	},
	//stop showing loading when the process is complete




	success: function(html){
				//so, if data is retrieved, store it in html

		//alert(html);

		$('#bgn_content').fadeIn('slow'); //animation
		$('#bgn_content').html(html); //show the html inside .content div
		$('#fh').html(footercode);
		
		refixLinks();
		initLytebox()
		
		}

	 }); //close $.ajax(
 
 
 }
