view1=0;
view2=0;
view3=0;

isNS4 = (document.layers) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function checka(){
	if(view1==0) {
	hide('Layer1');
	di20('reg','images/btn_register.gif');
	}
}
function checkb(){
	if(view2==0) {
	hide('Layer2');
	di20('adv','images/btn_advantage.gif');
	}
}
function checkc(){
	if(view3==0) {
	hide('Layer3');
	di20('search','images/btn_search.gif');
	}
}


/* This is the start of the code for the layers */
function show(object){
   if (isIE5 || isNS6)
      document.getElementById(object).style.visibility = "visible";
   if (isNS4)
      eval('document.' + object + '.visibility = "visible"');
}
function hide(object){
   if (isIE5 || isNS6){
   document.getElementById(object).style.visibility = "hidden";}
   if (isNS4){
      eval('document.' + object + '.visibility = "hidden"');}
}

/* Function that swaps images. */

function di20(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */

function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function newNavcontent(pageid){
	hideserv();
	//document.getElementById('serv1').style.display = "inline";
	showdisp('exp'+pageid);
/*	document.getElementById('servecontent').src = 'services_details.cfm?pageid='+pageid;
	document.getElementById('servecontent').style.height = iheight+'px';*/
}
function hideserv(){
	hidedisp('exp1');
	hidedisp('exp2');
}

function showdisp(object){
   if (isIE5 || isNS6)
      document.getElementById(object).style.display = "block";
/*   if (isNS4)
      eval('document.' + object + '.visibility = "visible"');*/
}
function hidedisp(object){
   if (isIE5 || isNS6){
   document.getElementById(object).style.display = "none";}
/*   if (isNS4){
      eval('document.' + object + '.visibility = "hidden"');}*/
}

/* Back to Top */
function backToTop() {
    var x1 = x2 = x3 = 0;
    var y1 = y2 = y3 = 0;

    if (document.documentElement) {
        x1 = document.documentElement.scrollLeft || 0;
        y1 = document.documentElement.scrollTop || 0;
    }

    if (document.body) {
        x2 = document.body.scrollLeft || 0;
        y2 = document.body.scrollTop || 0;
    }

    x3 = window.scrollX || 0;
    y3 = window.scrollY || 0;

    var x = Math.max(x1, Math.max(x2, x3));
    var y = Math.max(y1, Math.max(y2, y3));

    window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));

    if (x > 0 || y > 0) {
        window.setTimeout("backToTop()", 25);
    }
}

function popIntro(source){
	newView = window.open(source,"popup","width=800,height=600,resizable=1,scrollbars=1,toolbar=1,menubar=1,location=1")
	newView.focus();
}
function popHist(source){
	newViewa = window.open(source,"popupa","width=500,height=500,resizable=0,scrollbars=1,toolbar=no,menubar=0,location=0")
	newViewa.focus();
}
function popTemp(source){
	newViewa = window.open(source,"popupa","width=400,height=300,resizable=0,scrollbars=0,toolbar=no,menubar=0,location=0")
	newViewa.focus();
}
function popScience(source){
	newView = window.open(source,"popup","width=700,height=600,resizable=1,scrollbars=1,toolbar=0,menubar=0,location=0")
	newView.focus();
}

function ValidateEmail(sEmail)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(sEmail)) {
		return false;
	}
	return true;
}