// JavaScript Document

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = 'images/ad1.jpg'
theImages[1] = 'images/ad2.jpg'
theImages[2] = 'images/ad3.jpg'
theImages[3] = 'images/ad4.jpg'

//specify corresponding links below
var imagelinks=new Array()
imagelinks[0]="http://www.tuneology.ca/products.html"
imagelinks[1]="http://www.myspace.com/brianpassmore1982/"
imagelinks[2]="http://www.tuneology.ca/musicprograms.html"
imagelinks[3]="http://www.beavercreekguitars.com/"
  
// do not edit anything below this line

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<a href='+'"'+imagelinks[whichImage]+'"'+' id="my_anchor"'+'><img src="'+theImages[whichImage]+'" border=0 id="banner_image" ></a>');

// This sets the tab indicator to which image is selected
tabId=(whichImage+1);
document.getElementById('TAB'+tabId).src='images/bannertabover.gif';

}

// Tab navigation function

function changeLink(tab) {
	
	$(document).ready(function(){
	$('#banner_image').animate({ opacity: 0.1 }, 300, 
	
	function(){
		
	var selTab='TAB'+tab;
	//reset all the tabs
	for (i = 1; i < 5; i++) {
   	document.getElementById('TAB'+i).src='images/bannertabholder.gif';
	}
	//sets the clicked tab
	document.getElementById(selTab).src='images/bannertabover.gif';
	
	//change banner_image
	
	document.getElementById('banner_image').src='images/ad'+tab+'.jpg';
	
	//change the banner_image link
	if (selTab=='TAB1') { document.getElementById('my_anchor').href='http://www.tuneology.ca/products.html'; }
	
	if (selTab=='TAB2') { 
	document.getElementById('my_anchor').href='http://www.myspace.com/brianpassmore1982/'; 
	//document.getElementById('my_anchor').target='_blank';
	}
	
	if (selTab=='TAB3') { document.getElementById('my_anchor').href='http://www.tuneology.ca/musicprograms.html'; }
	
	if (selTab=='TAB4') { 
	document.getElementById('my_anchor').href='http://www.beavercreekguitars.com/'; 
	//document.getElementById('my_anchor').target='_blank';
	}
			
	$('#banner_image').animate({ opacity: 1.0 }, 300); }); 
	});

}

// Rotate Banner Ads


























//  End -->