//Internet Browser Check
//Checks whether the browser is IE or NS and loads the appropriate style
if(navigator.appName!="Netscape"){
	document.write("<link rel='STYLESHEET' type='text/css' href='includes/ieStyleSheet.css'>");
}else{
	document.write("<link rel='STYLESHEET' type='text/css' href='includes/nsStyleSheet.css'>");
}

//OffSite Warning Code
//Any external link will call for this function
function offramp(offRampLink) {
   if (confirm("You have chosen a link that will take you outside of the OLCR Corporate Website.  OLCR is not responsible for any content beyond this point."))
   popUpWin(offRampLink, 'OFFRAMPWIN','toolbar=yes,location=yes,scrollbars=auto,resizable=yes,left=0,top=0,screenx=0,screeny=0,width=780,height=500');
}

//PDF Adobe Acrobat Confirm
//Pops up a dialage box asking if user has Adobe Acrobat installed
//fileLocation is the path of the PDF file
//fileName is the Name of the file requested
function confAcro(fileLocation,fileName) {
	if (!confirm("In order to view " +fileName+ ", you must have Adobe Acrobat installed on your system.  If you do click 'OK' to continue.  If you do not have Acrobat, press 'Cancel' and you will be taken to the Adobe download screen to download Acrobat."))
popUpWin('http://www.adobe.com/products/acrobat/readstep.html','Acro','toolbar=yes,location=yes,scrollbars=yes,resizable=yes,left=0,top=0,screenx=0,screeny=0,width=780,height=500');
	else (popUpWin(fileLocation, 'Acro','scrollbars=yes,resizable=yes,left=0,top=0,screenx=0,screeny=0,width=780,height=500'));
}

//Bookmark this site for IE and NS
function bookmark() {
   if(navigator.appVersion.indexOf('Mac') != -1)
      alert('Press Apple+D to bookmark this site.');
   else if (navigator.userAgent.indexOf("MSIE") != -1)
      window.external.AddFavorite('http://www.olcr.com/index.asp','OLCR Wireless Store');
   else
      alert('Netscape Users press Control+D to bookmark this site.');
}

//RollOver functions
//iName: the value of the "name" attribute of the original image
//rName: the path to the rollover image
function rollOver(iName, rName) {
	    document[iName].src = rName;
}

//this function is called by the onLoad property of the body tag
//see the body tag below for the syntax used to call the function
function preloadImages() {
 	if (!document.images) return;
  	var ar = new Array();
  	var args = preloadImages.arguments;
	
	for (var i = 0; i < args.length; i++) {
  		ar[i] = new Image();
	   	ar[i].src = args[i];
  	}
}

//Rollover functions for top nav
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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//General Popup window code
function popUpWin(url, windowname, att){
	window.open(url, windowname, att);
	}


	var url

	function changepage_go()
	{
		url = document.navform.navmenu.options[document.navform.navmenu.options.selectedIndex].value;

		if(url != "empty")
			{
			window.location = url;
			url = "";
			}
	}

//Email Validator
function validEmail(email) {
		invalidChars = " /:,;"
		if (email == "") {
			return false
		}
		for (i=0; i<invalidChars.length; i++) {
			badChar = invalidChars.charAt(i)
			if (email.indexOf(badChar,0) != -1) {
				return false
			}
		}
		atPos = email.indexOf("@",1)
		if (atPos == -1) {
			return false
		}
		if (email.indexOf("@",atPos+1) != -1) {
			return false
		}
		periodPos = email.indexOf(".",atPos)
		if (periodPos == -1) {
			return false
		}
		if (periodPos+3 > email.length)	{
			return false
		}
		return true
	}
	function submitIt(form) {
		if (!validEmail(form.emailAddr.value)) {
			alert("Invalid email address")
			form.emailAddr.focus()
			form.emailAddr.select()
			return false
		}
		return true
	}
	

	