// JavaScript Document
		var CurrField;
			
		function autojump(FieldName, FieldNameNext, FieldMaxLength)
		{
			//alert("In auto jump");
			var myForm=document.forms[document.forms.length - 1];
			var myField=myForm.elements[FieldName];
			myField.nextField=myForm.elements[FieldNameNext];
			if (myField.maxLength == null)
			{
			 myField.maxLength=FieldMaxLength;
			}
			myField.onkeydown=autojump_keyDown;
			myField.onkeyup=autojump_keyUp;
		}
		
		function autojump_keyDown()
		{
			//alert("In key down");
			this.beforeLength=this.value.length;
			CurrField=this;
		}
		
		function autojump_keyUp()
		{
			//alert("In key up");
			if(( this == CurrField ) && ( this.value.length > this.beforeLength	) && ( this.value.length >= this.maxLength ))
			{
			 this.nextField.focus();
			}
			CurrField=null;
		}

    function othershow() {
	//var sel = document.myform.mycompanyrole;
if(document.getElementById('mycorole2').value == "Other") {
document.getElementById('reporting_other').style.visibility = 'visible';
document.getElementById('specify').style.visibility = 'visible';
}
//document.form.selection.value = sel.options[sel.selectedIndex].text;
//document.form.submit();

		//document.form.reporting_other.style.visibility = 'visible';
	
	}
	
	function CheckError(){

		var error_msg = "";
		
		if(document.getElementById('vdate').value.length != 4){
			error_msg += "Please enter the code at the bottom of the page.<br>";
			document.getElementById('vdate').style.backgroundColor = "#DD0000";	
		}else{
			document.getElementById('vdate').style.backgroundColor = "#FFFFFF";
		}

		if(document.getElementById('vdate').value != ImgName.substring(8,12)){
			error_msg += "Please enter the correct vaidation code at the bottom of the page.<br>";
			document.getElementById('vdate').style.backgroundColor = "#DD0000";	
		}else{
			document.getElementById('vdate').style.backgroundColor = "#FFFFFF";
		}

		//Display Error messages if there are any or submit form
		if(error_msg.length > 0){
			document.getElementById('errormsg').innerHTML = "<a name='error'><font color=red><b>Errors on form:</b><br><br>" + error_msg + "</font></a><br>";
			document.getElementById('content').style.height = '2260px';
			document.getElementById('content').style.minHeight = '2200px';
			window.location.href = "#error";
		}else{
			document.myform.submit();
		}
		
	}
	
	function AddFileField(){
		
		var HTMLString = document.getElementById('fileupload');
		var all_inputs = HTMLString.getElementsByTagName("input");
 		var last_item = all_inputs.length - 1;
		var last = all_inputs[last_item].id;
 		var count = Number(last.charAt(last.length-1)) + 1;
		field = "attachment";
		
		var newSpace = document.createElement("br");
		
		var newElement = document.createElement("input");
		newElement.setAttribute("id", field+count);
		newElement.setAttribute("type", "file");
		newElement.setAttribute("name", field+count);
		newElement.setAttribute("size", '60');

		
		HTMLString.appendChild(newSpace);
		HTMLString.appendChild(newElement);
			
	}
	
	function ViewDuration(Answer){
	
		if(Answer=='No'){
			document.getElementById('duration-label').innerHTML='<label>Duration</label>';
			document.getElementById('duration').innerHTML='<label><input type="text" name="durname" width="5"></label>&nbsp;<select name="durtime"><option var="days">days</option><option var="weeks">weeks</option><option var="months">months</option><option var="years">years</option></select>';
		}else{
			document.getElementById('duration-label').innerHTML='';
			document.getElementById('duration').innerHTML='';
		}
	}