
//string functions
	//if empty string
	function isEmpty(s)
	{   return ((s == null) || (s.length == 0))
	}
	//letters
	function isLetter (c)
	{   return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
	}
	//numbers
	function isDigit (c)
	{   return ((c >= "0") && (c <= "9"))
	}

	//isnumeric function
	function isNumeric (s)
	{   
	//var s = s.replace(" ","");
	var i;

	  //hack for after test
	  if(s == ''){return true;}

 	  if (!((s == null) || (s.length == 0))) {		
		//test first value not .
		var c_first = s.charAt(0);
		//if(c_first=="."){return false;}
		
	    for (i = 0; i < s.length; i++)
	    {   
 	       // Check that current character is number or letter.
 	       var c = s.charAt(i);
		   //Sot# 92923 (updated to add .)
		   if (! ( isDigit(c) || (c == '.') ) ){ return false;}
 	       //if(!(isDigit(c))){ return false};
 	   	}
		
		//test last value not .
		var c_last = s.charAt((s.length - 1));
		if(c_last=="."){return false;}

   	 	// All characters are numbers or letters.
   	 	return true;
  	  }
	}
	
	function isEmail(email_obj){
	  	if ((email_obj.indexOf(".") < 3) && (email_obj.indexOf("@") < 0)){
			return false;
		}else{
			return true;
		}
	}
//end string functions

//this function is a class hack to the stylesheets in the old system
function changeClass(id, class_name, add_border, change_width, add_padding, padding_number, text_align){
	//change the class to another one for an id
	item_id = document.getElementById(id);

  if (item_id != null)
  { 
	item_id.className = class_name;
	
	//add a border
	if (add_border != ""){
		if(add_border == "all"){
			item_id.style.border = "solid 1px #000000";
		}else{
			test_border = add_border.toLowerCase();
			if (test_border.indexOf("left") >= 0){item_id.style.borderLeft = "solid 1px #000000";}else{item_id.style.borderLeft = "0px";}
			if (test_border.indexOf("right") >= 0){item_id.style.borderRight = "solid 1px #000000";}else{item_id.style.borderRight = "0px";}
			if (test_border.indexOf("bottom") >= 0){item_id.style.borderBottom = "solid 1px #000000";}else{item_id.style.borderBottom = "0px";}
			if (test_border.indexOf("top") >= 0){item_id.style.borderTop = "solid 1px #000000";}else{item_id.style.borderTop = "0px";}
		}
	}else{
		item_id.style.border = "0px";
	}
	
	//change the width to 100%
	if(change_width!=""){
		item_id.style.width = change_width;
	}
	
	//text align
	if(text_align!=""){
		item_id.style.textAlign = text_align;
	}
	
	//add the padding
	if(add_padding!=""){
		if(add_padding == "all"){
			item_id.style.padding = padding_number;
		}else{
			test_padding = add_padding.toLowerCase();
			if (test_padding.indexOf("left") >= 0){item_id.style.paddingLeft = padding_number;}
			if (test_padding.indexOf("right") >= 0){item_id.style.paddingRight = padding_number;}
			if (test_padding.indexOf("bottom") >= 0){item_id.style.paddingBottom = padding_number;}
			if (test_padding.indexOf("top") >= 0){item_id.style.paddingTop = padding_number;}
		}
	}
  }	
}

//popup window function
function Popup_window(page,width,height){
	//newwindow = window.open(page,'newwindow','width=' + width + ',height=' + height + ',resizable=no,scrollbars=no,menubar=no,status=no,toolbar=no');
	if(typeof(newwindow) !="undefined"){newwindow.close();}
  	mainleft = self.screen.width/4;
  	maintop = self.screen.height/4;
  	newwindow=window.open(page,'popup','width=800,height=600,resizable=no,scrollbars=no,status=no,toolbar=no,screenX=' + mainleft + ',screenY=' + maintop);
  	newwindow.focus();
}

//popup window function with scroll bar
function Popup_window_scroll(page,width,height){
	//newwindow = window.open(page,'newwindow','width=' + width + ',height=' + height + ',resizable=no,scrollbars=no,menubar=no,status=no,toolbar=no');
	if(typeof(newwindow) !="undefined"){newwindow.close();}
  	mainleft = self.screen.width/4;
  	maintop = self.screen.height/4;
  	newwindow=window.open(page,'popup','width=800,height=600,resizable=no,scrollbars=yes,status=no,toolbar=no,screenX=' + mainleft + ',screenY=' + maintop);
  	newwindow.focus();
}


//the contact_info function
var contact_info_org = 0;

function Moving_contact_info(){
	if(contact_info_org==0){
		contact_info_org = document.getElementById('contact_info_id').offsetTop;
	}
	if(contact_info_org < document.body.scrollTop){
		document.getElementById('contact_info_id').style.top = (document.body.scrollTop - contact_info_org) + 5;
	}else{
		document.getElementById('contact_info_id').style.top = 0;
	}
}

function show_item(e,id_show){
	if (!e) var e = window.event;
	id_show.style.left = e.clientX + document.body.scrollLeft;
	id_show.style.top = e.clientY + document.body.scrollTop;
	id_show.style.visibility = "visible";
}

function hide_item(id_hide){
	id_hide.style.visibility = "hidden";
}

//search page function
function test_search_field(obj){
	var test_val = obj.value;
	if(test_val==''){
		test_val=0;
	}
	if(!isNumeric(test_val)) {
		alert('Oops, the value must be a numeric value.\nIt must contain no symbols or letters.  ($,!,%)\nExample:  use 100000 instead of $100,000');
		obj.value='';
		obj.focus();
	}
}
