function SetDefaultFirstPage() {
	with (document.body) {
		style.behavior='url(#default#homepage)';
		setHomePage('http://www.dc-cafe.com');
	}
}

function AddBookmark() {
	window.external.AddFavorite("http://www.dc-cafe.com", "DC-Cafe.com 一站式最全面的攝影資訊網站");
}

// Removes leading whitespaces
function LTrim( value ) {

	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");

}

// Removes ending whitespaces
function RTrim( value ) {

	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");

}

// Removes leading and ending whitespaces
function trim( value ) {
	return LTrim(RTrim(value));

}

function isValid_Email(thisValue) {
	return (thisValue.indexOf(".",thisValue.indexOf("@",0)))
}

function isValid_Hyperlink( value ) {
	retValue=false;
	if (value.length>5 ) {
		var tempstr = value.substring(0,6);
		// the protocol must starting from http:/, https:, ftp://
		if (tempstr == "http:/" || "https:" || "ftp://")  {
	        // check at least two dot found in the hyperlink e.g. www.xyz.
	        var dotcount = 0;
	        for (var cnt = 0; cnt < value.length; cnt++) {
				var tmp = value.substring(cnt,cnt+1);
	            if (tmp == '.') {dotcount = dotcount + 1;}
			}
	        if (dotcount >= 2) {retValue=true;}
		} // end if http:...
	}
	return retValue;
}

//  check for valid numeric strings
function IsNumeric(value) {
	var NumChars = "0123456789.-";
	var strChar;
	IsNum = true;

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

	//  test strString consists of valid characters listed above
	for (i = 0; i < value.length && IsNum==true; i++) {
      strChar = value.charAt(i);
      if (NumChars.indexOf(strChar) == -1) {
         IsNum=false;
         }
	} // end for
   	return IsNum;
}

// Check For Date Foramt 'YYYY-MM-DD'
function isDate(EntryDate) {
	if (EntryDate.length != 10 ) {
		return(false);
	}
	else if (EntryDate.substr(4,1) != "-") {
		return(false);
	}
	else if (EntryDate.substr(7,1) != "-") {
		return(false);
	}
	else if (!IsNumeric(EntryDate.substr(0,4))) {
		return(false);
	}
	else if (!IsNumeric(EntryDate.substr(5,2))) {
		return(false);
	}
	else if (!IsNumeric(EntryDate.substr(8,2))) {
		return(false);
	}
	else {
		return(true);
}	}

