


// Function For Search Box in every page
function SubmitTheForm(){
	var searchkey = trim(SearchForm.q.value);
	if(searchkey!=""){
		if(removeSpecialKeyInSearch(SearchForm.q)=="1") SearchForm.submit();
		else return false;
	}else{
		alert('Please enter the keyword !');
		return false;
	}
}

// Filter special symbol
function removeSpecialKeyInSearch(this_field){
  var result = "1";
  var iChars = "!@#$%^&*()+=[]\\\';,./{}|\":<>?";
  var wordCount=this_field.value.length;

  for (var i = 0; i < wordCount; i++) {	

  	if (iChars.indexOf(this_field.value.charAt(i)) != -1) {		
		//this_field.style.backgroundColor ="RED";
		alert("Your \"Keyword\" has special characters.\nThese are NOT ALLOWED!\nPlease remove them and try again.");
  		return false;
  	}else result = "1"//if (iChars.indexOf(document.addcat.catname.value.charAt(i)) != -1) {

  }//for (var i = 0; i < wordCount; i++) {
	  return result;
}//function specialTextValid(){

function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

// Filter special symbol
function specialTextValid(this_field){
  var result = "1";
  var iChars = "!@#$%^&*()+=[]\\\';,./{}|\":<>?";
  var wordCount=this_field.value.length;
