function checkUploadForm(form){
	uncheckspan();
	if(isEmpty(form.upload.value)){
		checkspan("localhead");
		return false;
	}
	var filetype=form.upload.value.toLowerCase();
	if(!(filetype.lastIndexOf(".jpg")!=-1||filetype.lastIndexOf(".gif")!=-1||filetype.lastIndexOf(".bmp")!=-1||filetype.lastIndexOf(".png")!=-1)){
		checkspan1("filetypetip");
		return false;
	}
	return true;
}

function checkspan(spanName){
	var e;
 	for(var i=0;i<document.getElementsByTagName("span").length;i++) {   
     	e= document.getElementsByTagName("span")[i];  
     	if(e.id.indexOf(spanName)!=-1){    
 			e.style.display="inline";     
   		}   
   }
}

function checkForm(form){
	uncheckspan();
	if(isEmpty(form.loginName.value)){
		checkspan("rfvuserName");
		return false;
	}
	if(isEmpty(form.password.value)){
		checkspan("rfvpswd");
		return false;
	}
	if(isEmpty(form.confirPswd.value)){
		checkspan("rfvconfirPswd");
		return false;
	}
	if(form.password.value!=form.confirPswd.value){
		checkspan("revconfirPswd");
		return false;
	}
	if(isEmpty(form.email.value)){
		checkspan("rfvemail");
		return false;
	}

	if(form.password.value.length<5||form.password.value.length>16){
		checkspan("revpswd");
		return false;
	}
	
	if(!isEmail(form.email.value)){
  		checkspan("revemail"); 
		return false;
	}
	return true;
}

function isEmpty(str){
	if(str===null||str.length===0){
		return true;
	}else{
		return false;
	}
}


function uncheckspan(){
 	for(var i=0;i<document.getElementsByTagName("span").length;i++) {   
     	e= document.getElementsByTagName("span")[i];     
 		e.style.display="none";
   }
}

function isEmail(strEmail) {
	if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
		return true;
	}else{
		return false;
	}
}