<!-- 

function S_ExamsAnsValidate(){		
		//var fname=document.forms[0].name;
	//alert (fname);
		var retValue = true;
		for (var i=0;i<document.Exam.elements.length;i++){			
        	if(document.Exam.elements[i].type=="radio"){
				elname=document.Exam.elements[i].name.toString();				
					var ckradio=false
					for(var j = 0; j < document.Exam[elname].length; j++){
						if (document.Exam[elname][j].checked==true){
							ckradio=true
							break;
						}
					}				
				if (ckradio==false){					
					var qid = elname.split("_");					
					var imgName = "img_"+qid[1];
					var hidName = "#hid_"+qid[1];					
					if (retValue==true){
						alert("please answer all questions!");
						window.location = hidName;
					}				
					retValue=false;					
					document.Exam[imgName].src = "/images/general/flash_arrow.gif";										 					
					//break;
				}
			}
			else if (document.Exam.elements[i].type=="text"){				
				elname=document.Exam.elements[i].name.toString();				
				
				if (document.Exam[elname].value==""){					
					var qid = elname.split("_");					
					var imgName = "img_"+qid[1];
					var hidName = "#hid_"+qid[1];					
					if (retValue==true){
						alert("please answer all questions!");
						window.location = hidName;
					}				
					retValue=false;						
					document.Exam[imgName].src = "/images/general/flash_arrow.gif";
				}	
			}
       	if(document.Exam.elements[i].type=="checkbox"){
					elname=document.Exam.elements[i].name.toString();				
					var ckchkbox=false
					for(var j = 0; j < document.Exam[elname].length; j++){
						if (document.Exam[elname][j].checked==true){
							ckchkbox=true
							break;
						}
					}				
				if (ckchkbox==false){					
					var qid = elname.split("_");					
					var imgName = "img_"+qid[1];
					var hidName = "#hid_"+qid[1];					
					if (retValue==true){
						alert("please answer all questions!");
						window.location = hidName;
					}				
					retValue=false;					
					document.Exam[imgName].src = "/images/general/flash_arrow.gif";										 					
					//break;
				}
			}
		}
		
		return retValue;		
	}
	
function S_ResetArrow(Qid) {
		var imgName = "img_"+Qid;
		document.Exam[imgName].src = "/images/spacer.gif";
		//alert(Qid);
		
	}

function Frm_Post_Val() { 
	if (document.getElementById("Frm_Body").value=="") { 
		alert ("Please enter a comment")
		document.getElementById("Frm_Body").focus();
		return false; 
	}
	return true;
}

function upl_validate(formName,Mat_ID,RemoteUplID){	
	if (document.getElementById("Mat_Name").value=="" ) { 
		alert ("Please enter a material name");
		document.getElementById("Mat_Name").focus();
		return false;		
	}
	if (document.getElementById("Mat_Price").value=="" ) { 
		alert ("Please enter price for the material. If you want the meaterial to be free please enter 0");
		document.getElementById("Mat_Name").focus();
		return false;		
	}
	
	protSel = false;	
	for (i=formName.Mat_Protection.length-1; i > -1; i--) {
		if (formName.Mat_Protection[i].checked) {
			protSel = true;
		}
	}
	if (!protSel) {
		alert ("Please select if you want protection for this document")
		return false;
	}
	visSel = false;
	for (i=formName.Mat_Public.length-1; i > -1; i--) {
		if (formName.Mat_Public[i].checked) {
			visSel = true;
		}
	}
	if (!visSel) {
		alert ("Please select if you want this document public or not")
		return false;
	}
	
	if (document.getElementById("Upl_File").value=="" && Mat_ID==0 ) {
		alert("Please select a file to upload")
		return false;
	}
	var fileName = document.getElementById("Upl_File").value;
	var fileNameArr = fileName.split(".");
	var n = fileNameArr.length;
	var fileExt = fileNameArr[n-1];
	var fileExtLow = fileExt.toLowerCase(); 
	for (i=formName.Mat_Type.length-1; i > -1; i--) {
		if (formName.Mat_Type[i].checked) {
			var MatType = formName.Mat_Type[i].value
		}
	}
	if (MatType.indexOf(fileExtLow)<0) {
		alert ("File type not match with  the selected file. Please select the correct file type.")
		return false;
	}
	if (Mat_ID==0) {
		if (document.getElementById("acceptTerms").checked==false ){
			alert ("You must read and accept StudyNet terms and continions for uploading material to continue ")
			return false;
		}
	}
	var MediaTypes = ".mp3, .mpa, .wma, .ram, .wav, .aif,.avi, .mov, .mp4, .wmv, .mpg , .swf"
	//if (MediaTypes.indexOf(fileExtLow)>0) {
		// document.stUplForm.action = "http://upload.client.uvault.com/studynet/pureasp/upload.asp?UploadID="+RemoteUplID;		
		 //var ProgressURL
		 //ProgressURL = 'http://upload.client.uvault.com/studynet/pureasp/progress.asp?UploadID='+RemoteUplID;

  //var v = window.open(ProgressURL,'_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=350,height=200')
		 
	//}
	//else {
		document.stUplForm.action = "";
		if (document.getElementById("Upl_File").value != "") {
			return ProgressBar(formName);
		}
		else{
			return true;
		}
	//}
	
	//return true;

}

function loginCheck() {	
  if (document.Login.ulogin.value == ''  ){
  		alert('You did not enter an email.');				
		document.Login.ulogin.focus();				
		return false;
	}
  if (document.Login.upassword.value == '' ){
  	alert('You did not enter a password.')
	document.Login.upassword.focus();			
	return false;
	}
	return true;
}


function uplStore_validate(formName,Mat_ID,Mat_Type){	
	if (document.getElementById("Mat_Name").value=="" ) { 
		alert ("Please enter a material name");
		document.getElementById("Mat_Name").focus();
		return false;		
	}
	if (Mat_Type == "mult"){
		if (document.getElementById("fileName").value=="" && Mat_ID==0 ) {
			alert("Please select a file to upload")
			return false;
		}
	}
	else {
		if (document.getElementById("Upl_File").value=="" && Mat_ID==0 ) {
			alert("Please select a file to upload")
			return false;
		}
	}
	
	if (Mat_ID==0) {
		if (document.getElementById("acceptTerms").checked==false ){
			alert (" Please read and accept Study.Net’s terms of service to continue ")
			return false;
		}
	}
	if (Mat_Type == "mult"){
		document.stUplForm.action = "/student/upload_multim_mat_store.asp?Mat_ID="+Mat_ID;
		document.stUplForm.submit();
	}
	else {
		document.stUplForm.action = "";
		if (document.getElementById("Upl_File").value != "") {
			return ProgressBar(formName);
		}
		else{
			return true;
		}
	}


}

function uplStore_validateV2(formName,Mat_ID,Mat_Type,upID){	
	if (document.getElementById("Mat_Name").value=="" ) { 
		alert ("Please enter a material name");
		document.getElementById("Mat_Name").focus();
		return false;		
	}
	
	if (Mat_Type == "mult"){
		if (document.getElementById("fileName").value=="" && Mat_ID==0 ) {
			alert("Please select a file to upload")
			return false;
		}
	}
	else {
		
		if (document.getElementById("Upl_File").value=="" && Mat_ID==0 ) {
			alert("Please select a file to upload")
			return false;
		}
		var MediaTypes = ".mp3, .mpa, .wma, .ram, .wav, .aif,.avi, .mov, .mp4, .wmv, .mpg , .swf, .m4v, .m4r, .bat, .msi, .com, .msp";
		var AllowedFileTypes = ".doc, .docx, .txt, .rtf, .xls, .xlsx, .ppt, .pptx, .pdf,.pps";
		var fileName = document.getElementById("Upl_File").value;
		var fileNameArr = fileName.split(".");
		var n = fileNameArr.length;
		var fileExt = fileNameArr[n-1];
		var fileExtLow = fileExt.toLowerCase(); 
		
		if (MediaTypes.indexOf(fileExtLow)>0) {
			alert ("Wrong file type. Please select a document type file (doc,docx,pdf,pps etc)")
			return false;
		}
		
		if (AllowedFileTypes.indexOf(fileExtLow)>0){
	
		}
		else {
			if (fileExtLow != "") {
				alert ("."+fileExtLow+ " file types are not allowed. Please select a different file.");
				return false;
			}
		}
	}
	
	
	
	if (Mat_ID==0) {
		if (document.getElementById("acceptTerms").checked==false ){
			alert (" Please read and accept Study.Net’s terms of service to continue ")
			return false;
		}
	}
	if (Mat_Type == "mult"){
		
		document.stUplForm.action = "/student/upload_multim_mat_store.asp?Mat_ID="+Mat_ID;
		document.stUplForm.submit();
	}
	else {
		//document.stUplForm.action = "";
		if (document.getElementById("Upl_File").value != "") {
			//return ProgressBar(formName);
			ShowProgress(upID)
		}
		else{
			return true;
		}
	}


}

	
//-->
