function ValidateEmail(email, formName){
		var atCharPresent = false;
		var dotPresent = false;
		
		for ( var Idx = 0; Idx < email.value.length; Idx++ ){
			if ( email.value.charAt ( Idx ) == '@' )
				atCharPresent = true;
			if ( email.value.charAt ( Idx ) == '.' )
				dotPresent = true;
		}
		if ( !atCharPresent || !dotPresent ){
			alert( formName + "\nEmail address not looks valid !");
			email.focus();
			return false;
			}
	return true;
}
function ValidateEmail6(email, formName){
		var atCharPresent = false;
		var dotPresent = false;
		
		for ( var Idx = 0; Idx < email.value.length; Idx++ ){
			if ( email.value.charAt ( Idx ) == '@' )
				atCharPresent = true;
			if ( email.value.charAt ( Idx ) == '.' )
				dotPresent = true;
		}
		if ( !atCharPresent || !dotPresent ){
			alert( formName + "\nEmail address not looks valid !");
			email.focus();
			return false;
			}
	return true;
}
function LTrimAll(str){
	if(str==null){
		return str;
	}
	for(var i=0;str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t";i++);
		return str.substring(i,str.length);
}

function RTrimAll(str){
	if(str==null){
		return str;
	}
	for(var i=str.length-1;str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t";i--);
		return str.substring(0,i+1);
}

function TrimAll(str){
	return LTrimAll(RTrimAll(str));
}

function changeBackgroundColor( current , condition ){
	if( condition == 'over' ){
		current.style.backgroundColor='#CCCC66';
	} else if( condition == 'out' ) {
		current.style.backgroundColor='#3EAFFE';
	}
}

function mailingListValidate( check ){
	if(TrimAll(check.name.value) == ""){
		alert("Mailing List:\nPlease fill in your Name !");
		check.name.value = "";
		check.name.focus();
		return false;
	}
	if(TrimAll(check.country.value) == ""){
		alert("Mailing List:\nPlease fill in your Country !");
		check.country.value = "";
		check.country.focus();
		return false;
	}

	return ValidateEmail(check.email, 'Mailing List:');
}

function searchValidate( check ){
	if(TrimAll(check.keywords.value) == "" ){
		alert("Please fill in the Search Keywords !");
		check.keywords.focus();
		return false;
	}
	if(TrimAll(check.search_in.value) == "" ){
		alert("Please select the Category to Search !");
		check.search_in.focus();
		return false;
	}
}