function getFileName(str)
{
 var bpos
 var filename
 if((str=='')||(str.indexOf("\\")==-1)) return(str);
 bpos = str.lastIndexOf("\\");
 filename = str.substring(bpos+1,str.length)
 return(filename);
}



/*
 trimLeft
 Remove all spaces at the beginning of a string
*/
function trimLeft(s)
{
 var i;
 i=0;
 var n;
 n = s.length;
 while((i<n)&&(s.charAt(i)==' ')) i++;
	s = s.substring(i);
 return(s);
} 

/*
 trimRight
 Remove all spaces at the end of a string
*/
function trimRight(s)
{
 var n;
 n = s.length;
 var i;
 i = s.length-1;
 while((i>=0)&&(s.charAt(i)==' ')) i--;
	s = s.substring(0,i+1);
 return(s);
}

/* 
 trim
 Remove all leading and trailing spaces in a string
*/
function trim(s)
{
 s = trimLeft(s);
 s = trimRight(s);
 return(s);
}  


function IsCheckedRadio(source)
{
	for (i=0; i< source.length; i++)
		if (source[i].checked)
			return true;
	return false;
}

function ValidateRequiredFields(frm, arr)
{
	for (i = 0; i < arr.length; i++)
	{
		var e = frm.elements[arr[i]];
		if (e.value.length <= 0)
		{
			e.select();
			e.focus();
			return false;
		}
	}	
	return true;
}

function ValidateRegular(source, reg)
{
	value = source.value;
	if (value.length == 0)
		return true;
	var rx = new RegExp(reg);
	var matches = rx.exec(value);
    return (matches != null && value == matches[0]);
}


function ValidateEmail(source)
{
	if  (!ValidateRegular(source, "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"))
	{
		source.select();
		source.focus();
		return false;
	}
	return true;
}

function ValidateEmailS(num,source)
{
// num = 1: No Require
// num = 2: Require
	if (num == 2)
	{
		if (source.value == "")
		{
			alert('Please enter email address');
			source.focus();
			return false;
		}
	}

	if  (!ValidateRegular(source, "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"))
	{
		alert('Format email is invalid.');
		source.select();
		source.focus();
		return false;
	}
	return true;
}


function ValidatePhone(source)
{
	if (!ValidateRegular(source, "((\\(\\d{3}\\) ?)|(\\d{3}-))?\\d{3}-\\d{4}"))
	{
		source.select();
		source.focus();
		return false;
	}
	return true;
}

function ValidatePhoneS(num,source)
// num = 1: No Require
// num = 2: Require
{
	if (num == 2)
	{
		if (source.value == "")
		{
			alert('Please enter phone number!');
			source.focus();
			return false;
		}		  	
	}		
	if (!ValidateRegular(source, "((\\(\\d{3}\\) ?)|(\\d{3}-))?\\d{3}-\\d{4}"))
	{
		alert('Phone number is invalid!\n Format phone:(xxx)xxx-xxxx');
		source.select();
		source.focus();
		return false;
	}
	return true;
}

function ValidateZipS(num,source)
{
	// num = 1: No Require
	// num = 2: Require
	if (num == 2)
	{
		if (source.value == "")
		{			
			alert("Please enter zip code!");
			source.focus();
			return false;
		}		  	
	}
	if (!ValidateRegular(source, "\\d{5}(-\\d{4})?"))
	{	
		alert('Zip number is invalid!\n Format zip:xxxxx');
		source.select();
		source.focus();
		return false;
	}
	return true;
}

function ValidateFaxS(num,source)
// num = 1: No Require
// num = 2: Require
{
	if (num == 2)
	{
		if (source.value == "")
		{
			alert('Please enter fax number!');
			source.focus();
			return false;
		}		  	
	}		
	if (!ValidateRegular(source, "((\\(\\d{3}\\) ?)|(\\d{3}-))?\\d{3}-\\d{4}"))
	{
		alert('Fax number is invalid!\n Format Fax:(xxx)xxx-xxxx');
		source.select();
		source.focus();
		return false;
	}
	return true;
}

function IsInteger(source)
{
	if (!ValidateRegular(source, "\\d*"))
	{
		source.select();
		source.focus();
		return false;
	}
	return true;
}

function ValidateURL(source)
{
	if (!ValidateRegular(source, "((\\(\\d{3}\\) ?)|(\\d{3}-))?\\d{3}-\\d{4}"))
	{
		source.select();
		source.focus();
		return false;
	}
	return true;
}

// validate credit card number
var Cards = new makeArray(8);
Cards[0] = new CardType("MasterCard", "51,52,53,54,55", "16");
var MasterCard = Cards[0];
Cards[1] = new CardType("VisaCard", "4", "13,16");
var VisaCard = Cards[1];
Cards[2] = new CardType("AmExCard", "34,37", "15");
var AmExCard = Cards[2];
Cards[3] = new CardType("DiscoverCard", "6011", "16");
var DiscoverCard = Cards[3];


Cards[4] = new CardType("DinersClubCard", "30,36,38", "14");
var DinersClubCard = Cards[4];
Cards[5] = new CardType("enRouteCard", "2014,2149", "15");
var enRouteCard = Cards[5];
Cards[6] = new CardType("JCBCard", "3088,3096,3112,3158,3337,3528", "16");
var JCBCard = Cards[6];
var LuhnCheckSum = Cards[7] = new CardType();

/*************************************************************************\
CheckCardNumber(form)
function called when users click the "check" button.
\*************************************************************************/
function CheckCardNumber(iCardType, strCardNum, strCardExpMonth, strCardExpYear) 
{
	var tmpyear;
	
	var today = new Date();
	var strReturnValue = "";
	if (strCardExpYear < today.getYear())
	{
		strReturnValue = strReturnValue + "The Expiration Year is not valid. It must be greater than or equals " + today.getYear();
		return strReturnValue;
	}
	tmpyear = strCardExpYear;
		
	var tmpmonth;
	tmpmonth  = strCardExpMonth;
			
	// The following line doesn't work in IE3, you need to change it
	// to something like "(new CardType())...".
	 //if (!CardType().isExpiryDate(tmpyear, tmpmonth)) 
	if (!(new CardType()).isExpiryDate(tmpyear, tmpmonth)) 
	{
		strReturnValue = strReturnValue + "This card has already expired.";
		return strReturnValue;
	}
	
	
	var card = Cards[iCardType].getCardType();
	var retval = Cards[iCardType].checkCardNumber(strCardNum,tmpyear,tmpmonth);
	cardname = "";
	if (retval)
		return "";
	else 
	{
		// The cardnumber has the valid luhn checksum, but we want to know which
		// cardtype it belongs to.
		for (var n = 0; n < Cards.size; n++) 
		{
			if (Cards[n].checkCardNumber(strCardNum, tmpyear, tmpmonth)) 
			{
				cardname = Cards[n].getCardType();
				break;
			}
		}
		
		if (cardname.length > 0) 
		{
			strReturnValue = strReturnValue + "This looks like a " + cardname + " number, not a " + card + " number.";
			return strReturnValue;
		}
		else 
		{
			return "Your credit card number is not valid. Please re-enter!";
		}
   }
}
/*************************************************************************\
Object CardType([String cardtype, String rules, String len, int year, 
                                        int month])
cardtype    : type of card, eg: MasterCard, Visa, etc.
rules       : rules of the cardnumber, eg: "4", "6011", "34,37".
len         : valid length of cardnumber, eg: "16,19", "13,16".
year        : year of expiry date.
month       : month of expiry date.
eg:
var VisaCard = new CardType("Visa", "4", "16");
var AmExCard = new CardType("AmEx", "34,37", "15");
\*************************************************************************/
function CardType() 
{
	var n;
	var argv = CardType.arguments;
	var argc = CardType.arguments.length;
	
	this.objname = "object CardType";
	
	var tmpcardtype = (argc > 0) ? argv[0] : "CardObject";
	var tmprules = (argc > 1) ? argv[1] : "0,1,2,3,4,5,6,7,8,9";
	var tmplen = (argc > 2) ? argv[2] : "13,14,15,16,19";
	
	this.setCardNumber = setCardNumber;  // set CardNumber method.
	this.setCardType = setCardType;  // setCardType method.
	this.setLen = setLen;  // setLen method.
	this.setRules = setRules;  // setRules method.
	this.setExpiryDate = setExpiryDate;  // setExpiryDate method.
	
	this.setCardType(tmpcardtype);
	this.setLen(tmplen);
	this.setRules(tmprules);
	if (argc > 4)
		this.setExpiryDate(argv[3], argv[4]);
	
	this.checkCardNumber = checkCardNumber;  // checkCardNumber method.
	this.getExpiryDate = getExpiryDate;  // getExpiryDate method.
	this.getCardType = getCardType;  // getCardType method.
	this.isCardNumber = isCardNumber;  // isCardNumber method.
	this.isExpiryDate = isExpiryDate;  // isExpiryDate method.
	this.luhnCheck = luhnCheck;// luhnCheck method.
	return this;
}

/*************************************************************************\
boolean checkCardNumber([String cardnumber, int year, int month])
return true if cardnumber pass the luhncheck and the expiry date is
valid, else return false.
\*************************************************************************/
function checkCardNumber() 
{
	var argv = checkCardNumber.arguments;
	var argc = checkCardNumber.arguments.length;
	var cardnumber = (argc > 0) ? argv[0] : this.cardnumber;
	var year = (argc > 1) ? argv[1] : this.year;
	var month = (argc > 2) ? argv[2] : this.month;

	this.setCardNumber(cardnumber);
	this.setExpiryDate(year, month);

	if (!this.isCardNumber())
		return false;
	if (!this.isExpiryDate())
		return false;
	return true;
}
/*************************************************************************\
String getCardType()
return the cardtype.
\*************************************************************************/
function getCardType() 
{
	return this.cardtype;
}
/*************************************************************************\
String getExpiryDate()
return the expiry date.
\*************************************************************************/
function getExpiryDate() 
{
	return this.month + "/" + this.year;
}
/*************************************************************************\
boolean isCardNumber([String cardnumber])
return true if cardnumber pass the luhncheck and the rules, else return
false.
\*************************************************************************/
function isCardNumber() 
{
	var argv = isCardNumber.arguments;
	var argc = isCardNumber.arguments.length;
	var cardnumber = (argc > 0) ? argv[0] : this.cardnumber;
	if (!this.luhnCheck())
	{
		return false;
	}
	for (var n = 0; n < this.len.size; n++)
	{	
		
		if (parseInt(cardnumber.toString().length,10) == parseInt(this.len[n],10)) 
		{
			for (var m = 0; m < this.rules.size; m++) 
			{
				var headdigit = cardnumber.substring(0, this.rules[m].toString().length);
				if (headdigit == this.rules[m])
					return true;
			}
			return false;
		}
	}
	return false;
}

/*************************************************************************\
boolean isExpiryDate([int year, int month])
return true if the date is a valid expiry date,
else return false.
\*************************************************************************/
function isExpiryDate() 
{
	var argv = isExpiryDate.arguments;
	var argc = isExpiryDate.arguments.length;

	year = argc > 0 ? argv[0] : this.year;
	month = argc > 1 ? argv[1] : this.month;

	if (!isNum(year+""))
		return false;
	if (!isNum(month+""))
		return false;
	today = new Date();
	expiry = new Date(year, month);
	if (today.getTime() > expiry.getTime())
		return false;
	else
		return true;
}

/*************************************************************************\
boolean isNum(String argvalue)
return true if argvalue contains only numeric characters,
else return false.
\*************************************************************************/
function isNum(argvalue) 
{
	argvalue = argvalue.toString();

	if (argvalue.length == 0)
	return false;

	for (var n = 0; n < argvalue.length; n++)
		if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9")
			return false;
	return true;
}

/*************************************************************************\
boolean luhnCheck([String CardNumber])
return true if CardNumber pass the luhn check else return false.
Reference: http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl
\*************************************************************************/
function luhnCheck() 
{
	var argv = luhnCheck.arguments;
	var argc = luhnCheck.arguments.length;

	var CardNumber = argc > 0 ? argv[0] : this.cardnumber;

	if (! isNum(CardNumber)) 
	{
		return false;
	}

	var no_digit = CardNumber.length;
	var oddoeven = no_digit & 1;
	var sum = 0;

	for (var count = 0; count < no_digit; count++) 
	{
		var digit = parseInt(CardNumber.charAt(count));
		if (!((count & 1) ^ oddoeven)) 
		{
			digit *= 2;
			if (digit > 9)
			digit -= 9;
		}
		sum += digit;
	}
	if (sum % 10 == 0)
		return true;
	else
		return false;
}

/*************************************************************************\
ArrayObject makeArray(int size)
return the array object in the size specified.
\*************************************************************************/
function makeArray(size) 
{
	this.size = size;
	return this;
}

/*************************************************************************\
CardType setCardNumber(cardnumber)
return the CardType object.
\*************************************************************************/
function setCardNumber(cardnumber) 
{
	this.cardnumber = cardnumber;
	return this;
}

/*************************************************************************\
CardType setCardType(cardtype)
return the CardType object.
\*************************************************************************/
function setCardType(cardtype) 
{
	this.cardtype = cardtype;
	return this;
}

/*************************************************************************\
CardType setExpiryDate(year, month)
return the CardType object.
\*************************************************************************/
function setExpiryDate(year, month) 
{
	this.year = year;
	this.month = month;
	return this;
}

/*************************************************************************\
CardType setLen(len)
return the CardType object.
\*************************************************************************/
function setLen(len) 
{
	// Create the len array.
	if (len.length == 0 || len == null)
		len = "13,14,15,16,19";

	var tmplen = len;
	n = 1;
	while (tmplen.indexOf(",") != -1) 
	{
		tmplen = tmplen.substring(tmplen.indexOf(",") + 1, tmplen.length);
		n++;
	}
	this.len = new makeArray(n);
	n = 0;
	while (len.indexOf(",") != -1) 
	{
		var tmpstr = len.substring(0, len.indexOf(","));
		this.len[n] = tmpstr;
		len = len.substring(len.indexOf(",") + 1, len.length);
		n++;
	}
	this.len[n] = len;
	return this;
}

/*************************************************************************\
CardType setRules()
return the CardType object.
\*************************************************************************/
function setRules(rules) 
{
	// Create the rules array.
	if (rules.length == 0 || rules == null)
		rules = "0,1,2,3,4,5,6,7,8,9";
	  
	var tmprules = rules;
	n = 1;
	while (tmprules.indexOf(",") != -1) 
	{
		tmprules = tmprules.substring(tmprules.indexOf(",") + 1, tmprules.length);
		n++;
	}
	
	this.rules = new makeArray(n);
	n = 0;
	
	while (rules.indexOf(",") != -1) 
	{
		var tmpstr = rules.substring(0, rules.indexOf(","));
		this.rules[n] = tmpstr;
		rules = rules.substring(rules.indexOf(",") + 1, rules.length);
		n++;
	}
	this.rules[n] = rules;
	return this;
}
























//////////////////////////////////////
//TBLMedia, Inc Script code
////////////////////////////////////
/////////////////////////////////////////////////////////////////
//This function is check require field for a textbox
///////////////////////////////////////////////////////////
function TBLCheckRequireField(object,strMesssage){
	if(trim(object.value) == ''){
		object.focus();
		return strMesssage;
		
	}
	else{
		return "";
	}
}
function TBLCheckRequireFieldHidden(object,strMesssage){
	if(object.value.length == 0){
		return strMesssage;
	}
	else{
		return "";
	}
}
function TBLCheckNumber(object,strMesssage)
{
	if(isNaN(object.value)){
		object.focus();
		return strMesssage;
	}
	else{
		return "";
	}
}

function TBLCheckNumberGreaterThan(object,minValue,strMesssage,strMesssage2)
{
	if(object.value.length > 0)
	{
		if(isNaN(object.value))
		{
			object.focus();
			return strMesssage;
		}
		else
		{
			if(object.value > minValue)
			{
				return "";
			}
			else
			{
				return strMesssage2;
			}
		}
	}
	else
	{
		return "";
	}
}

function TBLCheckNumberGreaterThanOrEqual(object,minValue,strMesssage,strMesssage2)
{
	if(object.value.length > 0)
	{
		if(isNaN(object.value))
		{
			object.focus();
			return strMesssage;
		}
		else
		{
			if(parseFloat(object.value) >= minValue)
			{
				return "";
			}
			else
			{
				return strMesssage2;
			}
		}
	}
	else
	{
		return "";
	}
}



function TBLCheckNumberGreaterThanObject(object1,object2,strMesssage,isEqual)
{
	if((object1.value.length > 0) && (object2.value.length > 0))
	{
		if((!isNaN(object1.value)) && (!isNaN(object2.value)) )
		{
			if(isEqual)
			{
				if(parseFloat(object1.value) >= parseFloat(object2.value))
				{
					return "";
				}
				else
				{
					return strMesssage;
				}
			}
			else
			{
				if(parseFloat(object1.value) > parseFloat(object2.value))
				{
					return "";
				}
				else
				{
					return strMesssage;
				}
			}
		}
		
	}
	else
	{
		return "";
	}
}

////////////////////////////////////////////////////////////////////////
//This function is check for compare 2 control
///////////////////////////////////////////////////////////////////////
function TBLCheckCompareField(objControl1,objControl2,strMessage){
	if(objControl1.value != objControl2.value){
		objControl2.focus()
		return strMessage;
	}
	else{
		return "";
	}
}
///////////////////////////////////////////////////
//This function is check email but it only return a message
////////////////////////////////////////////////////////
function TBLCheckEmail(object,strMessage){
	if(object.value.length > 0){
		if(ValidateEmail(object)){
			return "";
		}
		else
		{
			return strMessage
			object.focus();
		}
	}
	else{
		return "";
	}
}

///////////////////////////////////////////////////
//This function is check integer but it only return a message
////////////////////////////////////////////////////////
function TBLCheckInteger(object,strMessage){
	if(object.value.length > 0){
		if(IsInteger(object)){
			return "";
		}
		else
		{
			return strMessage
			object.focus();
		}
	}
	else{
		return "";
	}
}

///////////////////////////////////////////////////
//This function is check integer but it only return a message
////////////////////////////////////////////////////////
function TBLCheckRangeNumber(object,iMin, iMax, strMessage){
	if(object.value.length > 0){
		if(!isNaN(object.value)){
			if((parseFloat(object.value) >= iMin) && (parseFloat(object.value) <= iMax)){
				return "";
				
			}
			else
			{
				return strMessage
				object.focus();
			}
		}
		else
		{
			return "";
		}
	}
	else{
		return "";
	}
}


///////////////////////////////////////////////////
//This function is check range of date
////////////////////////////////////////////////////////
function TBLCheckCompareNumber(fFrom, fTo, strOperator, strMessage)
{
	if(eval(fFrom + strOperator + fTo))
	{
		return "";
	}
	else
	{
		return strMessage;
	}
}

///////////////////////////////////////////////////
//This function is check range of date
///////////////////////////////////////////////////
function TBLCheckSpace(obj,strMessage)
{
	if (obj.value.length>0){	
		if (obj.value.indexOf(' ')>0) 
			return strMessage;
		else
			return "";	
	}
	return "";
}

////////////////////////////////////////////////////////
//This function is check range of date
////////////////////////////////////////////////////////
function TBLCheckDateRange(objFromDate, objToDate, strMessage)
{
	var datFromDate = objFromDate.value;
	var datToDate = objToDate.value;
	if((datFromDate != "") && (datToDate != ""))
	{
		return TBLCheckDateRangeValue(datFromDate, datToDate, strMessage);
	}
	else
	{
		return "";
	}
}
function TBLCheckDateRangeValue(datFromDate, datToDate, strMessage)
{
	var iFromDay, iFromMonth, iFromYear, iToDay, iToMonth, iToYear;
	var arrFromDate, arrToDate;
	arrFromDate = datFromDate.split("/");
	arrToDate = datToDate.split("/");
	iFromMonth = parseInt(arrFromDate[0],10);
	iFromDay = parseInt(arrFromDate[1],10);
	iFromYear = parseInt(arrFromDate[2],10);
	iToMonth = parseInt(arrToDate[0],10);
	iToDay = parseInt(arrToDate[1],10);
	iToYear = parseInt(arrToDate[2],10);
	//Check for year
	if(iFromYear > iToYear)
	{
		return strMessage;
	}
	else
	{
		if(iFromYear == iToYear)
		{
			//Check for month
			if(iFromMonth > iToMonth)
			{
				return strMessage;
			}
			else
			{
				if(iFromMonth == iToMonth)
				{
					//Check for day
					if(iFromDay > iToDay)
					{
						return strMessage;
					}
				}
			}
		}
		
	}
	return "";
}

//////////////////////////
function TBLCheckDateRanget(objFromDate, objToDate, strMessage)
{
	
	var datFromDate = objFromDate.value;
	var datToDate = objToDate.value;
	if((datFromDate != "") && (datToDate != ""))
	{
		return TBLCheckDateRangeValuet(datFromDate, datToDate, strMessage);
	}
	else
	{
		return "";
	}
}
function TBLCheckDateRangeValuet(datFromDate, datToDate, strMessage)
{
	var iFromDay, iFromMonth, iFromYear, iToDay, iToMonth, iToYear;
	var arrFromDate, arrToDate;
	arrFromDate = datFromDate.split("/");
	arrToDate = datToDate.split("/");
	iFromMonth = parseInt(arrFromDate[1],10);
	iFromDay = parseInt(arrFromDate[0],10);
	iFromYear = parseInt(arrFromDate[2],10);
	iToMonth = parseInt(arrToDate[1],10);
	iToDay = parseInt(arrToDate[0],10);
	iToYear = parseInt(arrToDate[2],10);
	//Check for year
	if(iFromYear > iToYear)
	{
		return strMessage;
	}
	else
	{
		if(iFromYear == iToYear)
		{
			//Check for month
			if(iFromMonth > iToMonth)
			{
				return strMessage;
			}
			else
			{
				if(iFromMonth == iToMonth)
				{
					//Check for day
					if(iFromDay > iToDay)
					{
						return strMessage;
					}
				}
			}
		}
		
	}
	return "";
}
/////////////////////////

function TBLCheckDateRangeEqualValue(datFromDate, datToDate, strMessage)
{
	var iFromDay, iFromMonth, iFromYear, iToDay, iToMonth, iToYear;
	var arrFromDate, arrToDate;
	if((datFromDate != "") && (datToDate != ""))
	{
		arrFromDate = datFromDate.value.split("/");
		arrToDate = datToDate.value.split("/");
		iFromMonth = parseInt(arrFromDate[0],10);
		iFromDay = parseInt(arrFromDate[1],10);
		iFromYear = parseInt(arrFromDate[2],10);
		iToMonth = parseInt(arrToDate[0],10);
		iToDay = parseInt(arrToDate[1],10);
		iToYear = parseInt(arrToDate[2],10);
		//Check for year
		if(iFromYear > iToYear)
		{
			return false;
		}
		else
		{
			if(iFromYear == iToYear)
			{
				//Check for month
				if(iFromMonth > iToMonth)
				{
					return false;
				}
				else
				{
					if(iFromMonth == iToMonth)
					{
						//Check for day
						if(iFromDay > iToDay)
						{
							return false;
						}
						else 
						{
							if(iFromDay == iToDay)
							{
								return true;
							}
						}
					}
				}
			}
			
		}
	}
	return false;
}
///////////////////////////////////////////////////
//This function is check zipcode but it only return a message
////////////////////////////////////////////////////////
function TBLValidateZipCode(source)
{
	if (!ValidateRegular(source, "\\d{5}(-\\d{4})?"))
	{
		source.select();
		source.focus();
		return false;
	}
	return true;
}

///////////////////////////////////////////////////
//This function is check website but it only return a message
////////////////////////////////////////////////////////
function TBLValidateWebsite(object, strMessage)
{
	if(object.value.length > 0){
		if(ValidateWebsite(object)){
			return "";
		}
		else
		{
			return strMessage
			object.focus();
		}
	}
	else{
		return "";
	}
}
function ValidateWebsite(source)
{
	if (!ValidateRegular(source, "(http://)?([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?"))
	{
		source.select();
		source.focus();
		return false;
	}
	return true;
}
/////////////////////////////////////////////////////////
function TBLCheckPhone(object,strMessage){
	if(object.value.length > 0){
		if(ValidatePhone(object)){
			return "";
		}
		else
		{
			return strMessage
			object.focus();
		}
	}
	else{
		return "";
	}
}
/////////////////////////////////////////////////////////////////////
function TBLCheckZipCode(object,strMessage){
	if(object.value.length > 0){
		if(TBLValidateZipCode(object)){
			return "";
		}
		else
		{
			object.focus();
			return strMessage;
			
		}
	}
	else{
		return "";
	}
}
//////////////////////////////////////////////////////////////////
function TBLCheckCombo(object,strMessage){
	if(object.selectedIndex == 0){
		return strMessage
		object.focus();
	}
	else{
		return "";
	}
}
//////////////////////////////////////////////////////////////////
function TBLCheckListBox(object,strMessage){
	if(object.length == 0){
		return strMessage
		object.focus();
	}
	else{
		return "";
	}
}
function TBL2CheckListBox(object1, object2, strMessage)
{
	if((TBLCheckListBox(object1, strMessage).length > 0) && (TBLCheckListBox(object2, strMessage).length > 0))
	{
		return strMessage;
	}
	else{
		return "";
	}
}

//check Image
function isImage(str)
{
	str = str.toLowerCase();
	var len = str.length;
	var pos = str.indexOf(".",0);
	var ext = str.substring(pos,len);
	if ((ext==".bmp" )||(ext==".jpg")||(ext==".jpe" )||(ext==".jpeg" )||(ext==".gif" )||(ext==".tif" )||(ext==".tiff" )||(ext==".png" )){		
		return true;
	}    	
	return false;	
}
//end isImage

////////////////////////////////////////////////////////////////////////
//This function is check for require file
///////////////////////////////////////////////////////////////////////

function checkFileType(objControl,strMessage,strFileType ){
	if(objControl.value == "")
	{
		return "";
	}
	else{
		if(checkFile(objControl.value, strFileType))
		{
			return "";
		}
		else
		{
			objControl.select();
			objControl.focus();
			return strMessage;
		}
	}
}

////////////////////////////////////////////////////////////////////////
//This function is check for require file
///////////////////////////////////////////////////////////////////////

function TBLCheckDate(object,strMessage){
	var datValue = object.value;
	if(datValue != "") 
	{
		if(isNaN(Date.parse(datValue)))
		{
			object.focus();
			return strMessage
		}
		else{
			return "";
		}
	}
	else
	{
		return "";
	}
}
////////////////////////////////////////////////////////////////////////
//This function is check for require file
///////////////////////////////////////////////////////////////////////

function TBLCheckMuiltiDate(object,strSeparate, strMessage)
{
	var datValue = object.value;
	var arrDate = datValue.split(strSeparate)
	for(i = 0; i < arrDate.length; i++)
	{
		var dateItem = arrDate[i];
		if(dateItem != "") 
		{
			if(isNaN(Date.parse(dateItem)))
			{
				object.focus();
				return strMessage
			}
			else{
				return "";
			}
		}
		else
		{
			return "";
		}
	}
}

////////////////////////////////////////////////////////////////////////
//This function is check for require file
///////////////////////////////////////////////////////////////////////
	function checkFile(strValue, strFileType)
	{
		var strExtension = strValue.substr((strValue.lastIndexOf(".") + 1), strValue.length).toLowerCase();
		var arrExtension = strFileType.split(",");
		var bFound = false;
		for(var i = 0; i < arrExtension.length;i++)
		{
			if(strExtension.toLowerCase() == arrExtension[i].toLowerCase())
			{
				bFound = true;
			}
		}
		return bFound;
	}
/////////////////////////////////////////////////////////////
// End of  code
////////////////////////////////////////////////////////////
	function TBLCheckGroupRadio(source,message)
	{
		if (!IsCheckedRadio(source))
		{
			return message;
		}
		return "";
	}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	function TBLCheckListCheckBox(frmForm,itemName, message)
	{
		var count = 0;
		var strAlert = "";
		for (i = 0; i < frmForm.elements.length; i++)
		{	
			e = frmForm.elements[i];
			if (e.name == itemName && e.checked == true)
			{
				count++;
			}
		}
		if (count > 0)
		{
		    return "";				
		}
		else
		{
			return message;
		}
	}		