addLoadListener(function()
{
	bObj = document.getElementsByTagName('body')[0];
	
	tables = document.getElementsByTagName('table');
	for (i=0; i<tables.length; i++) {
	 links = tables[i].getElementsByTagName('a');
	  for (j=0; j<links.length; j++) {
	   links[j].onclick = function() {playSong(this);return false;};
	   links[j].style.position = 'relative';
	  }
	}
	
	playerDiv = document.createElement('div');
	playerDiv.setAttribute('id','mediaPlayer');
	bObj.insertBefore(playerDiv, bObj.nextSibling);	
	
	createPlayer('');
	
	document.getElementById('mediaPlayer').style.left = document.getElementById('wrap').offsetLeft + 100 + 'px'; // Hide the player behind the "wrap" div
	
	darkDiv = document.createElement('div');
	darkDiv.setAttribute('id','page_screen');
	bObj.insertBefore(darkDiv, bObj.nextSibling);
	
	ccNote = document.createElement('div');
	ccNote.setAttribute('id','cc_note');
	bObj.insertBefore(ccNote, bObj.nextSibling);
	
	moreInfoButton = (isIE6) ?'<img src="images/spacer.png" style="width: 70px; height: 15px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/buttons/button_more_info_orange_slammed.png\', sizingMethod=scale);" />':'<img src="images/buttons/button_more_info_orange_slammed.png" alt="More Info" width="70" height="15" />';
	
	document.getElementById('cc_note').innerHTML = '<h3>Note: You are about to leave FullSail.org</h3><p>When you click on a '+moreInfoButton+' link, you MAY be taken to ChristianCinema.com. If so, a new window will open and you will be taken to the product\'s information page.</p><p>Full Sail Ministries has an agreement with ChristianCinema.com to provide order fulfillment for any products purchased through the FSM website. All profits, minus shipping and handling, will benefit Full Sail Ministries.</p>If you do not want to see this message again, when you click on a '+moreInfoButton+' link, please check the box below:<p><div class="not_again"><input type="checkbox" id="notAgainCheck" value="" /> Please do not show this message again.</div><div style="text-align: center"><input type="image" src="images/buttons/button_continue_green.gif" value="continue" onclick="moreInfo(\'continue\')" /></div>';
	
	var pageScreen = document.getElementById('page_screen');

	if (typeof pageScreen.style.opacity != 'undefined') {
	 type = 'w3c';
	} else {
	 type = 'ie';
	}
	
	albumID = location.search.substr(1);
	
	if (albumID) {
	 linkPos = findPos(document.getElementById('album_'+albumID));
	 eventScroll(0,linkPos[1]-7);
	}
	
	preloading(
	"icons/icon_pause_red_slammed.png"
	);
});

isIE6 = /msie|MSIE 6/.test(navigator.userAgent); // Test for IE6;

var myimages = [];
function preloading() {
for (x=0; x<preloading.arguments.length; x++){
myimages[x] = new Image();
myimages[x].src = "images/"+preloading.arguments[x];
}
}

var currentCcid;

function moreInfo(ccid) {
if (isNaN(ccid) || getCookie('FsStoreCc')) {
 if (document.getElementById('notAgainCheck').checked) {
  var now = new Date();
  now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000); // One year
  setCookie('FsStoreCc','no',now);
 }
 
 currentCcid = (isNaN(ccid)) ? currentCcid:ccid;
  
 winSize = windowSize();
 winWidth = winSize[0] - 60;
 winHeight = winSize[1] - 30;
 newwindow = window.open('http://www.christiancinema.com/catalog/product_info.php?products_id='+currentCcid+'&a_aid=759ff73b','mywindow','top=30,left=30,width='+winWidth+',height='+winHeight+',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
 if (window.focus) {newwindow.focus()}
 lightenPage();
 popupDiv('cc_note','hide');
 return;
}
 currentCcid = ccid;
 darkenPage();
 popupDiv('cc_note','show');
}

var inc = 4;

function eventScroll(initY,finalY) {
if (initY != finalY) {
 rate = Math.ceil((finalY - initY) / inc);
 newPos = initY + parseInt(rate);
 scroll(0,newPos);
 
 scrollTimer = window.setTimeout("eventScroll(" + newPos + ", " + finalY + ");", 2);
}
}

function playSong(link) {
song = link.href;

playPauseImg = link.getElementsByTagName('img')[0];

if (playPauseImg.alt == 'play') {
 if (playPauseImg.style.filter) {
  playPauseImg.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/icons/icon_pause_red_slammed.png', sizingMethod=scale)";
 } else {
  playPauseImg.src = 'images/icons/icon_pause_red_slammed.png';
 }
 playPauseImg.alt = 'pause';
 link.parentNode.parentNode.className += ' playing';
 
 if (currentLink != link) {
  player.sendEvent('LOAD',song);
  if (currentLink) {
   if (currentLink.getElementsByTagName('img')[0].style.filter) {
    currentLink.getElementsByTagName('img')[0].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/icons/icon_play_slammed.png', sizingMethod=scale)";
   } else {
    currentLink.getElementsByTagName('img')[0].src = 'images/icons/icon_play_slammed.png';
   }
   currentLink.getElementsByTagName('img')[0].alt = 'play';
   currentLink.parentNode.parentNode.className = currentLink.parentNode.parentNode.className.replace(/ ?playing/,'');
  }

  currentLink = link;
 }
 
 player.sendEvent('PLAY');
} else {
 if (playPauseImg.style.filter) {
  playPauseImg.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/icons/icon_play_slammed.png', sizingMethod=scale)";
 } else {
  playPauseImg.src = 'images/icons/icon_play_slammed.png';
 }
 playPauseImg.alt = 'play';
 link.parentNode.parentNode.className = link.parentNode.parentNode.className.replace(/ ?playing/,'');
 player.sendEvent('PLAY');
}
}

function createPlayer(theFile) {
var flashvars = {
  file: theFile,
  autostart: false,
  controlbar: "none"
};
var params = {
  wmode: "opaque",
  allowfullscreen: "true"
};
var attributes = {
  id: "mediaPlayer",  
  name: "mediaPlayer"
};

swfobject.embedSWF("media/player.swf", "mediaPlayer", "10", "10", "9", "media/expressInstall.swf", flashvars, params, attributes);
}

var currentLink = null;
var currentState = "NONE"; 
var previousState = "NONE"; 
var currentVolume = 80;
var player = null;

function playerReady(thePlayer) {
	player = document.getElementById(thePlayer.id);
	addListeners();
}


function addListeners() {
	if (player) { 
		player.addModelListener("STATE", "stateListener");
	} else {
		setTimeout("addListeners()",100);
	}
}


function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED
currentState = obj.newstate;
previousState = obj.oldstate;

if (currentState == "COMPLETED") {
 playPauseImg = currentLink.getElementsByTagName('img')[0];
 if (playPauseImg.style.filter) {
  playPauseImg.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/icons/icon_play_slammed.png', sizingMethod=scale)";
 } else {
  playPauseImg.src = 'images/icons/icon_play_slammed.png';
 }
 playPauseImg.alt = 'play';
 currentLink.parentNode.parentNode.className = currentLink.parentNode.parentNode.className.replace(/ ?playing/,'');
}
}

function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
	curleft = obj.offsetLeft
	curtop = obj.offsetTop
	while (obj = obj.offsetParent) {
		curleft += obj.offsetLeft
		curtop += obj.offsetTop
	}
}
return [curleft,curtop];
}

function darkenPage() {
pageScreen = document.getElementById('page_screen');
if (typeof( window.innerWidth ) == 'number') {
 //Non-IE
 myHeight = window.innerHeight;
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
 //IE 6+ in 'standards compliant mode'
 myHeight = document.documentElement.clientHeight;
}

scrollH = document.body.parentNode.scrollHeight

pageScreen.style.height = (myHeight > scrollH) ? myHeight + 'px':scrollH + 'px';
pageScreen.style.display = 'block';
}

function lightenPage() {
pageScreen = document.getElementById('page_screen');
pageScreen.style.display = 'none';
}

/* ================
Center Functions
================ */

function popupDiv(id,option) {
obj = document.getElementById(id);
if (option == 'show') {
 obj.style.display = 'block';
 winSize = windowSize();
 screenWidth = winSize[0];
 screenHeight = winSize[1];
// divWidth = screenWidth - 80;
// divHeight = screenHeight - 60;
 divWidth = obj.offsetWidth;
 divHeight = obj.offsetHeight;
 scrollPosTop = f_scrollTop();
 divLeft = parseInt((screenWidth-divWidth)/2);
 divTop = parseInt((screenHeight-divHeight)/2);
// obj.style.width = divWidth+'px';
// obj.style.height = divHeight+'px';
 obj.style.left = divLeft+'px';
 obj.style.top = scrollPosTop+divTop+'px';

// headerHeight = document.getElementById('header').offsetHeight;
// footerHeight = document.getElementById('footer').offsetHeight;
 //alert(headerHeight+' - '+footerHeight);
// document.getElementById('imgLib_iframe').style.height = (divHeight - headerHeight - footerHeight) + 'px';

 obj.style.visibility = 'visible';
 if (typeof document.uniqueID != 'undefined') {
//  createIframeLayer(document.getElementById(id));
 }
} else {
 obj.style.visibility = 'hidden';
 obj.style.display = 'none';
 if (typeof document.uniqueID != 'undefined') {
//  removeIframeLayer(document.getElementById(id))
 }
}
}

function createIframeLayer(menu)
{
//  if (!toggleSelects('hidden'))
//  {
    var layer = document.createElement('iframe');
// Altered Code: Name the new iframe so we can delete it later by name.
    layer.setAttribute("id","");
    layer.id = menu.getAttribute("id")+"iframe";
// End Altered Code
    layer.tabIndex = '-1';
    layer.src = 'javascript:false;';
    menu.parentNode.appendChild(layer);

    layer.style.left = menu.offsetLeft + 'px';
    layer.style.top = menu.offsetTop + 'px';
    layer.style.width = menu.offsetWidth + 'px';
    layer.style.height = menu.offsetHeight + 'px';
//  }
}

function removeIframeLayer(menu)
{
//  if (!toggleSelects('visible'))
//  {
//    var layers = menu.parentNode.getElementsByTagName('iframe');
//    alert(layers.length);
//    while (layers.length > 0)
//    {
//      layers[0].parentNode.removeChild(layers[0]);
//    }
//  }

// Altered Code: Targets the named iframe so it doesn't delete ALL the iframe on the page.
var layer = document.getElementById(menu.getAttribute("id")+'iframe');
var parent = layer.parentNode;
parent.removeChild(layer);
}

function windowSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth );
//  window.alert( 'Height = ' + myHeight );
  return [myWidth,myHeight];

}

function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
