function setClass(){
	this.className='current';
}

function removeClass(){
	this.className='';
}

//function to expand/collapse div
function switchMenu(obj) {
	var el = document.getElementById(obj);
	if(el.style.display != 'none'){
		el.style.display = 'none';
	}else{
		el.style.display = '';
	}
}

function submitForm(frm){	
	frm.submit();
}

function showField(obj,val){
	if(obj.value==''){
		obj.value=val;
	}
}

function hideField(obj,val){
	if(obj.value==val){
		obj.value='';
	}
}

function showPassword(obj,id){
	if(obj.value==''){
		document.getElementById(id).className='hideBlock';
		document.getElementById(id+'Hide').className='showBlock';
	}
}

function show_div(val){

		if(val=="paypal"){

		document.getElementById('preview').style.display='none';}		
		if(val=="creditcard"){

		document.getElementById('preview').style.display='block';}

		if(val=="applyViaEmail"){

		document.getElementById('applyViaEmail1').style.display='block';
		//document.getElementById('applyViaWeb1').style.display='none';
		//document.getElementById('OtherWayToReply1').style.display='none';
		//document.getElementById('submissionDetails1').style.display='none';
			}
		if(val=="applyViaWeb"){

		//document.getElementById('applyViaEmail1').style.display='none';
		document.getElementById('applyViaWeb1').style.display='block';
		//document.getElementById('OtherWayToReply1').style.display='none';
		//document.getElementById('submissionDetails1').style.display='none';
			}

		if(val=="OtherWayToReply"){

		//document.getElementById('applyViaEmail1').style.display='none';
		//document.getElementById('applyViaWeb1').style.display='none';
		document.getElementById('OtherWayToReply1').style.display='block';
		//document.getElementById('submissionDetails1').style.display='none';
			}

		if(val=="submissionDetails"){

		//document.getElementById('applyViaEmail1').style.display='none';
		//document.getElementById('applyViaWeb1').style.display='none';
		//document.getElementById('OtherWayToReply1').style.display='none';
		document.getElementById('submissionDetails1').style.display='block';
			}
			
}
function showlevel() {
if(document.getElementById('UserUserAccessLevel').value==1) {
	document.getElementById('level').style.display='';
	if(UserLevel.value=='') {
        errorString = errorString + "<li>User Access Level is mandatory. </li>";
  }
}
else {
	document.getElementById('level').style.display='none';
}
}

function hidePassword(obj,id){
	if(obj.value=='******'){
		document.getElementById(id+'Hide').className='hideBlock';
		document.getElementById(id).className='showBlock';
		document.getElementById(id).value='';
		document.getElementById(id).focus();
	}
}

function addLoadEvent(func) {

	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
		window.onload = func;
	  } else {
		window.onload = function() {
		  oldonload();
		  func();
		}
	  }
	}
	
function prepareInputsForHints() {

	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++){
		// test to see if the hint span exists first
		
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
			// the span exists!  on focus, show the hint
			
			inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			// when the cursor moves away from the field, hide the hint
			inputs[i].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
	// repeat the same tests as above for selects
	var selects = document.getElementsByTagName("select");
	for (var k=0; k<selects.length; k++){
		if (selects[k].parentNode.getElementsByTagName("span")[0]) {
			selects[k].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			selects[k].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
	
	
	var textareas = document.getElementsByTagName("textarea");
	for (var k=0; k<textareas.length; k++){
		if (textareas[k].parentNode.getElementsByTagName("span")[0]) {
			textareas[k].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			textareas[k].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
}
