addLoadListener(function()
{
	bObj = document.getElementsByTagName('body')[0];
	if (location.search.indexOf('tmid=') != -1) {
	 addDiv = document.createElement('div');
	 addDiv.setAttribute('id','print');
	 bObj.insertBefore(addDiv, bObj.firstChild);
	 
	 qs = location.search.substr(1);
	 variables = qs.split('&');
	 tmidKV = variables[0].split('=');
	 wmidKV = variables[1].split('=');

	 links = document.getElementById('entry_header').getElementsByTagName('a');
	 links[1].onclick = function() {printStory(this);return false;};
	 
/*	 darkDiv = document.createElement('div');
	 darkDiv.setAttribute('id','page_screen');
	 bObj.insertBefore(darkDiv, bObj.nextSibling);
	
	 var pageScreen = document.getElementById('page_screen');

	 if (typeof pageScreen.style.opacity != 'undefined') {
	  type = 'w3c';
	 } else {
	  type = 'ie';
	 }

	 bigPicDiv = document.createElement('div');
	 bigPicDiv.setAttribute('id','bigPic_container');
	 bObj.insertBefore(bigPicDiv, bObj.nextSibling);
	 html = '<div id="imgWrap"><img src="images/spacer.gif" alt="Big Picture" name="bigPic" id="bigPic" width="0" height="0" onclick="hideBig()" /></div>';
	 html += '<div id="bigPic_text"></div>';
	 document.getElementById('bigPic_container').innerHTML = html;

	 closeDivDiv = document.createElement('div');
	 closeDivDiv.setAttribute('id','closeDiv');
	 bObj.insertBefore(closeDivDiv, bObj.nextSibling);
	 document.getElementById('closeDiv').innerHTML = '<a href="javascript:;" onclick="lightenPage();aniDiv(\'hide\')">Close</a>';

	 closeDivObj = document.getElementById('closeDiv');
	 closeDivObj.style.top = (closeDivObj.offsetHeight * -1) + 'px';
	 closeDivObj.style.visibility = 'visible';
	
	 loadingDiv = document.createElement('div');
	 loadingDiv.setAttribute('id','loadingPic');
	 bObj.insertBefore(loadingDiv, bObj.nextSibling);
	 document.getElementById('loadingPic').innerHTML = 'Loading...';
*/	
	}
	
	newDiv = document.createElement('div');
	newDiv.setAttribute('id','photo_balloon');
	bObj.insertBefore(newDiv, bObj.nextSibling);
	document.getElementById('photo_balloon').innerHTML = '<div id="balloon_top"></div><div id="balloon_middle"><div id="balloon_middle_text"></div></div><div id="balloon_bottom"></div>'
	
	var screencover = document.createElement('div');
	screencover.setAttribute('id','cover');
	bObj.insertBefore(screencover, bObj.nextSibling);
	
	newDiv = document.createElement('div');
	newDiv.setAttribute('id','popDiv');
	bObj.insertBefore(newDiv, bObj.nextSibling);
	document.getElementById('popDiv').innerHTML = '<div id="one_time_div"><h3 style="color: #F6D800">One Time Gift</h3><p>Click on the button below to make a <b>ONE TIME</b> donation. You will be taken to PayPal for your donation processing. When you are finshed, you will be brought back to our site.</p><span style="color: #FDD447;">Note: It is not necessary to have a PayPal account to make a donation.</span><form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="onetime" onsubmit="setPage(\'tm\')"><input type="hidden" name="cmd" value="_s-xclick" /><input type="hidden" name="hosted_button_id" value="" /><div class="donate_submit"><img src="images/paypal_popup.gif" alt="PayPal" width="72" height="21" /><input type="image" src="images/buttons/button_donate.gif" name="submit" alt="Donate" /></div></form></div><div id="monthly_div" style="margin-top: 40px"><h3 style="color: #F6D800">Recurring Monthly Gift</h3><p>If you would like to be a regular partner with us on a monthly basis, type in how much you would like to give automatically each month and click on the button below to make a <b>RECURRING MONTHLY</b> donation. You will be taken to PayPal for your donation processing. When you are finshed, you will be brought back to our site.</p><span style="color: #FDD447;">Note: It is not necessary to have a PayPal account to make a donation.</span><form action="team-members.php" method="post" name="monthly" onsubmit="return amountCheck(this)"><input type="hidden" name="d" value="" /><div style="text-align: center; margin-bottom: 10px">Amount: $<input style="margin-left: 3px; width: 40px" type="text" name="a3" value="" /> USD</div><div class="donate_submit"><img src="images/paypal_popup.gif" alt="PayPal" width="72" height="21" /><input type="image" src="images/buttons/button_donate.gif" name="submit" alt="Donate" /></div></form></div><div id="popup_submit_wrap"><a onclick="donatePopup(\'hide\')" href="javascript:;"><img height="21" width="65" alt="Cancel" src="images/buttons/button_cancel_red.gif"/></a></div>';
	
	preloading("photo_balloon_top_bg_slammed.png","photo_balloon_middle_bg_slammed.png","photo_balloon_bottom_bg_slammed.png");
});

var type;

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

function amountCheck(obj) {
if (obj.a3.value.length < 1 || isNaN(obj.a3.value)) {
	alert('Please enter only numbers.');
	obj.a3.focus();
	return false;
}

setPage('tm');
return true;
}

function showTours(linkObj,option,tour) {
obj = document.getElementById('photo_balloon');

var tourText = (tour) ? ' for the <b>'+tour+'</b> tour':'';

document.getElementById('balloon_middle_text').innerHTML = 'Click this Donate Button to make a donation' + tourText +'. Or click on an outreach, below, for more information.';

if (option == 'hide') {
 obj.style.visibility = 'hidden';
 obj.style.display = 'none';
// document.getElementById('balloon_middle_text').innerHTML = '';
 flag = false;
} else {
 if (!flag) {
//  document.getElementById('balloon_middle_text').innerHTML = text;
  obj.style.display = 'block';
  balloonHeight = obj.offsetHeight;
  startY = findPosY(linkObj);
  startX = findPosX(linkObj);
  obj.style.left = startX - 154 + 'px';
  obj.style.top = startY - balloonHeight + 'px';
  obj.style.visibility = 'visible';
  flag = true;
 }
}
}

function donatePopup(option,tmid,ppSingle,tName,ppMonthlyDescription) {
	document.onetime.hosted_button_id.value = ppSingle;
	document.monthly.d.value = tName+' - '+ppMonthlyDescription;
	
	if (ppMonthlyDescription) {
		document.getElementById('monthly_div').style.display = 'block';
	} else {
		document.getElementById('monthly_div').style.display = 'none';
	}
	
	if (option == 'show') {
		darkenPage();
		setTimeout(function() {
			popupDiv('popDiv','show');
		}, 250);
		
	} else {
		lightenPage();
		popupDiv('popDiv','hide');
	}
}

function setPage(tmid) {
setCookie('fsm_dnt_tmid',tmid);
return true;
}

function printStory(obj) {
memberName = document.getElementsByTagName('h2')[0].innerHTML;
memberOutreach = document.getElementsByTagName('h3')[0].innerHTML;
memberInfo = document.getElementById('member_info').innerHTML;
memberPrayer = document.getElementById('prayer').innerHTML;

printText = '<h1>Full Sail Ministries</h1><h2>Using the Arts to Communicate God\'s Heart</h2>';
printText += '<img src="images/team_members/wm_'+memberPhoto+'_print.jpg" height="134" width="100" />';
printText += '<h3 class="print_sub_header">'+memberName+'</h3>';
printText += '<strong>'+memberOutreach+'</strong><br />';
printText += memberInfo+'<br />';
printText += '<h3 class="print_sub_header" style="clear: left">How to Pray</h3>';
printText += memberPrayer+'<br />';
printText += '<div id="print_footer">Full Sail Ministries &#8226; 130 N. Kelsey Street, Suite C<br />Visalia, CA &#8226; 93291 &#8226; (559) 651-1233 &#8226; www.FullSail.org</div>';

document.getElementById('print').innerHTML = printText;
window.print();
}

var flag = false;

function hoverDiv(option, linkObj) {
obj = document.getElementById('photo_balloon');

if (option == 'hide') {
 obj.style.visibility = 'hidden';
 obj.style.display = 'none';
 document.getElementById('balloon_middle_text').innerHTML = '';
 flag = false;
} else {
 if (!flag) {
  document.getElementById('balloon_middle_text').innerHTML = linkObj.getElementsByTagName('img')[0].getAttribute('alt');
  obj.style.display = 'block';
  balloonHeight = obj.offsetHeight;
  startY = findPosY(document.getElementById('dest_photos'));
  startX = findPosX(linkObj);
  obj.style.left = startX - 158 + 'px';
//  obj.style.top = startY + 15 - balloonHeight + 'px';
  obj.style.top = startY + 54 + 'px';
  obj.style.visibility = 'visible';
  flag = true;
 }
}
}

function setFade(obj,value) {
if (type == 'ie') {
 obj.style.filter = 'alpha(opacity='+value * 100+')';
} else {
 obj.style.opacity = (value == 1 ? 0.9999999 : value);
}
}

/*===================================================================================*/

photoInfo = [];

function aniDiv(linkObj,photoNum) {
divObj = document.getElementById('bigPic_container');
bigPicObj = document.getElementById('bigPic');

if (linkObj == 'hide') {
divObj.style.visibility = 'hidden';
bigPicObj.src = 'images/spacer.gif';
divObj.style.overflow = 'auto';
divObj.style.display = 'none';
divCloseObj = document.getElementById('closeDiv');
divCloseObj.style.top = (divCloseObj.offsetHeight * -1) + 'px';
return;
}

winSize = windowSize();
screenWidth = winSize[0];
screenHeight = winSize[1];
scrollPosTop = f_scrollTop();
 
startWidth = 0;
startHeight = 0;

divObj.style.display = 'block';

endWidth = Number(photoInfo[photoNum][2]) + 2; // width of picture + borders of containers
document.getElementById('bigPic_text').innerHTML = photoInfo[photoNum][1];
divObj.style.width = endWidth + 'px';
textHeight = document.getElementById('bigPic_text').offsetHeight + 2; // height of text + borders of container
endHeight = Number(photoInfo[photoNum][3]) + textHeight; // height of picture + text + borders of container

divObj.style.width = startWidth + 'px';
divObj.style.height = startHeight + 'px';
startY = findPosY(document.getElementById('dest_photos'));
startX = findPosX(linkObj);
divObj.style.left = startX + 'px';
divObj.style.top = startY + 'px';
divObj.style.overflow = 'hidden';

divObjOpStart = 0;
divObjOpEnd = 100;
setFade(divObj,divObjOpStart*.01);

endX = parseInt((screenWidth - endWidth) / 2);
endY = parseInt((screenHeight - endHeight) / 2) + scrollPosTop;

divObj.style.visibility = 'visible';

intervals = 2;
speed = 2; // Larger number means slower, but smoother

divObj.posChangeInt = window.setInterval(
  function() {
  startWidth = (endWidth > startWidth) ? startWidth + Math.ceil((endWidth - startWidth) / speed):startWidth - Math.ceil((startWidth - endWidth) / speed);
  startHeight = (endHeight > startHeight) ? startHeight + Math.ceil((endHeight - startHeight) / speed):startHeight - Math.ceil((startHeight - endHeight) / speed);
  startX = (endX > startX) ? startX + Math.ceil((endX - startX) / speed):startX - Math.ceil((startX - endX) / speed);
  startY = (endY > startY) ? startY + Math.ceil((endY - startY) / speed):startY - Math.ceil((startY - endY) / speed);
  divObjOpStart += Math.ceil((divObjOpEnd - divObjOpStart) / speed);
  
  if (startWidth != endWidth) {
   divObj.style.width = startWidth + 'px';
   divObj.style.height = startHeight + 'px';
   divObj.style.left = startX + 'px';
   divObj.style.top = startY + 'px';
   setFade(divObj,divObjOpStart*.01);
   
   bigPicObj.width = startWidth - 2;
   bigPicObj.height = (startHeight - textHeight);
  } else {
   window.clearInterval(divObj.posChangeInt);
   divObj.style.width = endWidth + 'px';
   divObj.style.height = endHeight + 'px';
   divObj.style.left = endX + 'px';
   divObj.style.top = endY + 'px';
   setFade(divObj, 1);

   divObjTop = divObj.offsetTop;
   divObjRight = divObj.offsetLeft + divObj.offsetWidth;
   closeDivOp(divObjRight,divObjTop);

   picTemp = new Image(); // Reset picTemp so that it "picTemp.complete" will give a reading on the newly loading picture.
   picTemp.src = 'images/world_missions/past_outreaches/poid'+poid+'/'+photoInfo[photoNum][0];
   
   imgWrapObj = document.getElementById('imgWrap');
   loadingPicObj = document.getElementById('loadingPic');
   imgWrapWidth = imgWrapObj.offsetWidth;
   imgWrapHeight = imgWrapObj.offsetHeight;
   imgWrapLeft = findPosX(imgWrapObj);
   imgWrapTop = findPosY(imgWrapObj);
   loadingPicObj.style.left = parseInt((imgWrapWidth - loadingPicObj.offsetWidth) / 2) + imgWrapLeft + 'px';
   loadingPicObj.style.top = parseInt((imgWrapHeight - loadingPicObj.offsetHeight) / 2) + imgWrapTop + 'px';
   if (picTemp.complete) { // Check to see if the image is already in the browser cache.
    showBigFinish(photoNum);
   } else { // Image is not in the browser cache and is in the process of loading. Call function when it has completed loading.
    picTemp.onload = function() { showBigFinish(photoNum); };
   }
  }
  }
  , intervals)
}

function showBigFinish(photoNum) {
document.getElementById('loadingPic').style.left = '-100px';
bigPicObj = document.getElementById('bigPic');
bigPicObj.src = 'images/world_missions/past_outreaches/poid'+poid+'/'+photoInfo[photoNum][0];
bigPicObj.width = photoInfo[photoNum][2];
bigPicObj.height = photoInfo[photoNum][3];

BPobj = document.getElementById('bigPic');
//steps = time * fps;
//dofade(steps, obj, 0, true, type); // Fade in

setFade(BPobj,0);

intervals = 2;
speed = 4; // Larger number means slower, but smoother
bpOpStart = 0;
bpOpEnd = 100;

BPobj.bpChangeOpInt = window.setInterval(
  function() {
  bpOpStart += Math.ceil((bpOpEnd - bpOpStart) / speed);
  
  if (bpOpStart != bpOpEnd) {
   setFade(BPobj,bpOpStart*.01);
  } else {
   window.clearInterval(BPobj.bpChangeOpInt);
   setFade(BPobj, 1);
  }
  }
  , intervals)
}

function closeDivOp(divLeft,divTop) {
divCloseObj = document.getElementById('closeDiv');

topOffset = 17;
leftOffset = 13

/*divObjOpStart = 0;
divObjOpEnd = 100;
setFade(divCloseObj,divObjOpStart*.01);*/

divCloseObj.style.top = divObjTop - divCloseObj.offsetHeight + topOffset + 'px';
divCloseObj.style.left = divObjRight - divCloseObj.offsetWidth + leftOffset + 'px';

//intervals = 2;
//speed = 5; // Larger number means slower, but smoother

/*divCloseObj.closeChangeOpInt = window.setInterval(
  function() {
  divObjOpStart += Math.ceil((divObjOpEnd - divObjOpStart) / speed);
  
  if (divObjOpStart != divObjOpEnd) {
   setFade(divCloseObj,divObjOpStart*.01);
  } else {
   window.clearInterval(divCloseObj.closeChangeOpInt);
   setFade(divCloseObj, 1);
  }
  }
  , intervals)*/
}

/*------------------------
Generic 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 darkenPage() {
pageScreen = document.getElementById('cover');
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';

coverOT = new OpacityTween(pageScreen,'', 0, 80, .25);
coverOT.start();
}

function lightenPage() {
coverOT = new OpacityTween(pageScreen,'', 80, 0, .25);
coverOT.onMotionFinished = function() {
	document.getElementById('cover').style.display = 'none';
}
coverOT.start();
}

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 findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
  
/*==============================
Cookie functions
==============================*/

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";
  }
}
