/* CLI ENS - © ATELIER 33 - ALL RIGHTS RESERVED - 2010 - http://www.atelier33.com*/
//----------------------
//ACCOUNT
//---------------------
function ACCOUNT_LOGIN(pvType, pvForm, pvPage, pvAct)
{
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); //alert(Dis+" | "+pvPage);
	var pvQs="";
	$("#"+pvForm+"_ALERT").empty();

	//CHECK
	switch(pvType.toUpperCase())
		{
		case "ALL_LOGIN":			
			$("#"+pvForm).find(":input").each(function(){				
				if($(this).attr("type").toLowerCase()!="hidden" && $(this).attr("type").toLowerCase()!="button")
					{
						//msg+="\n"+$(this).attr("title")+" | "+$(this).attr("mask")+" | "+$(this).val()+" | "+$(this).attr("type");
						switch($(this).attr("mask").toLowerCase())
						{
						case "select-one" : if($(this).val()==0){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						case "email" : if(!check_email($(this).val())){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						case "text" : if(!check_empty($(this).val())){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						default: break;
						}
					}
			});	
			pvQs+="&act="+pvAct+"&"+$("#"+pvForm).serialize(); //alert(pvQs);

			break;
			
		case "ALL_LOGIN_SEND":			
			$("#"+pvForm).find(":input").each(function(){				
				if($(this).attr("type").toLowerCase()!="hidden" && $(this).attr("type").toLowerCase()!="button")
					{
						//msg+="\n"+$(this).attr("title")+" | "+$(this).attr("mask")+" | "+$(this).val()+" | "+$(this).attr("type");
						switch($(this).attr("mask").toLowerCase())
						{
						case "select-one" : if($(this).val()==0){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						case "email" : if(!check_email($(this).val())){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						case "text" : if(!check_empty($(this).val())){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						default: break;
						}
					}
			});	
			pvQs+="&act="+pvAct+"&"+$("#"+pvForm).serialize(); //alert(pvQs);
			break;
			
			
		case "CAND_LOGIN":			
			$("#"+pvForm).find(":input").each(function(){				
				if($(this).attr("type").toLowerCase()!="hidden" && $(this).attr("type").toLowerCase()!="button")
					{
						//msg+="\n"+$(this).attr("title")+" | "+$(this).attr("mask")+" | "+$(this).val()+" | "+$(this).attr("type");
						switch($(this).attr("mask").toLowerCase())
						{
						case "email" : if(!check_email($(this).val())){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						case "text" : if(!check_empty($(this).val())){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						default: break;
						}
					}
			});	
			pvQs+="&act="+pvAct+"&"+$("#"+pvForm).serialize(); /*alert(pvQs);*/

			break;			

		case "CAND_LOGIN_SEND":			
			$("#"+pvForm).find(":input").each(function(){				
				if($(this).attr("type").toLowerCase()!="hidden" && $(this).attr("type").toLowerCase()!="button")
					{
						//msg+="\n"+$(this).attr("title")+" | "+$(this).attr("mask")+" | "+$(this).val()+" | "+$(this).attr("type");
						switch($(this).attr("mask").toLowerCase())
						{
						case "email" : if(!check_email($(this).val())){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						case "text" : if(!check_empty($(this).val())){ bFlag=false; msg+=eval("Exp"+$(this).attr("title"))+"<br/>"; } break;
						default: break;
						}
					}
			});	
			pvQs+="&act="+pvAct+"&"+$("#"+pvForm).serialize(); /*alert(pvQs);*/
			break;			
			
		default:
			bFlag=false; msg=ExpFormNoTask1;
			break;
		}

	//SEND	
	if(bFlag){$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess).load(pvPage+pvQs);}
	else {$("#"+pvForm+"_ALERT").empty().append(msg);}

}
//---------------------
function ACCOUNT_PASS_SEND(pvType, pvForm, pvPage)
{
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); //alert(Dis+" | "+pvPage);
	
	//alert($("#"+pvForm+"_PASS1").val());
	//$("#"+pvForm+"_ALERT").empty().append(pvType+" |"+pvForm);
	
	
	//CHECK
	switch(pvType.toUpperCase())
		{
		case "CAND1":
			if(Flag && !check_empty($("#"+pvForm+"_EMAIL1").val())){bFlag=false; msg+=ExpEmail+"<br/>"; $("#"+pvForm+"_PASS1").focus(); }
			break;
			
		default:

			break;
		}
	//SEND
	if(bFlag){Dis.action=pvPage; Dis.method="get"; Dis.target="_self"; Dis.submit();}
	else {$("#"+pvForm+"_ALERT").empty().append(msg);}
}
//---------------------
function ACCOUNT_KILL1(pvType, pvForm, pvPage)
{
/*
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); //alert(Dis+" | "+pvPage);
	
	//CHECK
	if(Dis.ABOTYPE.selectedIndex==0){bFlag=false; msg+=ExpAbotype+"<br/>"; Dis.ABOTYPE.focus(); }
	if(!check_empty(Dis.EMAIL.value)){bFlag=false; msg+=ExpEmail+"<br/>"; Dis.EMAIL.focus(); }

	//SEND
	if(bFlag){Dis.action=pvPage; Dis.method="get"; Dis.target="_self"; Dis.submit();}
	else {$("#"+pvForm+"_ALERT").empty().append(msg);}
*/
}
//---------------------
function ACCOUNT_CAND_CHECK(pvType, pvForm, pvPage)
{
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); //alert(Dis+" | "+pvPage);
	var pvQs="";
	$("#"+pvForm+"_ALERT").empty();

	//CHECK
	switch(pvType.toUpperCase())
		{
		case "CAND2":	
		case "CAND1":			
			$("#"+pvForm).find(":input").each(function(){				
				//if($(this).attr("type").toLowerCase()!="hidden" && $(this).attr("type").toLowerCase()!="button" && $(this).attr("type").toLowerCase()!="checkbox")
				if($(this).attr("mask"))
					{
						//RESET ROW STYPE
						$("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("rowalert").addClass("row");								
						
						//TRACE
						//msg+="\nTITLE="+$(this).attr("title")+" | MASK="+$(this).attr("mask")+" | VAL="+$(this).val()+" | TYPE="+$(this).attr("type")+" | ";
						
						//CHECK
						switch($(this).attr("mask").toLowerCase())
						{
						case "select-one" : 
							if($(this).val()==0){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
						
						case "email" : 
							if(!check_email($(this).val())){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
						
						case "text" : 
							if(!check_empty($(this).val())){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");								
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
							
						case "textlm" : 
							if(!check_emptylm2($(this).attr("name"), $.trim($(this).val()), true)){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;
								
						case "intposzero" : 
							if(!check_int2($(this).val(), true, true)){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;								
								
						case "check-one" :
						case 'radio-one': 
							if(!$(this).is(':checked')){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;
								
						default: 
							break;
						}
						
					}
			});	
			pvQs=$("#"+pvForm).serialize(); //alert(pvQs);

			break;
			
					
			
		default:
			bFlag=false; msg=ExpFormNoTask1;
			break;
		}
		//alert(msg);

	//SEND
	/*bFlag=true;*/ /*alert(pvPage+pvQs);*/
	if(bFlag)
		{
			//$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess).load(pvPage+pvQs);
			$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess);
			
			var options = {
				target: "#"+pvForm+"_ALERT", // target element(s) to be updated with server response
				url: pvPage, // override for form's 'action' attribute
				type: "post" // 'get' or 'post'
				};

			$("#"+pvForm).ajaxSubmit(options);
			//return false;// always return false to prevent standard browser submit and page navigation
			
		}
		
	else {alert(ExpFormError1+"\n"+msg);}
}
//---------------------
function ACCOUNT_CAND_SEND(pvForm, pvPage)
{
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); /*alert(Dis+" | "+pvPage);*/	
	$("#"+pvForm+"_ALERT").empty();

	//SEND
	if(bFlag)
		{
			$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess);			
			Dis.target="_self"; Dis.action=pvPage; Dis.method="post"; Dis.submit();
		}
}
//---------------------
function ACCOUNT_ENS_CHECK(pvType, pvForm, pvPage)
{
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); //alert(Dis+" | "+pvPage);
	var pvQs="";
	$("#"+pvForm+"_ALERT").empty();

	//CHECK
	switch(pvType.toUpperCase())
		{
		case "ENS2":		
			$("#"+pvForm).find(":input").each(function(){				
				//if($(this).attr("type").toLowerCase()!="hidden" && $(this).attr("type").toLowerCase()!="button" && $(this).attr("type").toLowerCase()!="checkbox")
				if($(this).attr("mask"))
					{
						//RESET ROW STYPE
						$("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("rowalert").addClass("row");								
						
						//TRACE
						//msg+="\nTITLE="+$(this).attr("title")+" | MASK="+$(this).attr("mask")+" | VAL="+$(this).val()+" | TYPE="+$(this).attr("type")+" | ";
						
						//CHECK
						switch($(this).attr("mask").toLowerCase())
						{
						case "select-one" : 
							if($(this).val()==0){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
						
						case "email" : 
							if(!check_email($(this).val())){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
						
						case "text" : 
							if(!check_empty($(this).val())){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");								
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
							
						case "textlm" : 
							if(!check_emptylm2($(this).attr("name"), $.trim($(this).val()), true)){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;
								
						case "intposzero" : 
							if(!check_int2($(this).val(), true, true)){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;								
								
						case "check-one" :
						case 'radio-one': 
							if(!$(this).is(':checked')){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;
								
						default: 
							break;
						}
						
					}
			});	
			pvQs=$("#"+pvForm).serialize(); //alert(pvQs);

			break;
			
					
			
		default:
			bFlag=false; msg=ExpFormNoTask1;
			break;
		}
		//alert(msg);

	//SEND
	/*bFlag=true;*/ /*alert(pvPage+pvQs);*/
	if(bFlag)
		{
			//$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess).load(pvPage+pvQs);
			$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess);
			
			var options = {
				target: "#"+pvForm+"_ALERT", // target element(s) to be updated with server response
				url: pvPage, // override for form's 'action' attribute
				type: "post" // 'get' or 'post'
				};

			$("#"+pvForm).ajaxSubmit(options);
			//return false;// always return false to prevent standard browser submit and page navigation
			
		}
		
	else {alert(ExpFormError1+"\n"+msg);}
}
//---------------------
function ACCOUNT_ENS_SEND(pvForm, pvPage)
{
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); /*alert(Dis+" | "+pvPage);*/	
	$("#"+pvForm+"_ALERT").empty();

	//SEND
	if(bFlag)
		{
			$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess);			
			Dis.target="_self"; Dis.action=pvPage; Dis.method="post"; Dis.submit();
		}
}
//---------------------
function ACCOUNT_PRE_CHECK(pvType, pvForm, pvPage)
{
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); //alert(Dis+" | "+pvPage);
	var pvQs="";
	$("#"+pvForm+"_ALERT").empty();

	//CHECK
	switch(pvType.toUpperCase())
		{
		case "PRE2":		
			$("#"+pvForm).find(":input").each(function(){				
				//if($(this).attr("type").toLowerCase()!="hidden" && $(this).attr("type").toLowerCase()!="button" && $(this).attr("type").toLowerCase()!="checkbox")
				if($(this).attr("mask"))
					{
						//RESET ROW STYPE
						$("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("rowalert").addClass("row");								
						
						//TRACE
						//msg+="\nTITLE="+$(this).attr("title")+" | MASK="+$(this).attr("mask")+" | VAL="+$(this).val()+" | TYPE="+$(this).attr("type")+" | ";
						
						//CHECK
						switch($(this).attr("mask").toLowerCase())
						{
						case "select-one" : 
							if($(this).val()==0){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
						
						case "email" : 
							if(!check_email($(this).val())){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
						
						case "text" : 
							if(!check_empty($(this).val())){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");								
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								} 
							break;
							
						case "textlm" : 
							if(!check_emptylm2($(this).attr("name"), $.trim($(this).val()), true)){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;
								
						case "intposzero" : 
							if(!check_int2($(this).val(), true, true)){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;								
								
						case "check-one" :
						case 'radio-one': 
							if(!$(this).is(':checked')){ 
								bFlag=false; $("#"+pvForm+" > #"+$(this).attr("title").toUpperCase()+"_ROW").removeClass("row").addClass("rowalert");	
								msg+="\n - "+eval("Exp"+$(this).attr("title"));
								}
								break;
								
						default: 
							break;
						}
						
					}
			});	
			pvQs=$("#"+pvForm).serialize(); //alert(pvQs);

			break;
			
					
			
		default:
			bFlag=false; msg=ExpFormNoTask1;
			break;
		}
		//alert(msg);

	//SEND
	/*bFlag=true*/ /*alert(pvPage+pvQs);*/
	if(bFlag)
		{
			//$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess).load(pvPage+pvQs);
			$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess);
			
			var options = {
				target: "#"+pvForm+"_ALERT", // target element(s) to be updated with server response
				url: pvPage, // override for form's 'action' attribute
				type: "post" // 'get' or 'post'
				};
			$("#"+pvForm).ajaxSubmit(options);
			//return false;// always return false to prevent standard browser submit and page navigation
			
		}		
	else {alert(ExpFormError1+"\n"+msg);}
}
//---------------------
function ACCOUNT_PRE_SEND(pvForm, pvPage)
{
	//SET
	var bFlag=true; var msg=""; var Dis=eval("document."+pvForm); /*alert(Dis+" | "+pvPage);*/	
	$("#"+pvForm+"_ALERT").empty();

	//SEND
	if(bFlag)
		{
			$("#"+pvForm+"_ALERT").empty().append(ExpFormProcess);			
			Dis.target="_self"; Dis.action=pvPage; Dis.method="post"; Dis.submit();
		}
}
//---------------------


