// Form Check
	function checkFields(fname){
		var form_obj = document.getElementById(fname);
		var ar_inp = form_obj.getElementsByTagName('input');
		var ar_text_input = [];
		
		for(var each=0; each<ar_inp.length; ++each){
			if(ar_inp[each].type == "text" && document.getElementById(ar_inp[each].id+'_error').className == "error" ){
				ar_text_input[ar_text_input.length] = ar_inp[each];
			}
		}
		var t=returnAllFields(ar_text_input);
		//alert(ar_text_input.length+"\n"+t)
		if(t!=ar_text_input.length){
			//alert("oh no");
			return false;
		}else{
			//alert("oh yes");
			document.getElementById(fname).submit();
			return true;
		}								
	}

	function returnAllFields(ar_text_input){
	var num = ar_text_input.length;
		for(var each=0; each<ar_text_input.length; ++each){
			if(ar_text_input[each].value=="" && num <= (ar_text_input.length)){
				
				if(document.getElementById(ar_text_input[each].id+"_error").className == "error" ){
					document.getElementById(ar_text_input[each].id+"_error").style.display = "block";
					ar_text_input[each].style.border = "1px solid red";					
					
				}
				num = num-1;
			}else{
				document.getElementById(ar_text_input[each].id+"_error").style.display = "none";
				ar_text_input[each].style.border = "1px solid #999999";
			}
		}
		return num;
	}