	var lang = "en";
	
	function setLanguage (language)
	{
		lang = language;
		window.location.reload (false);
	}


	function pageLoad ()
	{
//		document.write("<table><tr><td>HTML</td></tr></table>");
	}
	
	function amChartInited(chart_id) {
	
		//document.getElementById('amline').setSettings('<settings><graphs><graph gid="0"><hidden>1</hidden></graph></graphs></settings>');
		//document.getElementById('amline').setSettings('<settings><graphs><graph gid="1"><hidden>1</hidden></graph></graphs></settings>');
		//document.getElementById('amline').setSettings('<settings><graphs><graph gid="2"><hidden>1</hidden></graph></graphs></settings>');
		//document.getElementById('amline').setSettings('<settings><graphs><graph gid="3"><hidden>1</hidden></graph></graphs></settings>');
		
		  // ... read cookie --- inital cookie made by php?
		  // ... send settings


		
		//el = document.getElementById('amline');
		//el.setSettings('<settings><graphs><graph gid="0"><hidden>0</hidden></graph></graphs></settings>', false);
		//el.setSettings('<settings><graphs><graph gid="1"><hidden>0</hidden></graph></graphs></settings>', false);
		//el.setSettings('<settings><graphs><graph gid="2"><hidden>0</hidden></graph></graphs></settings>', false);
		//el.setSettings('<settings><graphs><graph gid="3"><hidden>0</hidden></graph></graphs></settings>', false);
		//el.rebuild();
	}

	// FIND OUT WHICH GRAPH WAS HIDDEN ///////////////////////////////////////////////////////
	// amGraphHide(chart_id, index, title)
	// This function is called when the viewer hides the graph by clicking on the checkbox in
	// the legend. Index is the sequential number of a graph in your settings, counting from 0
	function amGraphHide(chart_id, index, title){
	  // ... read cookie
	  // ... set array[] = 0
	  // ... write cookie
	}

	// FIND OUT WHICH GRAPH WAS SHOWN ///////////////////////////////////////////////////////
	// amGraphShow(chart_id, index, title)
	// This function is called when the viewer shows the graph by clicking on the checkbox in
	// the legend. Index is the sequential number of a graph in your settings, counting from 0
	function amGraphShow(chart_id, index, title){
	  // ...
	  // ... read cookie
	  // ... set array[] = 1
	  // ... write cookie


	}


	function disableEnterKey(e)
	{
	     /* --- Avoid executing submit button on enter */
	
	     var key;
	
	     if(window.event)
	          key = window.event.keyCode;     //IE
	     else
	          key = e.which;     //firefox
	
	     if(key == 13)
	          return false;
	     else
	          return true;
	}

function tvg ()
{
	if (document.fParticipants.tvg.checked != 1) {
		document.getElementById("part").selectedIndex = -1;
	}
}


	var participant=-1;
	var lastRow;

	function tblRowChangeColor (tableRow, highLight)
	{
	    if (highLight) {
      		if (tableRow.style.backgroundColor != '#3399ff')
      		    tableRow.style.backgroundColor = '#333333';
       	    }
	    else {
		if (participant != tableRow.rowIndex)
	            tableRow.style.backgroundColor = '';
	    }
	}

	function tblRowSelectParticipant (tableRow, id)
	{
	    if (lastRow)
		lastRow.style.backgroundColor = '';
            tableRow.style.backgroundColor = '#3399ff';
	    participant = tableRow.rowIndex;
	    lastRow = tableRow
	    
	    // submit form fParticipant
	    // IE ok document.fParticipant.lastSelRowIx.value = lastSelRowIx; 
	    // IE ok document.getElementById('fParticipant').submit();
	    document.fParticipant["participant"].value = id; 
	    document.forms["fParticipant"].submit();

	}


	function setItems ()
	{
	    if (document.fCriteriaDetails.criteriaDetails.checked)
	      document.getElementById("tblCriteriaDetails").style.display = "block";
	    else
	      document.getElementById("tblCriteriaDetails").style.display = "none";

	    if (document.fGraphSettings.graphSettings.checked)
	      document.getElementById("tblGraphSettings").style.display = "block";
	    else
	      document.getElementById("tblGraphSettings").style.display = "none";

	    if (document.fCriteriaDetails.criteriaDetails.checked || document.fGraphSettings.graphSettings.checked)
	      document.getElementById("tblShow").style.display = "block";
	    else
	      document.getElementById("tblShow").style.display = "none";
	}


	
	function initCheckBoxes ()
	{
		setMusProAsh ();
		setMusProBab ();
		setGlaucoma ();
		setMRI ();
	}


	function setMusProAsh ()
	{
		if (document.tracking.musProAsh.checked == 1) {
			document.getElementById('tblMusProAsh').style.display = '';
		}
		else {
			document.getElementById('tblMusProAsh').style.display = 'none';
		}
	}
	function setMusProBab ()
	{
		if (document.tracking.musProBab.checked) {
			document.getElementById('tblMusProBab').style.display = '';
		}
		else {
			document.getElementById('tblMusProBab').style.display = 'none';
		}
	}
	function setGlaucoma ()
	{
		if (document.tracking.visPro.checked) {
			document.getElementById('tblGlaucoma').style.display = '';
		}
		else {
			document.getElementById('tblGlaucoma').style.display = 'none';
		}
	}
	function setMRI ()
	{
		if (document.tracking.mriPro.checked) {
			document.getElementById('tblMRI').style.display = '';
		}
		else {
			document.getElementById('tblMRI').style.display = 'none';
		}
	}

//	function setFilterItems ()
//	{
//		if (document.fPredefined.filterItems.checked) {
//			document.getElementById('tblFilterItems').style.display = '';
//		}
//		else {
//			document.getElementById('tblFilterItems').style.display = 'none';
//		}
//	}
	
	function clearCCSVINewTreatSite ()
	{

		var ix = document.CCSVI.ccsviTreatSite.selectedIndex;
		
		if (document.CCSVI.ccsviTreatSite.options[ix].value != -1) {
			document.CCSVI.ccsviNewTreatSite.value = "";
		}


/*		if (document.CCSVI.ccsviTreatSite.options[ix].value == -1) {
			document.CCSVI.ccsviNewTreatSite.disabled = false;
		} else {
			document.CCSVI.ccsviNewTreatSite.value = "";
			document.CCSVI.ccsviNewTreatSite.disabled = true;
		}
*/
	}


/* amGraphHide(chart_id, index, title)
 This function is called when the viewer hides the graph by clicking on the checkbox in
 the legend. Index is the sequential number of a graph in your settings, counting from 0
 */
function amGraphHide(chart_id, index, title){
  /* ... */
}


/* amGraphShow(chart_id, index, title)
 This function is called when the viewer shows the graph by clicking on the checkbox in
 the legend. Index is the sequential number of a graph in your settings, counting from 0
*/
function amGraphShow(chart_id, index, title){
  /* ...*/
}

/* FIND WHICH SERIES WAS CLICKED
 amClickedOnSeries(chart_id, series)
 This function is called when the viewer clicks somewhere on the plot area. It returns 
 the value of the series over which the mouse hovered when it was clicked.*/
function amClickedOnSeries(chart_id, series){
  /*...*/
}


/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only things you may need to change in this file are the following
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)

The numbers you set for checkboxHeight and radioHeight should be one quarter
of the total height of the image want to use for checkboxes and radio
buttons. Both images should contain the four stages of both inputs stacked
on top of each other in this order: unchecked, unchecked-clicked, checked,
checked-clicked.

You may need to adjust your images a bit if there is a slight vertical
movement during the different stages of the button activation.

The value of selectWidth should be the width of your select list image.

Visit http://ryanfait.com/ for more information.

*/

var checkboxHeight = "25";
var radioHeight = "25";
var selectWidth = "190";


/* No need to change anything after this */


document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				if(!inputs[a].getAttribute("disabled")) {
					span[a].onmousedown = Custom.pushed;
					span[a].onmouseup = Custom.check;
				} else {
					span[a].className = span[a].className += " disabled";
				}
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				if(!inputs[a].getAttribute("disabled")) {
					inputs[a].onchange = Custom.choose;
				} else {
					inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
				}
			}
		}
		document.onmouseup = Custom.clear;
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;










function popup (url)
{
 var width  = 1000;
 var height = 800;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=yes';
 params += ', menubar=yes';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=no';
 params += ', toolbar=no';
 newwin=window.open(url,'windowname5', params);
 if (window.focus) {newwin.focus()}
 return false;
}


var tooltip=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 500;
	var speed = 10;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();


