//=====================================================================
// copyright Chris Poole
// http://chrispoole.com
// domroll@chrispoole.com
// demo: http://chrispoole.com/scripts/dom_image_rollover/
//=====================================================================

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('domroll')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/domroll (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}
domRollover();

//Tooltip Scripts

/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2003 by Sharon Paine
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// This portion of the code should be placed in the head section of the document.
// Script tags for the external JavaScipt files should be placed just before the end of the document.

// leave in page to avoid errors if onmouseovers/outs before page completely loaded
function doTooltip(e, msg) {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.show(e, msg);
}

function hideTip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.hide();
}

// preload images that will be displayed in tooltip
// put images to preload in this array
var preload_list = new Array("tooltip_print.gif","tooltip_bookmark.gif","tooltip_txt.gif");
var path_to_images = "/remicade/images/global/images/";

if (document.images) {
	var image_list = new Array();
	for (var preload_counter=0; preload_counter<preload_list.length; preload_counter++) {
  	image_list[preload_counter] = new Image();
		image_list[preload_counter].src = path_to_images + preload_list[preload_counter];
  }
}

// variables for tooltip content
// name them whatever you want, add as many as you need
var tip1 = '<img src="/remicade/images/global/images/tooltip_print.gif" alt="Print this page" border="0">';
var tip2 = '<img src="/remicade/images/global/images/tooltip_bookmark.gif" alt="Bookmark this page" border="0">';
var tip3 = '<img src="/remicade/images/global/images/tooltip_txt.gif" alt="Resize Text" border="0">';



// dynamic drive pop-up draggable div

var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
//document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open("","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="30px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}

function checkOrUnCheckNonePS(checkedFlag) {
	
	document.getElementById('none1').checked = checkedFlag;

	clearSelectionsPS();
	
	
	
}


function clearSelectionsPS() {
	//deselect all medication questions	
	var start=4;
	var end=12;
	var divId='';	
	var answerOptionsList;
		
	var displayQuestion = true;
	
	for(var i=start;i<end;i++){
		divId='tableID';
		
		answerOptionsList=document.getElementById(divId).getElementsByTagName('input');
		
		for (var j = 0; j < answerOptionsList.length; j++) {
	if("none1"!=answerOptionsList[j].id){
			answerOptionsList[j].checked = false;
			}
	    }
	}

}


function checkOrUnCheckNoneRA(checkedFlag) {

	
	document.getElementById('none1').checked = checkedFlag;

	clearSelectionsRA();	
	
}

function clearSelectionsRA() {
	//deselect all medication questions
	
	
	var start=10;
	var end=22;
	var divId='';	
	var answerOptionsList;
		
	var displayQuestion = true;
	
	for(var i=start;i<end;i++){
		divId='tableID';
		
		answerOptionsList=document.getElementById(divId).getElementsByTagName('input');
		
		for (var j = 0; j < answerOptionsList.length; j++) {
	if("none1"!=answerOptionsList[j].id){
			answerOptionsList[j].checked = false;
			}
	    }
	}

}

function checkOrUnCheckNonePA(checkedFlag) {

	
	document.getElementById('none1').checked = checkedFlag;

	clearSelectionsPA();	
	
}

function clearSelectionsPA() {
	//deselect all medication questions
	
	
	var start=4;
	var end=12;
	var divId='';	
	var answerOptionsList;
		
	var displayQuestion = true;
	
	for(var i=start;i<end;i++){
		divId='tableID';
		
		answerOptionsList=document.getElementById(divId).getElementsByTagName('input');
			
		for (var j = 0; j < answerOptionsList.length; j++) {
		
	if("none1"!=answerOptionsList[j].id){
	
			answerOptionsList[j].checked = false;
			}
	    }
	}

}


function checkOrUnCheckNoneAS(checkedFlag) {

	
	document.getElementById('none1').checked = checkedFlag;

	clearSelectionsAS();	
	
}

function clearSelectionsAS() {
	//deselect all medication questions
	
	
	var start=4;
	var end=11;
	var divId='';	
	var answerOptionsList;
		
	var displayQuestion = true;
	
	for(var i=start;i<end;i++){
		divId='tableID';
		
		answerOptionsList=document.getElementById(divId).getElementsByTagName('input');
		
		for (var j = 0; j < answerOptionsList.length; j++) {
	if("none1"!=answerOptionsList[j].id){
			answerOptionsList[j].checked = false;
			}
	    }
	}

}

function checkOrUnCheckNoneCD(checkedFlag) {

	
	document.getElementById('none1').checked = checkedFlag;

	clearSelectionsCD();	
	
}

function clearSelectionsCD() {
	//deselect all medication questions
	

	var start=3;
	var end=5;
	var divId='';	
	var answerOptionsList;
		
	var displayQuestion = true;
	
	for(var i=start;i<end;i++){
		divId='tableID';
		answerOptionsList=document.getElementById(divId).getElementsByTagName('input');
		var flag=1;
				for (var j = 0; j < answerOptionsList.length; j++) {
						if("none1"!=answerOptionsList[j].id ){
	
									if(answerOptionsList[j].type=='checkbox'){
										flag=0;
									}
									if(flag==1){
										answerOptionsList[j].checked = false;
									}
	
						}
			
	   			 }
	}

}

function checkBoxSelectionUC(checkedFlag) {

	document.getElementById('noMedication').checked = checkedFlag;

	clearcheckBoxSelectionUC();	
	
}


function clearcheckBoxSelectionUC() {
	//deselect all medication questions

	var start=3;
	var end=6;
	var divId='';	
	var answerOptionsList;
		
	var displayQuestion = true;
	
	for(var i=start;i<end;i++){
	divId='tableID1';
		
		answerOptionsList=document.getElementById(divId).getElementsByTagName('input');
			
		for (var j = 0; j < answerOptionsList.length; j++) {
			if("noMedication"!=answerOptionsList[j].id){
				if(answerOptionsList[j].type=='checkbox'){
					answerOptionsList[j].checked = false;
				}
			}
	   }
	}

}



function checkBoxSelectionUCSurvey() {
	//deselect all medication questions

	var start=10;
	var end=13;
	var divId='';	
	var answerOptionsList;
		
	var displayQuestion = true;
	
	for(var i=start;i<end;i++){
	divId='tableID1';
		
		answerOptionsList=document.getElementById(divId).getElementsByTagName('input');
			
		for (var j = 0; j < answerOptionsList.length; j++) {
			if("noMedication"!=answerOptionsList[j].id){
				if(answerOptionsList[j].type=='checkbox'){
					answerOptionsList[j].checked = false;
				}
			}
	   }
	}

}


function checkBoxSelectionCD(checkedFlag) {

	document.getElementById('noMedication').checked = checkedFlag;

	clearcheckBoxSelectionCD();	
	
}

function clearcheckBoxSelectionCD() {
	//deselect all medication questions

	var start=3;
	var end=7;
	var divId='';	
	var answerOptionsList;
		
	var displayQuestion = true;
	
	for(var i=start;i<end;i++){
	divId='tableID1';
		
		answerOptionsList=document.getElementById(divId).getElementsByTagName('input');
			
		for (var j = 0; j < answerOptionsList.length; j++) {
			if("noMedication"!=answerOptionsList[j].id){
				//if(answerOptionsList[j].type=='checkbox'){
					answerOptionsList[j].checked = false;
				//}
			}
	   }
	}

}

function checkOrUnCheckNoneForCDQuiz() {
	var optionList=document.getElementById('tableID1').getElementsByTagName('input');
	for(var i=0;i<optionList.length;i++){
		if(optionList[i].type=='radio'){
			optionList[i].checked=false;
		}
	}
	document.getElementById('none').checked=true;
}

function clearSelectedHiddenQns() {
	var start=1;
	var end=5;
	var trId;
	var radioAnswerOptionsList;
	
	for(var i=start;i<=end;i++){
		trId="answer"+i;
		radioAnswerOptionsList = document.getElementById(trId).getElementsByTagName('input');
		
		for (var j = 0; j < radioAnswerOptionsList.length; j++) {
			radioAnswerOptionsList[j].checked = false;
	    }
	}
}
