window.onerror = handleErrors; // or null to suppress error message
function handleErrors(msg, url, line)
{ return true; }

// top image rollovers
if (document.images) {            
  coon = new Image();   coon.src = "images/b_company_on.gif"; 
  cooff = new Image();  cooff.src = "images/b_company_off.gif";
  soon = new Image();   soon.src = "images/b_solutions_on.gif"; 
  sooff = new Image();  sooff.src = "images/b_solutions_off.gif";
  clon = new Image();   clon.src = "images/b_clients_on.gif"; 
  cloff = new Image();  cloff.src = "images/b_clients_off.gif";
  cuon = new Image();   cuon.src = "images/b_contact_on.gif"; 
  cuoff = new Image();  cuoff.src = "images/b_contact_off.gif";
}
function imgOn(imgName) {
    if (document.images) {
        document[imgName].src = eval(imgName + "on.src");       
    }
}
function imgOff(imgName) {
    if (document.images) {
        document[imgName].src = eval(imgName + "off.src");
    }
}
// case studies popup
function popup(mypage) 
{ 
	var wina
	var ht=262
	var wd=740 
	var wint=(screen.height - ht) / 2; 
	var winl=(screen.width - wd) / 2;
	wina=window.open(mypage, 'samples', 'height=214,innerheight=214,width=740,innerwidth=740,top='+wint+',left='+winl+'') 
if (parseInt(navigator.appVersion) >=4) 
{ wina.window.focus(); } } 

// add to favorites
function bookmark(){
window.external.AddFavorite("http://www.adoptinfo.net","Adoption TODAY Magazine");
var url="http://www.adoptinfo.net";
var title="AdoptionTODAY";
}


var ns6=document.getElementById&&!document.all
var ie=document.all

function show_text(thetext, whichdiv){
if (ie) eval("document.all."+whichdiv).innerHTML=linktext[thetext]
else if (ns6) document.getElementById(whichdiv).innerHTML=linktext[thetext]
}

function reset(whichdiv){
if (ie) eval("document.all."+whichdiv).innerHTML=' '
else if (ns6) document.getElementById(whichdiv).innerHTML=' '
}

function popup2(mipage) 
{ 
	var winb
	var hta=430
	var wda=580 
	var winta=(screen.height - hta) / 2; 
	var winla=(screen.width - wda) / 2;
	winb=window.open(mipage, 'samples', 'height=430,innerheight=430,width=580,innerwidth=580,top='+winta+',left='+winla+'') 
if (parseInt(navigator.appVersion) >=4) 
{ winb.window.focus(); } } 

// add to favorites
function bookmark(){
window.external.AddFavorite("http://www.adoptinfo.net","Adoption TODAY Magazine");
var url="http://www.adoptinfo.net";
var title="AdoptionTODAY";
}

// layer show & hide
// Browsercheck
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()
// With nested layers for netscape, this function hides the layer if it's visible and visa versa
function showHide(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	if(obj.visibility=='visible' || obj.visibility=='show') obj.visibility='hidden'
	else obj.visibility='visible'
}
// Shows the div
function show(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	obj.visibility='visible'
}
// Hides the div
function hide(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	obj.visibility='hidden'
}


// email validation
function emailCheck() {
txt=document.isn.email.value;
if (txt.indexOf("@")<3){
alert("Please enter a valid e-mail address. Ex. info@adoptinfo.net");
return false;
}
if ((txt.indexOf(".com")<5)&&(txt.indexOf(".org")<5)
&&(txt.indexOf(".gov")<5)&&(txt.indexOf(".net")<5)
&&(txt.indexOf(".cc")<5)&&(txt.indexOf(".info")<5)
&&(txt.indexOf(".mil")<5)&&(txt.indexOf(".edu")<5)){
alert("I'm sorry. This email address seems wrong. Please"
+" check the suffix for accuracy. (It should include a "
+".com, .edu, .net, .org, .gov or .mil)");
return false;
	}
return true;
}

// email address
function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

// valid required
function validRequired(formField,fieldLabel)
{
	var result = true;
	
	if (formField.value == "")
	{
		alert('Please enter a value for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	return result;
}

// validate digits
function allDigits(str)
{
	return inValidCharSet(str,"0123456789");
}

// validate email
function validEmail(formField,fieldLabel,required)
{
	var result = true;
	if (required && !validRequired(formField,fieldLabel))
		result = false;
	if (result && ((formField.value.length < 3) || !isEmailAddr(formField.value)) )
	{
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		formField.focus();
		result = false;
	}
  return result;
}

// valid number field
function validNum(formField,fieldLabel,required)
{
	var result = true;
	if (required && !validRequired(formField,fieldLabel))
		result = false;
 	if (result)
 	{
 		if (!allDigits(formField.value))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	return result;
}

// validate integer
function validInt(formField,fieldLabel,required)
{
	var result = true;
	if (required && !validRequired(formField,fieldLabel))
		result = false;
 	if (result)
 	{
 		var num = parseInt(formField.value);
 		if (isNaN(num))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	return result;
}
