var ie4up = (document.all)? true : false;
var ns4   = (document.layers)? true : false;
var ns6up = (document.getElementById)? false : false;
if (ie4up) {ns6up = false; ns4=false;}
//if (!ie4up && !ns4) location.href = 'http://eweb.verizon.com/misc/upgrade/';

////////////////////
// Global Variables
////////////////////

var totImg = 7;//total corporate results images


///////////////////
// Date Generation
///////////////////

function myDate() {
    var now   = new Date();
    var weekday = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    var day   = weekday[now.getDay()];
    var month  = now.getMonth() + 1;
    var date  = now.getDate();
    var year  = now.getFullYear();
    year = year.toString();
    var today  = day + ' ' + month + '/' + date + '/' + year.substring(2,4);
    return today;
}

////////////////////
// Diversity Banner
////////////////////

var arrDiversity = new Array();
// add new line here for each diversity advertisement to be randomly selected

for (var i=0;i<=51;++i)
{if (i<10) arrDiversity[i] = 'banner_0'+i+'.gif';
 else arrDiversity[i] = 'banner_'+i+'.gif';}

function getDiversity() {
    var ran = Math.round((arrDiversity.length-1) * Math.random());
    return(arrDiversity[ran]);}


///////////////////
// Image Rollovers
///////////////////

var loaded = 0;
/*
if (document.images) {
    download_on = new Image();
    download_on.src = "/images/shared/download_on.gif";
    download_off = new Image();
    download_off.src = "/images/shared/download_off.gif";
    loaded = 1;}
*/

function changeImage(name,src) {
    if (document.images && loaded)
        document.images[name].src = eval(src + '.src');}


/////////////
// Jump Menu
/////////////

function jumpMenu(name) {
    var target = name.options[name.selectedIndex].value;
    if (target != '') location.href = target;}

//////////////
// Visibility
//////////////

function switchVisible(id,viz) {
    if (ns4 && getLayer(id))
        getLayer(id).visibility = (viz) ? 'show' : 'hide';
    if ((ie4up || ns6up) && getLayer(id))
        getLayer(id).style.visibility = (viz) ? 'visible' : 'hidden';}

///////////////////
// Menu Navigation
///////////////////

var isHome = 0;

function hideall(){
	switchVisible('menuDirectory2',0);
 	switchVisible('menuIntranet2',0);
 	switchVisible('menuResources2',0);
 	switchVisible('menuSites2',0);
}

function initMenus() {
    isHome = 1;
    hideall();}

var curstate = 'none';
function clickMenus(id)
{if (curstate == id) {dropMenus('none');curstate='none';}
 else {dropMenus(id);curstate = id;}
 }

var menuTimer;
function dropMenus(id) {
    if (!isHome) {
		hideall();
		switchVisible('menuClose11',1);
    	switchVisible('menuClose12',1);
		switchVisible('menuClose13',1);
		if (id == 'menuDirectory') {
        	menuTimer = setTimeout("switchVisible('menuDirectory2',1)",200);
    	} else if (id == 'menuIntranet') {
        	menuTimer = setTimeout("switchVisible('menuIntranet2',1)",200);	
    	} else if (id == 'menuResources') {
        	menuTimer = setTimeout("switchVisible('menuResources2',1)",200);
    	} else if (id == 'menuSites') {
        	menuTimer = setTimeout("switchVisible('menuSites2',1)",200);
    	} else if (!isHome) {
        	switchVisible('menuClose11',0);
			switchVisible('menuClose12',0);
			switchVisible('menuClose13',0);	
		}
	}	
}

function undoDropMenus(){
	clearTimeout(menuTimer);
	switchVisible('menuClose11',1);
    switchVisible('menuClose12',1);
	switchVisible('menuClose13',1);
}


/////////////
// Utilities
/////////////

function getLayer(id) {
    if (ns4) return eval('document.layers["'+id+'"]');
    if (ie4up) return eval('document.all["'+id+'"]');
    if (ns6up) return eval('document.getElementById("'+id+'")');
    return null;}

//////////////
// eDirectory
//////////////

function checkSearchTerm() {
    var teststr = document.Search.querytext.value.replace(/\s+/g," ");
    document.Search.querytext.value = teststr.replace(/\s+$/,"");
    if (document.Search.querytext.value.length == 0) 
	 alert ("Please Enter your Search Terms Before Submitting.");
	else document.Search.submit();}

function numchars(str) {
   var nonstars = 0;
   var mystr = new String(str);
   for (i = 0; i < mystr.length; i++){
      if (mystr.charAt(i) != "*")
         nonstars++;
   }
   return nonstars;
}

function validateForm()
{
   if ((document.exampleform.sn.value.indexOf("*") != -1) || (document.exampleform.givenname.value.indexOf("*") != -1)) {
      if (numchars(document.exampleform.sn.value) + numchars(document.exampleform.givenname.value) < 3) {
         alert ("A minimum of three characters is required with asterisk (*) in the name fields. Please refine search.");
         return;
      }
      else {
         document.exampleform.submit();
      }
   }

   if ((document.exampleform.sn.value.length!=0)||(document.exampleform.givenname.value.length!=0))
      document.exampleform.submit();
   else alert("Please fill in at least one field to search on.");

}
////////////////////
// Corporate Results
////////////////////

//randomize image
function randImage(){
    myImage = Math.ceil(Math.random() * (totImg));
    document.write("<IMG SRC='/images/home/corporate_results" + myImage + ".gif' width=165 height=59 border=0>");}
	
function netscapeCssFix(){
	if (document.FT.netscapeCssFix.initWindowWidth != window.innerWidth || document.FT.netscapeCssFix.initWindowHeight != window.innerHeight) {
		document.location = document.location;
  	}
}

function netscapeCssFixCheckIn()
{
  if (ns4 == true) {
    if (typeof document.FT == 'undefined'){
      document.FT = new Object;
    }
    if (typeof document.FT.FT_scaleFont == 'undefined') {
      document.FT.netscapeCssFix = new Object;
      document.FT.netscapeCssFix.initWindowWidth = window.innerWidth;
      document.FT.netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = netscapeCssFix;
  }
}

if (ns4 || ns6up){
	if (window.onresize){
		window.location.reload();
	}
}

netscapeCssFixCheckIn();

////////////////////
// Survey
////////////////////
function Show2WAY()
{
   if (navigator.appName.substring(0,5) == 'WebTV') { setTimeout("top.location='http://twoway.bellatlantic.com:80/2way/networkservices/2wTZZ/2WAY.html'", 375);
        } else {
		var fR = (false && (!((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) <= 3))));
                var rs = fR ? 'yes' : 'no';
                open('http://twoway.bellatlantic.com:80/2way/networkservices/2wTZZ/2WAY.html', 'twNUJ','toolbar=no,location=no,directories=no,scrollbars=yes,status=no,resizable=' + rs + ',copyhistory=no,width=794,height=600,top=0,left=0')

        }
        return false
}
////////////////////
// Share you story
////////////////////
function Show2SHARE()
{
   if (navigator.appName.substring(0,5) == 'WebTV') { setTimeout("top.location='http://gte2way.cc.gte.com:80/Dev/2w3DSW/2WAY.html'", 375);
        } else {
		var fR = (false && (!((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) <= 3))));
                var rs = fR ? 'yes' : 'no';
                open('http://gte2way.cc.gte.com:80/Dev/2w3DSW/2WAY.html', 'twNUJ','toolbar=no,location=no,directories=no,scrollbars=yes,status=no,resizable=' + rs + ',copyhistory=no,width=600,height=600,top=0,left=0')

        }
        return false
}




function showInfo(someURL){
	var new_win = window.open(someURL,"info","location=no,status=no,toolbar=no,scrollbars=yes,height=300,width=420,top=200,left=200");
	new_win.focus();
}

function showPegs(pegURL){
	var new_pegs = window.open(pegURL,"pegs","height=450,width=700,scrollbars=yes,menubar=yes,status=yes,location=yes,resizable=yes");
	new_pegs.focus();
}


