<!--
/************************************************
* default colors for TemplateTextControl rollover
************************************************/
var defaultbgcolor="#96B6D7";
var defaultbordercolor="#000000";

function clearsearch(f)
{
	f.query.value="";
}

function GetField(f,fld)
{
	for (x=0;x<f.length;x++)
	{
		var elem=f[x];
		if (elem.name.indexOf(fld) > 0)
		{
			return elem;	
		}	
	}
} 

function DL_GetElementLeft(eElement)
{
	var nLeftPos = eElement.offsetLeft;          
	var eParElement = eElement.offsetParent;     
	while (eParElement != null)
	{                                            
		nLeftPos += eParElement.offsetLeft;  
		eParElement = eParElement.offsetParent;  
	}
	return nLeftPos;                             
}

function DL_GetElementTop(eElement)
{
	var nTopPos = eElement.offsetTop;           
	var eParElement = eElement.offsetParent;    
	while (eParElement != null)
	{                                            
		nTopPos += eParElement.offsetTop;        
		eParElement = eParElement.offsetParent;  
	}
	return nTopPos;                              
}

function openVideoAdmin(pgID,component_id,admin_nav_id,seq)
{
	var url="/VideoComponent/VideoComponentAdmin.aspx?pgID=" + pgID + "&component_id=" + component_id + "&admin_nav_id=" + admin_nav_id + "&seq=" + seq;
	var editWin=window.open(url,"cmsadmin","top=50,left=150,width=650,height=560,scrollbars=1,menubar=0,resizable=yes");
	editWin.focus();
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function setEmailCookie()
{
	var email=document.getElementById("EmailText");
	createCookie('useremail',email.value.toLowerCase(),0);
}

function clickButton(e, buttonid)
{
	var evt = e ? e : window.event;
	var bt = document.getElementById(buttonid);
	if (bt)
	{
		if (evt.keyCode == 13)
		{
			setEmailCookie();
			document.location=bt;
			return false;
		}
	}
}

function clickLink(linkobj) {
	alert(linkobj);
     if (linkobj.getAttribute('onclick') == null) {
          if (linkobj.getAttribute('href')) document.location = linkobj.getAttribute('href');
     }
     else linkobj.onclick();
}

// Email Validation Javascript
// copyright 23rd March 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function validateEmail(addr,man,db) {
addr=addr.toLowerCase();
if (addr == '' && man) {
   if (db) alert('Email address is mandatory.');
   return false;
}
if (addr == '') return true;
var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
for (i=0; i<invalidChars.length; i++) {
   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
      if (db) alert('Email address contains invalid characters.');
      return false;
   }
}
for (i=0; i<addr.length; i++) {
   if (addr.charCodeAt(i)>127) {
      if (db) alert("email address contains non ascii characters.");
      return false;
   }
}

var atPos = addr.indexOf('@',0);
if (atPos == -1) {
   if (db) alert('Email address must contain an @.');
   return false;
}
if (atPos == 0) {
   if (db) alert('Email address must not start with @.');
   return false;
}
if (addr.indexOf('@', atPos + 1) > - 1) {
   if (db) alert('Email address must contain only one @.');
   return false;
}
if (addr.indexOf('.', atPos) == -1) {
   if (db) alert('Email address must contain a period in the domain name.');
   return false;
}
if (addr.indexOf('@.',0) != -1) {
   if (db) alert('Period must not immediately follow @ in email address.');
   return false;
}
if (addr.indexOf('.@',0) != -1){
   if (db) alert('Period must not immediately precede @ in email address.');
   return false;
}
if (addr.indexOf('..',0) != -1) {
   if (db) alert('Two periods must not be adjacent in email address.');
   return false;
}
var suffix = addr.substring(addr.lastIndexOf('.')+1);
if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
   if (db) alert('Invalid primary domain in email address.');
   return false;
}
return true;
}

function docheckout(f)
{
	if(validateAmount(f.item_price_1))
	{
		f.action="https://checkout.google.com/cws/v2/Donations/468071785896244/checkoutForm";
		f.target="googcheckout";
		f.submit();
		return false;
	}
	else
	{
		return false;
	}
}
//-->
