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.01
  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 && d.getElementById) x=d.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];}
}
function change(id, newClass) {
identity=document.getElementById(id);
identity.className=newClass;
}

function MM_showHideLayers() { //v6.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 showISI() {
	MM_showHideLayers('divFlash','','show')
 	window.document.aravaScroller_Consumer.Play();
}

function exitSite(destination)
{
	openWin(window.root+'exitsite.aspx?url=' + destination ,'pop_up','width=500,height=320,scrollbars=auto, resizable=1');
}

function interstitial(destination)
{
	openWin(window.root+'interstitial.aspx?url=' + destination ,'pop_up','width=500,height=260,scrollbars=auto');
}

function select_popup(page, title, features)
{
 openWin(window.root+page,title,features);
}

function openWin( windowURL, windowName, windowFeatures) {
     window.open( windowURL, windowName, windowFeatures );
}


function confirmHcp()
{ 
	var bln = confirm('This information is intended for U.S. Healthcare Professionals.\nIf you are a Healthcare Professional, click ok to continue.');
	if (bln)
	{
		window.location.href=window.root+'hcp_default.aspx';
	}
}


function submitSearchFormHome()
{
    if (validateSearchFormHome()) {
          window.location=window.root+'oncology/search_results.aspx?q='+document.getElementById("ctl00_home_featured_content1_SearchText").value;
     }
    return false;
}

function validateSearchFormHome()
{
    var valid = true;
    if (document.getElementById('ctl00_home_featured_content1_SearchText').value == "Enter search term" || 
    document.getElementById('ctl00_home_featured_content1_SearchText').value.length == 0 ) {
 	    window.alert ("Please enter a search text.");
  		valid = false;
 	}
 	else
 	{
 	    var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
 		for (var i = 0; i < document.getElementById('ctl00_home_featured_content1_SearchText').value.length; i++) {
  		    if (iChars.indexOf(document.getElementById('ctl00_home_featured_content1_SearchText').value.charAt(i)) != -1) {
  			    window.alert ("Your search text has special characters. \nThese are not allowed.\nPlease remove them and try again.");
  			    valid = false;
  			    break;
  	        }
        }
     }
     return valid;
}

function submitSearchFormBase()
{
 if (validateSearchFormBase()) {
    window.location=window.root+'search_results.aspx?q='+document.getElementById("ctl00_left_nav1_SearchText").value;
   }
    return false;
}

function submitSearchFormBaseHcp()
{
 if (validateSearchFormBase()) {
    window.location=window.root+'oncology/search_results.aspx?q='+document.getElementById("ctl00_left_nav1_SearchText").value;
   }
    return false;
}

function validateSearchFormBase()
{
    var valid = true;
    if (document.getElementById('ctl00_left_nav1_SearchText').value == "Enter search term" || 
    document.getElementById('ctl00_left_nav1_SearchText').value.length == 0 ) {
 	    window.alert ("Please enter a search text.");
  		valid = false;
 	}
 	else
 	{
 	    var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
 		for (var i = 0; i < document.getElementById('ctl00_left_nav1_SearchText').value.length; i++) {
  		    if (iChars.indexOf(document.getElementById('ctl00_left_nav1_SearchText').value.charAt(i)) != -1) {
  			    window.alert ("Your search text has special characters. \nThese are not allowed.\nPlease remove them and try again.");
  			    valid = false;
  			    break;
  	        }
        }
     }
     return valid;
}

function show_div(objId) {
	var agt=navigator.userAgent.toLowerCase(); 
    // *** BROWSER ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));
    var is_gecko = (agt.indexOf('gecko') != -1);

    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
    
   	// *** PLATFORM ***
	var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
   	// NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
   	//        Win32, so you can't distinguish between Win95 and WinNT.
   	var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

   	// is this a 16 bit compiled version?  
   	var is_win16 = ((agt.indexOf("win16")!=-1) || 
           (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
           (agt.indexOf("windows 16-bit")!=-1) );  

   	var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                (agt.indexOf("windows 16-bit")!=-1));

   	// NOTE: Reliable detection of Win98 may not be possible. It appears that:
   	//       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
   	//       - On Mercury client, the 32-bit version will return "Win98", but
   	//         the 16-bit version running on Win98 will still return "Win95".
   	var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
  	var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
   	var is_win32 = (is_win95 || is_winnt || is_win98 || 
                ((is_major >= 4) && (navigator.platform == "Win32")) ||
                (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

	var is_os2   = ((agt.indexOf("os/2")!=-1) || 
                (navigator.appVersion.indexOf("OS/2")!=-1) ||   
                (agt.indexOf("ibm-webexplorer")!=-1));

	var is_mac    = (agt.indexOf("mac")!=-1);
	var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
                           (agt.indexOf("68000")!=-1)));
	var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
                            (agt.indexOf("powerpc")!=-1)));
		
	if (is_ie)
		document.getElementById(objId).style.display = "inline";
	else
		document.getElementById(objId).style.display = "inherit";
}

function hide_div(objId) {document.getElementById(objId).style.display = "none";}

function doClear(obj){
}

function validateAddress1(source, args) {
    if (document.getElementById('ctl00_ContentMain_UserResponse_R_1_5_1').checked == true) {
        var obj = document.getElementById('ctl00_ContentMain_UserAddress1').value;
        if(obj.length < 1) {
            args.IsValid = false;
            return;
        }
    }
}

function validateCity(source, args) {
    if (document.getElementById('ctl00_ContentMain_UserResponse_R_1_5_1').checked == true) {
        var obj = document.getElementById('ctl00_ContentMain_UserCity').value;
        if(obj.length < 1) {
            args.IsValid = false;
            return;
        }
    }
}

function validateState(source, args) {
    if (document.getElementById('ctl00_ContentMain_UserResponse_R_1_5_1').checked == true) {
        var obj = document.getElementById('ctl00_ContentMain_UserState').selectedIndex;
        if(obj == 0) {
            args.IsValid = false;
            return;
        }
    }
}

function validateZip(source, args) {
    if (document.getElementById('ctl00_ContentMain_UserResponse_R_1_5_1').checked == true) {
        var obj = document.getElementById('ctl00_ContentMain_UserResponse_T_1_1_1').value;
        if(obj.length < 1) {
            args.IsValid = false;
            return;
        }
        else {
            var objRegExp  = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
            args.IsValid = objRegExp.test(obj);
            return;
        }
    }
}

function validateAge(source, args) {
    var yearObj = document.getElementById('ctl00_ContentMain_UserDateOfBirthYear');
    var now = new Date();
    if(yearObj.value == "") {
        args.IsValid = true;
        return;
    }
    try {
        var dif = eval (now.getFullYear() + "-" + yearObj.value);
        args.IsValid = dif > 17;
    } catch(x) {
        args.IsValid = true;        
    }  
}

function goTo()
{
    box = document.forms[0].CancerBox
	destination = box.options[box.selectedIndex].value;
    if(destination == "")
    {
    }else{
	    location.href = destination;
    }
}

function imagePopUp()
{
	openWin(window.root+'bigTree.aspx','pop_up','width=364,height=310,scrollbars=auto');
}

function gotoGlossary(term) 
{
    window.location = window.root+ 'glossary.aspx#'+term;
}

function playVideo()
{
    var speed = calcThroughput();
    
    if(speed == "high"){
        openWin(window.root + 'chemo_infusion_vid.aspx?quality=high','chemo_infusion_low','resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no,width=480, height=360');
    }else{
        openWin(window.root + 'chemo_infusion_vid.aspx?quality=low','chemo_infusion_high','resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no,width=320, height=240');
    }
}   

function showSelect(id)
{
    if(document.getElementById('cover'))
    {
        document.getElementById('cover').style.visibility = "hidden";
    }
}

function hideSelect(id)
{   
    if(id == "menu1")
    {
        
        if(document.getElementById('cover'))
        {
            document.getElementById('cover').style.visibility = "visible";
            //document.getElementById('cover').style.position = "absolute";
            //document.getElementById('cover').style.top = "163px";
            //document.getElementById('cover').style.left = "69px";
        }
    }
}

var timerI;
function divFlipper()
{
    ob = this;
    this.timer = new Timer(this);
    this.flip('ie');
}
divFlipper.prototype.flip = function(value)
{
    switchDiv();
    timerI = this.timer.setTimeout('flip',  6000, 'ie');
}

function initTimer()
{
var asdfasdf = new divFlipper();
}
function switchDiv()
{
 if( document.getElementById("diva").style.display == 'block')
 {
 document.getElementById("diva").style.display = 'none';
 document.getElementById("divb").style.display = 'block';
 }
else
{
 document.getElementById("divb").style.display = 'none';
 document.getElementById("diva").style.display = 'block';
 }
 
  if( document.getElementById("div1").style.display == 'block')
 {
 document.getElementById("div1").style.display = 'none';
 document.getElementById("div2").style.display = 'block';
 }
else
{
 document.getElementById("div2").style.display = 'none';
 document.getElementById("div1").style.display = 'block';
 }
 
}

