// JavaScript Document
// Created by Stefka Hristova
// shristova@lycos.com
// Zetools.com
// 2002


function imgOn(p,ext) {
  if(document.images[p]) {
	if (ext) {
	document.images[p].src = "images/" + p + "_on." + ext;
	}
	else {
	document.images[p].src = "images/" + p + "_on.gif";
	}
  }
}
function imgOff(p,ext) {
 if(document.images[p]) {
	if (ext) {
	document.images[p].src = "images/" + p +  "_off." + ext;
	}
	else {
	document.images[p].src = "images/" + p + "_off.gif"
	}
  }
}
function dobrands() {
	// Quick Links action
	var myform = document.forms[0].elements[0];

	if (myform.options[myform.selectedIndex].value != "") {
		window.location.href = "medical_" + myform.options[myform.selectedIndex].value + ".asp";
	}
}
function getURL() {
	var myurl = window.location.href;


	var mya = new Array;
	mya = myurl.split("/");
	var myparam = mya[3].replace (".html","");
	mysections = new Array;
	 if (myparam.indexOf('_') != -1) {
	 	mysections = myparam.split("_");
	 }
	 else {
	 	mysections[0] = myparam;
	 }


}

function navOn(p,n) {
 if(document.images[p+n]) {
	document.images[p+n].src = "images/arrow_white.gif";
  }
}
function navOff(p,n) {
	if (p+n != activeNav) {
		 if (document.images[p+n]) {
				document.images[p+n].src = "images/arrow_" + p + ".gif";
		 }
	}
}
var activeNav = "";
function setActiveNav(p,n) {
	activeNav = p+n;
	navOn(p,n);
}
function validateForm() {
eOne = "Check";
	var reqElements = ['fname','lname','company','title','email','city','state','address','zip'];
	if (window.location.href.indexOf('moments') != - 1) {
	var reqElements = ['firstname','jobtitle','email','lastname','country','profession','address1', 'city','state','zip'];
	}

		for (i = 0; i < reqElements.length; i ++ ) {
			var elname = reqElements[i];

			if (navigator.appName.indexOf("Microsoft") != -1) {

				if (document.forms['services'].elements[elname].value == "") {

					document.all["f"+elname].style.color = "#FF0000";
					eOne += " " + elname;
				}
				else {
					document.all["f"+elname].style.color = "#000000";
				}
			}
			else {
				if (document.forms['services'].elements[elname].value == "") {
					eOne += " " + elname;
				}
			}
		}

	if (eOne == "Check") {
		document.forms[0].submit();
	}
	else if  (navigator.appName.indexOf("Netscape") != -1) {
		alert("A required field has not been filled out, please make sure that all fields marked with a * have been filled out.");
	}
	else {
		return
	}

}

function openHImage(p) {
	if (document.layers) {
	var mypage = "history/history" + p + ".asp";
	}
	else {
	var mypage = "history" + p + ".asp";
	}
	var mywin = window.open(mypage,"history","width=660,height=680,scrolling=no");
	mywin.focus();

}

function adjustHImage(p) {
self.location.href = "history" + p + ".asp";

if ((opener) && (document.all)) {

opener.location.href = "corporate_history_frame.asp#" + p
}
}

function swapMulti(p) {
 document.images['multiples'].src = "images/splash_mmulti_" + p + ".gif";
}
function openMoments() {
	var mywin = window.open("medical_moments_pop.asp","moments","width=472,height=650,scrolling=no");
	mywin.focus();
}
function openGenB() {
	var mywin = window.open("medical_genb_pop.asp","moments","width=472,height=650,scrolling=no");
	mywin.focus();
}
function neuBrands() {
if (document.forms[0]) {
var myform = document.forms[0].elements[0];
myform.options[0].selected = true;
}

}

function validateZip() {
// added checks for 5 digits only
var myval = document.forms[0].elements['zipcode'].value;
var pattern = /\d{5}/;

if (myval == "") {
   alert('Please enter a zip code') ;

}
else if ((myval.length > 5) || (!pattern.test(myval))){
	alert('Please enter 5 digits zip code');
}

 else {
    document.forms[0].submit();
 }
}
function bgNoRep() {
	//if (document.all) {
		//if (document.all['maingraph']) {
			//document.all['maingraph'].style.backgroundRepeat = "no-repeat";
		//}
	//}

}