<!--

//----------------------------------------------------
function validate_contact(frm) {
        
             
    if (isEmpty(frm.txtname.value))  {
            window.alert("Please enter a valid [name].");
			frm.txtname.focus(); 
                return false;
        }
        
        
     if (isEmpty(frm.txtemail.value))  {
            window.alert("Please enter a valid [email address].");
			frm.txtemail.focus(); 
                return false;
        }

    if (frm.txtemail.value.indexOf('@',0) < 0) {
            window.alert("Please enter a valid [Email address]. ");
			frm.txtemail.focus();
               return false;
        }

    if (frm.txtemail.value.indexOf('.',0) < 0) {
            window.alert("Please enter a valid [Email address]. ");
			frm.txtemail.focus();
               return false;
        }

     var eml = frm.txtemail.value;        
    if (eml.length < 4 )  {
            window.alert("[email address] must be greater than 3 characters.");
			frm.txtemail.focus(); 
            return false;
        }     

     if (spaceexists(frm.txtemail.value))
		{
            window.alert("[Email address] may not contain spaces. ");
			frm.txtemail.focus();
               return false;
        }


     if (illigalcharsexists(frm.txtemail.value))
		{
            window.alert("[Email address] contains illigal characters. ");
			frm.txtemail.focus();
               return false;
        }

     if (isEmpty(frm.txtphone.value))  {
            window.alert("Please enter a valid [telephone number].");
			frm.txtphone.focus(); 
                return false;
        }

	if (frm.sel_topic.options[frm.sel_topic.selectedIndex].text == '--none--' )
		{
			alert('please select a [topic]')
			frm.sel_topic.focus()
			return false;
		}    
                  
    if (isEmpty(frm.txtsubject.value))  {
            window.alert("Please enter a valid [subject].");
			frm.txtsubject.focus(); 
                return false;
        }

    if (isEmpty(frm.txtmessage.value))  {
            window.alert("Please enter a valid [mesage].");
			frm.txtmessage.focus(); 
                return false;
        }
             
        frm.submit();
        return true;
}

/*
 * Check for empty fields
 */
 function isEmpty(sInput) {
			
		var slength = sInput.length
		var ret = true

		for ( var i=0; i < slength ; i++ ) {

			if (sInput.charAt(i) != " " )
				ret = false
		}

	 return (ret)	

}

//-----------------------------------
function displaymsg(t, i, s, a)
{
  var ret
  ret = confirm("Do you want to delete the current item?","");
  
  if (ret == true)
	window.location="mydonations.asp?a=d&fundid=" + i
  else
  {
    return false;
  }
  
}

//load window
function loadwindow(surl) {	               

   var ret = window.open(surl,'styleguide', 'toolbar=no,status=no,location=0,scrollbars=1,width=300,height=300');	
 
	if (navigator.appName.indexOf("Explorer") == -1)	{		 	    
		ret.focus();  
		ret.document.close();         
       }      
     
}         

//------------------------------------------------------------------------------------
 function trim(toTrim) {
		var re;
		if(toTrim == '') return toTrim;
		re = /^\s+/;
		toTrim = toTrim.replace(re,"");	
		if(toTrim == '') return toTrim;
		re = /\s+$/;
		toTrim = toTrim.replace(re,"");	
		return toTrim;
	}
 

//--------------------------------------------------
function isAlphaSpace(strValue) {
	var strLength;
	var strExp;
	var re; 
	
	strValue = trim(strValue);
	if(strValue == "") return false;
	
	strLength = strValue.length;
	strExp = "[\\sA-Za-z]{" + strLength + "}";	

	re = new RegExp(strExp);
	if(re.exec(strValue)) return true;
	else return false;
}   

//check for spaces in a string
//---------------------------------
function spaceexists(inval) 
{		
		var ok = "no";
		var temp;
	
		for (var i=0; i< inval.length-1; i++) 
			{				
				if (inval.charAt(i) == " ") ok = "yes";
			}
			
		if (ok == "yes")
		 {
			return true;
		  }
		   return false;
}	


//check for illigal characters
//---------------------------------
function illigalcharsexists(inval) 
{		
	    var validchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890._-@";
		var ok = "no";
		var temp;
	
		for (var i=0; i< inval.length; i++) 
			{				
			    temp = "" + inval.substring(i,i+1);
				if (validchars.indexOf(temp) == "-1") ok = "yes";
			}
			
		if (ok == "yes")
		 {		    
			return true;
		  }
		   return false;
}	


//check for illigal characters
//---------------------------------
function illigalcharsexists2(inval) 
{		
	    var validchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890_";
		var ok = "no";
		var temp;
	
		for (var i=0; i< inval.length; i++) 
			{				
			    temp = "" + inval.substring(i,i+1);
				if (validchars.indexOf(temp) == "-1") ok = "yes";
			}
			
		if (ok == "yes")
		 {		    
			return true;
		  }
		   return false;
}	

//check for illigal characters
//---------------------------------
function isnumericanddecimal(inval) 
{		
	    var validchars = "01234567890.";
		var ok = "no";
		var temp;
	
		for (var i=0; i< inval.length; i++) 
			{				
			    temp = "" + inval.substring(i,i+1);
				if (validchars.indexOf(temp) == "-1") ok = "yes";
			}
			
		if (ok == "yes")
		 {		    
			return true;
		  }
		   return false;
}	

-->

