function trim(string){
    return string.replace(/^\s*|\s*$/g,"");
}
function v_string(string)
{
    string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/^[A-Za-z ]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
function v_fieldString(string)
{
    string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/^[A-Za-z0-9 ]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}

function v_fieldStringSpace(string)
{
    string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/^[A-Za-z0-9]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}

function IsNumeric(string)
{
	var nums = "0123456789";
	if (string.length==0)return(false);
	for (var n=0; n < string.length; n++)
		{
			if(nums.indexOf(string.charAt(n))==-1)
			return(false);
		}
	return(true);
}

function v_alphaSpace(string)
{
    string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/^[A-Za-z][A-Za-z /]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
function v_decoAlpha(string)
{
    string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/^[A-Za-z][A-Za-z ()/]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}

function v_alphaNum(string)
{
    string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/^[A-Za-z][A-Za-z0-9]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
function comparePassword (password ,password1)
{
    if(password != password1)
    {
        return false;
    }
    else
    {
        return true;
    }

}
function v_url(string)
{
  string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/^[a-z0-9][a-z0-9\-]+([\.][a-z0-9\-]+)*[\.][a-z]{2,4}(\/|\/([\w#!:.?+=&%@!\-\/]+))*$/i))
        {
            return true;
        }
        else
        {
            return false;
        }
    }

}
function v_stalphaNum(string)
{
    string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/^[A-Za-z][A-Za-z0-9 -:.]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
function v_password(string)
{
    stringx = trim(string);
    if(stringx == '')
    {
        return false;
    }
	else if(stringx.length > 20)
	{
		return false;
	}
    else
    {
        if(string.match(/^[A-Za-z0-9-:@!#$&^*]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
function v_address(string){
	string = trim(string);
   if(string.match(/^[\w]+[\w\s\-\,/']*[\w]+$/)){
        return true;
    }else{
        return false;
    } 
} 

function v_numeric(string)
{
    string = trim(string);
    if(parseInt(string) > 0)
    {
        if(string.match(/^[0-9]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return false;
    }
}
function v_float(string)
{
    string = trim(string);
    if(parseFloat(string) > 0)
    {
        if(string.match(/^[0-9.]+$/))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
function v_email(string){
    string = trim(string);
    if(string == '')
    {
        return false;
    }
    else
    {
            if(string.match(/^[a-z0-9]{1}([\w\d\.])+@([a-z0-9\-\.])+([a-z]{2,4})$/i))
                {
                    if(string.match(/[\.]{2,}/))
                      {
                        return false;
                      }
                    else
                      {
                         return true;
                      }
                }
             else
                {
                    return false;
                }
    }
}

function v_phoneFax(string){
	string = trim(string);
    if(string == '')
    {
        return false;
    }
	else if(string.length > 20)
	{
		return false;
	}
    else
    {
        if(string.match(/^[\+]?[\d]+[\d\s\-]+[\d]+$/))
         {
            return true;
         }
        else
         {
            return false;
         }
    }
}

function is_logo(string)
{
    if(string == '')
    {
        return false;
    }
    else
    {
        if(string.match(/.(gif|jpg|jpeg)$/i))
         {
            return true;
         }
        else
         {
            return false;
         }
    }
}

function is_empty(string){
	string = trim(string);
   if(string == ''){
        return false;
    }else{
        return true;
    }
}

function checkLength(objectLen,min,max)
{
	if(objectLen == 0)
	{
		return false;
	}
	else
	{
		if((objectLen >= parseInt(min)) && (objectLen <= parseInt(max)))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}

function convertPrice(effecFieldObj,value)
{
	var assignType,formatStr,newStr;
	assignType = parseFloat(value) * 25.4;
	if(isNaN(assignType))
	{
		assignType = 0;
	}
	else
	{
		assignType     = Math.round(assignType*100)/100;
	}
	document.getElementById(effecFieldObj).value =  parseFloat(assignType);
}

function openPopUp(filename,width,height)
{
	var winObj =window.open('image272a.html?fp='+filename,'ImagePopUp', "width="+ (parseInt(width)+50) +", height="+ (parseInt(height)+50) +", location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no");
	winObj.moveBy(450,250);
}
