<!--

/**********************************
   Generic Global Variables
**********************************/
// globals for browser version branching
var Ver4 = parseInt(navigator.appVersion) >= 4;
var Nav4 = ((navigator.appName == "Netscape") && Ver4);
var IE4 = ((navigator.userAgent.indexOf("MSIE") != -1) && Ver4);
var reEmail = /^.+\@.+\..+$/;
var whitespace = " \t\n\r";
var defaultEmptyOK = false;

function newWindow02(page) {
	msgWindow=window.open(page,"windowName","width=631,height=450,menubar=no,status=no,scrollbars=yes,scrollable=yes,toolbar=no,resizable=no,location=no")
}

// to open a new window: (Amgen's global usage)
function newWindow(page)
{
msgWindow=window.open(page,"windowName","width=640,height=480,menubar=yes,status=yes,scrollbars=yes,scrollable=yes,toolbar=yes,resizable=yes,location=yes");
}
// Functions for Opening the warning regarding leaving the site
function SS_warning(url){
	window.open("/legal_popup.jsp?url=" + url, "popup", "width=440, height=347, scrollbars=yes");
}
function SS_warnContinue(form) {
	var url = location.search.substring(location.search.indexOf("=")+1);
	window.opener.location.href = 'http://' + url;
	window.close();
}

// New readable version of the Browser-independent
// object finder function
// 2 arguments - 1. objName => the name of the obj to find
//		2. rootElement => the root element to start the search from

function findObj(objName, rootElement) {
	var frameIdentifier,obj;
	var i;

	// Identify presence of frames and root element
	if(!rootElement)
		rootElement=document;
	if((frameIdentifier=objName.indexOf("?"))>0&&parent.frames.length) {
		rootElement=parent.frames[objName.substring(frameIdentifier+1)].document;
		objName=objName.substring(0,frameIdentifier);
	}

	// First do a direct search
	if(!(obj=rootElement[objName]) && rootElement.all)
		obj=rootElement.all[objName];

	// Second look for object within forms, if any
	for (i=0;!obj&&i<rootElement.forms.length;i++)
		obj=rootElement.forms[i][objName];

	// Recursively search layers if object is still not found
	for(i=0;!obj && rootElement.layers && i<rootElement.layers.length;i++)
		obj=findObj(objName,rootElement.layers[i].document);

	return obj;
}

// New readable version of the browser-independent dynamic image
// swapper function
// 2 (or multiples of 2) arguments - img1 name, img1.newSrc, img2 name, img2.newSrc, ..
function imgSwap() {
	var obj;

	var argv = imgSwap.arguments;
	var argc = argv.length;
	var i,j=0;

	if ((argc % 2) != 0)
		return;
	for(i=0; i<argc; i+=2) {
		if ((obj=findObj(argv[i]))!=null){
			if(!obj.origSrc)
				obj.origSrc=obj.src;
			obj.src=argv[i+1];
		}
	}
}

// an image pre-loader.  variable is used within the pre-loader for the array.
var CalledImages = new Array();
function imgCall(Root) {
	if (document.images && CalledImages)
		{
		for (var xx=1; xx < imgCall.arguments.length; xx++) {
			var oo               = CalledImages.length;
			CalledImages[oo]     = new Image();
			CalledImages[oo].src = Root + imgCall.arguments[xx];
		}
	}
}

function sendPage(url) {
	sendWindow=window.open(url + "?url=" + escape(document.URL),"send","width=500,height=870,menubar=no,status=no,scrollbars=yes,scrollable=no,toolbar=no,resizable=no,location=no");
}

function popLegal(url) {
	legal=window.open(url,"legal","width=440,height=540,menubar=no,status=no,scrollbars=yes,scrollable=yes,toolbar=no,resizable=no,location=no");
}

function popPrinter(url) {
	printer=window.open(url,"print","width=565,height=485,menubar=yes,status=no,scrollbars=yes,scrollable=yes,toolbar=yes,resizable=yes,location=no");
}

function popDefinition(url) {
	glossary=window.open(url,"glossary","width=300,height=250,menubar=no,status=no,scrollbars=yes,scrollable=yes,toolbar=no,resizable=no,location=no");
}

/*******************************************************/
// Macromedia functions for on-state
/*******************************************************/

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) { //v3.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); return x;
}

function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}

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];}
}

/*******************************************************/
// end Macromedia functions
/*******************************************************/

function showLayer(id) {
        if (document.layers && document.layers[id])
                document.layers[id].visibility = 'visible';
        else if (document.all) {
                document.all[id].style.visibility = 'visible';
        }
}


function hideLayer(id) {
        if (document.layers && document.layers[id])
                document.layers[id].visibility = 'hidden';
        else if (document.all) {
                document.all[id].style.visibility = 'hidden';
                document.all[id].style.zIndex = 100;
        }
}

function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

// whitespace characters
var whitespace = " \t\n\r"; 
 
var defaultEmptyOK = false;
 
function checkString (theField, emptyOK) {
 // Next line is needed on NN3 to avoid "undefined is not a number" error
    // in equality comparison below.
    if (checkString.arguments.length == 1) emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    if (isWhitespace(theField.value)) {
  return false;
    } else return true;
}
 
// Check whether string s is empty.
function isEmpty(s) {
 return ((s == null) || (s.length == 0))
}
 
// Returns true if string s is empty or
// whitespace characters only.
function isWhitespace (s) {
 var i;
 
    // Is s empty?
    if (isEmpty(s)) return true;
 
    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.
 
    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
 
        if (whitespace.indexOf(c) == -1) return false;
    }
 
    // All characters are whitespace.
    return true;
}
 
// Check Email (TEXTFIELD theField [, BOOLEAN emptyOK==false])
//
// Check that string theField.value is a valid Email.
//
// If emptyOK == true then value cannot be null
function checkEmail (theField, emptyOK) {
    if (checkEmail.arguments.length == 1) {
        emptyOK = defaultEmptyOK;
    }   
    if ((emptyOK == true) && (isEmpty(theField.value))) {
        return true;
    } else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theField.value))) {
        return false;
    } else {
        return true;
    }
}


function openOutsideLink(theURL,winName,features) {
	window.open(theURL,winName,features);
}


function getRadioButtonObjByValue(radioGroup, radioValue) {
	for (var i=0;i<radioGroup.length;i++) {
		if (radioGroup[i].value == radioValue) {
			return radioGroup[i];
		}
	}
	return null;
}

//-->
