﻿// JScript File
function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById(myForm).value)){
return true;
}
alert("Invalid E-mail Address! Please re-enter.")
return false;
}
function check_track_no(txt_value)
{
if(trim(document.getElementById(txt_value).value)=="")
{
alert('track number should not empty');
document.getElementById(txt_value).focus();
return false;
}
return true;
}
function search_product_page(txt_value)
{
if(trim(document.getElementById(txt_value).value)=="")
{
alert('enter some text');
document.getElementById(txt_value).focus();
return false;
}
return true;
}
function ddl_index(ddlcontrol)
{
if(document.getElementById(ddlcontrol).selectedIndex==0)
{
alert('choose category');
document.getElementById(ddlcontrol).focus();
return false;
}
return true;
}
function ltrim(str) { 
	    for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
	    return str.substring(k, str.length);
    }
    function rtrim(str) {
	    for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
	    return str.substring(0,j+1);
    }
    function trim(str) {
	    return ltrim(rtrim(str));
    }
    
    function isWhitespace(charToCheck) {
	    var whitespaceChars = " \t\n\r\f";
	    return (whitespaceChars.indexOf(charToCheck) != -1);
    } 

