function validate_form(frm)
{
    var valid=true;
    for (var v=0;v<frm.imgValidate.length;v++){
        if (frm.imgValidate[v].alt == 0){
            valid=false;
        }
            
    }
    return valid;
}
function check_requiered (value,img)
{
    value=trim(value);
    if (value==""){
        img.src="images/validator_red.jpg";
        img.alt=0;
    } else {
        img.src="images/validator_green.jpg";
        img.alt=1;
    }
}
function check_length (value,minlen,maxlen, img)
{
    value=trim(value);
    if (value.length<minlen || value.length>maxlen){
        img.src="images/validator_red.jpg";
        img.alt=0;
    } else {
        img.src="images/validator_green.jpg";
        img.alt=1;
    }
}
function check_equals (value1,value2, img,cs)
{
		value1=trim(value1);
		value2=trim(value2);
   
    if (value1!=value2){
        img.src="images/validator_red.jpg";
        img.alt=0;
    } else {
        img.src="images/validator_green.jpg";
        img.alt=1;
    }
}
function check_email (value,img){
    value=trim(value);
    if (/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value)){
        img.src="images/validator_green.jpg";
        img.alt=1;
    } else {
        img.src="images/validator_red.jpg";
        img.alt=0;
    }
}
function check_checked (button, img)
{
    if (button.checked!=true){
        img.src="images/validator_red.jpg";
        img.alt=0;
    } else {
        img.src="images/validator_green.jpg";
        img.alt=1;
    }
}
function check_length_or_blank (value,minlen,maxlen, img)
{
    if ((value.length<minlen || value.length>maxlen) && value.length!=0){
        img.src="images/validator_red.jpg";
        img.alt=0;
    } else {
        img.src="images/validator_green.jpg";
        img.alt=1;
    }
}
function check_email_or_blank (value1,img){
    if ((/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value1)) || value1==""){
        img.src="images/validator_green.jpg";
        img.alt=1;
    } else {
        img.src="images/validator_red.jpg";
        img.alt=0;
    }
}
function trim(str) {
	return str.replace(/^\s+|\s+$/g,"");
}
function ltrim(str) {
	return str.replace(/^\s+/,"");
}
function rtrim(str) {
	return str.replace(/\s+$/,"");
}
