/*  VALIDATION FUNCTIONS */

function isEmail(elem) {
	elem.style.backgroundColor = ''; 
	if(!elem.value.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)) { 
		elem.style.backgroundColor = '#ffcc99'; 
		return false; 
	} else {
		return true;
	}
}

function isEmpty(elem) { 
	elem.style.backgroundColor = ''; 
	if(elem.value == '' ) { 
		elem.style.backgroundColor = '#ffcc99'; 
		return true; 
	} else {
		return false; 
	}
}

function isInt (str)
{
	var i = parseInt (str);

	if (isNaN (i))
		return false;

	i = i . toString ();
	if (i != str)
		return false;

	return true;
}

<!-- Original:  Fred Roberts (fred@gloryofgod.com) -->
function filterNum(str) {
re = /^\$|,/g;
// remove "$" and ","
return str.replace(re, "");
}



function popUp(URL,w,h) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left = 490,top = 262');");
}

function clearSearch() {
	var f = document.searchform;
	
	if ( f.searchbox.value == "Search..." ) {
		f.searchbox.value = '';
		f.searchbox.focus();
	}
} 
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.innerHTML = limitNum - limitField.value.length;
	}
}

/* Author source: http://labnol.blogspot.com/2006/01/add-to-favorites-ie-bookmark-firefox.html */
 function CreateBookmarkLink(title,url) {

 	if ( title == '' )
 		title = document.title; //"Webpage Title"; 
  // Blogger - Replace with <$BlogItemTitle$> 
  // MovableType - Replace with <$MTEntryTitle$>
	
//  	if ( url == '' )
// 		url = '<?php bloginfo('url'); ?>';
  // Blogger - Replace with <$BlogItemPermalinkURL$> 
  // MovableType - Replace with <$MTEntryPermalink$>
  // WordPress - '<?php bloginfo('url'); ?>';

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
 /*
 Use the code below to call CreateBookmarkLink
 if (window.external) {
  document.write('<a href = "javascript:CreateBookmarkLink()");">Add to Favorites</a>'); 
  } else  if (window.sidebar) {
  document.write('<a href = "javascript:CreateBookmarkLink()");">Bookmark Page</a>'); 
 } else if (window.opera && window.print) {	
   document.write('<a href = "javascript:CreateBookmarkLink()");">Add Bookmark</a>');
 } 
*/