sfHover = function() {

	/* this allows us to set up suckerfish to be used on different pages, but only initialize once */
	var sfIDs = new Array();
	sfIDs[0] = "related";
	sfIDs[1] = "primary-nav";
	sfIDs[2] = "persistent-subnav";

	/* this just loops through all possible SF ids and initializes if the ID exists */
	for(n=0;n<sfIDs.length;n++) {
		if(document.getElementById(sfIDs[n])) {
			var sfEls = document.getElementById(sfIDs[n]).getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			}
		}
	}	
}

//this function is for site-wide popups
//usage example: <a href="#" onclick="MM_openBrWindow('somelinkhere.php','','scrollbars=yes,width=450,height=450')">Pop goes the weasle</a> 
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*function hilightLinks() {
	if (document.getElementById("aruba")) {
		m = document.getElementById("aruba").getElementsByTagName("a");
		for(var i=0;i<m.length;i++) {
			if(m[i].href.toString().slice(m[i].href.toString().lastIndexOf('#')) == "#") {
				m[i].className += " hilight";
			}
		}
	}
}*/

function handleError(description,pagename,lineno) {
	var domain = /(.*airwave\.com.*)/i;
	if (!domain.test(window.location.host)) {
		alert(
		'An Error occurred! \n'
		+'\n Description: \t'+description
		+'\n Page Name:      \t'+pagename
		+'\n At Line :       \t'+lineno
		);
	}
	return true;
}
window.onerror = handleError;

var mytest;
function externalLinks() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		var bookmarks = /^#/;
		var external = /(.pdf$)|(.asc$)|(.mov$)/;
		var domain = /(.*arubanetworks\.com.*)|(.*airwave\.com.*)|(.*acrobat\.com.*)|(.*arubanetworks\..*\.com.*)|(.*server\.iad\.liveperson\.net.*)/i;
		if ( !bookmarks.test(anchor.getAttribute("href")) //screen out bookmarks, must go first, otherwise host issues!
			&& ((anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") //classed as external
				|| external.test(anchor.getAttribute("href"))  //matches file types
				|| true
				|| window.location.host != anchor.host.substring(0, window.location.host.length))  //window host not match link host
			&& anchor.getAttribute("rel") != "local"  //screen out links tagged local
			&& anchor.getAttribute("href") != null //href optional anchor tags
			&& anchor.protocol != 'mailto:'  //sceeen out mailto's
			&& anchor.protocol != 'javascript:'){  //sceen out javascript functions

			if (!domain.test(anchor.host)) {
				anchor.onclick = message;
				anchor.target = "_blank";
			}
		}
 }
}

function message() {
	window.alert("You are about to visit a site not affiliated with Airwave.com");}
function goToArubaMsg() {
	window.alert("AirWave is a division of Aruba Networks, you are now being directed to www.arubanetworks.com");
}

function initAirwaveGlobal() {
	/*hilightLinks(); */
	externalLinks();
	if (document.all && ie6) sfHover();
	
	if(document.getElementById('case_studies_summary')){
		displayNextCaseStudy();
	}
}
//this is the print function for the product pages
function printWindow(divId) {
     newwindow=window.open('','newwin','height=800,width=700,scrollbars=yes'); 
     newwindow.document.write('<html><head></head><style>.secondary, .printMe {display: none ;} table, .accordion {display: block; overflow: visible; height:auto !important;} table td {border-bottom: 1px solid #cccccc; width:50%; line-height:14px;}</style><bo'+'dy onLoad="window.focus(); window.print()">'+document.getElementById(divId).innerHTML+'</body></html>');
	 
     newwindow.document.close();
	 document.all('textarea').value = document.all('textarea').value + '\n';
}

//this is the window popup function for the language pages
function global_openCdcPopup ( url, width, height ) {
  if ( isNaN(parseInt(width)) ) { width=550; }
  else { width=parseInt(width); }
  if ( isNaN(parseInt(height)) ) {height=550; }
  else { height=parseInt(height); }
  var windowparms = "status=yes,scrollbars=yes,resizable=yes,width="+width+",height="+height;
  var popup = window.open ( url, "globalCDCpopup", windowparms);
  if (popup) popup.focus();
}

 function addToWindowOnLoad(funct){
 	var oldOnload = window.onload;
 	if (typeof window.onload != 'function') {
 		window.onload = funct;
 	}
 	else {
 		window.onload = function() {
 			oldOnload();
 			funct();
     	};
     }
 }

function showLangDD() {
  if (document.getElementById('chooselangul')) {    
    var e = document.getElementById('chooselangul');
    if (e.style.display == "none") {
      e.style.display = "block";
    } else {
      e.style.display = "none";
    }
  }
}


function toggle(showHideDiv, switchTextDiv) {
	var ele = document.getElementById(showHideDiv);
	var text = document.getElementById(switchTextDiv);
	if(ele.style.display == "") {
    		ele.style.display = "none";
		text.innerHTML = "[+]";
  	}
	else {
		ele.style.display = "";
		text.innerHTML = "[-]";
	}
} 


var good;
function checkEmailAddress(field) {
// the following expression must be all on one line...
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail){
   good = true
} else {
   alert('Please enter a valid e-mail address and try again.')
   field.focus()
   field.select()
   good = false
   }
}

u = window.location;
m = "I thought this might interest you...";
function mailThisUrl(){
   good = false
   checkEmailAddress(document.eMailer.address)
  if (good){
      // the following expression must be all on one line...
      window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+document.title+" can be found at: "+u;
   }
}

var caseStudies = new Array();
<!-- CASE STUDIES (245px MAX WIDTH FOR IMAGES) -->


var cs = {
	summary: '&ldquo;AirWave 7 Brings Unified Management To The Mobile Enterprise&rdquo;',
	logo: '/wp-content/themes/airwave/i/aw7.gif', 
	pdf: '/resources/demos/'
	};
  	cs.logo = "/wp-content/themes/airwave/i/aw7.gif";
 	caseStudies.push(cs);
 	
var cs = {
	summary: '&ldquo;MultiCare leverages AirWave&reg; to manage Nortel and Cisco based WLAN&rdquo;',
	logo: '/wp-content/themes/airwave/i/logo_multicare.gif', 
	pdf: '/_uploads/airwave-casestudy-multicare.pdf'
	};
  	cs.logo = "/wp-content/themes/airwave/i/logo_multicare.gif";
 	caseStudies.push(cs); 	
  
var cs = {
	summary: '&ldquo;Giant Eagle Uses AirWave Wireless Management Suite to Operate a Multi-Vendor and Highly Distributed Retail Wireless Network.&rdquo;', 
	logo: '/wp-content/themes/airwave/i/logo_giant_eagle.jpg', 
	pdf: '/_uploads/airwave-casestudy-giant-eagle.pdf'
	};
	cs.logo = "/wp-content/themes/airwave/i/logo_giant_eagle.jpg";
	caseStudies.push(cs);

var cs = {
	summary: '&ldquo;Denver Public Schools Uses AirWave Wireless Management Suite to Operate a District-Wide Cisco Wireless Network.&rdquo;', 				
	logo: '/wp-content/themes/airwave/i/logo_uofdenver.gif',
	pdf: '/_uploads/airwave-casestudy-denver-public-schools.pdf'
	};
  cs.logo = "/wp-content/themes/airwave/i/logo_denverpublic.gif";
  caseStudies.push(cs);
  
var cs = {
	summary: '&ldquo;The AirWave Management Platform has really simplified the management of our wireless network.&rdquo;', 
	logo: '/wp-content/themes/airwave/i/logo_uofdenver.gif', 
	pdf: '/_uploads/airwave-casestudy-university-denver.pdf'
	};
  	cs.logo = "/wp-content/themes/airwave/i/logo_uofdenver.gif";
  	caseStudies.push(cs);
  
var cs = {
	summary: '&quot;Standardizing on ProCurve and AirWave products was a sound decision that immediately exceeded our expectations...&rdquo;', 
	logo: '/wp-content/themes/airwave/i/logo_hp.jpg', 
	pdf: '/_uploads/airwave-casestudy-hp-procurve.pdf'
	};
  	cs.logo = "/wp-content/themes/airwave/i/logo_hp.jpg";
  	caseStudies.push(cs);

<!-- END CASE STUDIES -->


var selectedCaseStudy = 0;
function displayNextCaseStudy() {
  if(selectedCaseStudy >= caseStudies.length) selectedCaseStudy = 0;
  var cs = caseStudies[selectedCaseStudy];
  document.getElementById('case_studies_summary').innerHTML = cs.summary;
  document.getElementById('case_studies_logo').src = cs.logo;
  document.getElementById('link_viewCaseStudy').href = cs.pdf;
  selectedCaseStudy++;
}
