/* ***************************************************************************************
 * File:             mission_global.js
 * Description:      Global JavaScript utilities for Mission Houston
 * Revision History: 2006-10-04 [am] File created
 * **************************************************************************************** */

 <!-- //
 
/* *************************************************************************
 * *************************************************************************
 * Utility Functions 
 * *************************************************************************
 * ************************************************************************* */

  /* ******************************************************
  * InitRollover
  * Description: Initialize rollover images by preloading and defining mouseover/out functions
  * Arguments:   None
  * Return:      None
  * ****************************************************** */
function InitRollover() {
   /* Verify browser support */
   if(!document.getElementById) return;
   
	var imgOriginSrc;
	var imgTemp       = new Array();
	var imgArray      = document.getElementsByTagName('img');
	
	/* For each image in document, if hsrc element exists, it will be the rollover image */
   for(var i = 0; i < imgArray.length; i++) {
      /* src is normal image */
      imgTemp[i] = new Image();
      imgTemp[i].src = imgArray[i].getAttribute('src');
      
      /* hsrc attribute is rollover image */
      if(imgArray[i].getAttribute('hsrc')) {
         imgTemp[i] = new Image();
         imgTemp[i].src = imgArray[i].getAttribute('hsrc');
         
         /* rollover function */
         imgArray[i].onmouseover = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'));
         }
         
         /* rollout function */
         imgArray[i].onmouseout = function() {
            if (imgOriginSrc) this.setAttribute('src',imgOriginSrc);
         }
      }
   }
}

function WinPopup(pUrl,pName,h,w,scroll) {
	var settings = 'height='+h+',width='+w+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',scrollbars='+scroll+',resizable=yes';
	var win=window.open(pUrl,pName,settings);
	if(parseInt(navigator.appVersion)>=4) win.window.focus();
}

function NewsWindow(pUrl) {
   WinPopup(pUrl, 'newsWindows', 600, 640, 'yes');
}

function checkform()
{
	if (document.paypal.a3.value == "")
		alert("Please enter an amount to continue");
	else if (isNaN(document.paypal.a3.value))
		alert("Please enter a valid amount to continue");
	else
	{
		document.paypal.item_name.value = "Recurring Monthly $" + document.paypal.a3.value + " Donation";
		document.paypal.item_number.value = "recurring" + document.paypal.a3.value;
		document.paypal.submit();
	}
}


 // -->
