// Change Location
function changeLocation(loc) {
	window.location.href = loc;
}

// Change Link Style
function changeLinkStyle(id) {
	document.getElementById(id).style.textDecoration = "underline";
	document.getElementById(id).style.color= "#15626D";
}

// Restore Link Style
function restoreLinkStyle(id) {
	document.getElementById(id).style.textDecoration = "none";
	document.getElementById(id).style.color= "#555555";
}

// Change to other class
function changeClass(inputId, newClass) {
	var input = document.getElementById(inputId);
	if (input)
		input.className = newClass;
  	return;
}

// Set Focus
function setFocus(currentField) {
	var currentObj = document.getElementById(currentField);
	currentObj.focus();
	if (currentObj.type == "text" || currentObj.type == "password")
		currentObj.select();
}
/*
// Display a message for confirmation when the reset button is clicked
function resetForm(focusField) {
	if (window.confirm("Are you sure to remove all values?")) {
		setFocus(focusField);
		return true;
	}
	return false;
}*/

// Deterine whether the string contains value or not
function isEmpty(inStr) {
	return ( (inStr == null || inStr == "" || trimString(inStr) == "") ? true : false);
}

// Regular Expression: Trim String (using Regular Expression)
function trimString(inStr) {
	var objExpression = null;
	var tmpInStr = inStr;
	objExpression = /^(\s*)([\W\w]*)(\b\s*$)/;
	if (objExpression.test(tmpInStr))
		tmpInStr = tmpInStr.replace(objExpression, '$2');
	objExpression = / +/g;
	tmpInStr = tmpInStr.replace(objExpression, " ");
	if (tmpInStr == " ")
		 tmpInStr = "";
	return tmpInStr;
}

// Check valid email
function isEmail(inStr) {
	var emailExpression = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	return (emailExpression.test(inStr));		// Test for a match in the string
}

// Check valid character
function isAlpha(inStr) {
	var alphaExpression = /^[a-zA-Z ]+$/;
	return (alphaExpression.test(inStr));	// Test for a match in the string
}

// Check valid password
function isPwd(inStr) {
	var alphaExpression = /^\w{8}\w*$/;
	return (alphaExpression.test(inStr));	// Test for a match in the string
}

// Show Other Box
function showOtherBox(title, url) {
	self.parent.$("#TB_title").remove();
	self.parent.tb_show(title, url, false);
}

// Show Other Box
function showOtherBox1(title, url, links) {
	self.parent.$("#TB_title").remove();
	self.parent.tb_show1(title, url, false, links);
}