/********************************************************
Set of Global JavaScript functions for the CodeStore.net
DomBlog template
Jake Howlett, v2.1, 15/12/02 16:14
********************************************************/
/*doSearch is called from the button
below simple query box on all forms */
function doSearch ( s ) {
var regExp1 = /\bfield\b/i; //used to test for reserved word field in query string
var regExp2 = /[(,),<,>,\[,\]]/; //used to test for reserved char(s) in the query string
var str = s.value;
if ( trim(str) == "" ){
alert("Etsittävää oltava!");
s.focus();
return false;
} else {
if ( typeof regExp1.source != 'undefined' ) //supports regular expression testing
if ( regExp1.test( str ) || regExp2.test( str ) ){
var alrt = "Please note that you can not include:";
alrt += "\n\nThe reserved word 'field'\nthe characters [, ], (, ), < or >";
alrt += "\n\nin your search query!\n\nIf you are confident that you know";
alrt += "\nwhat you are doing, then you can\nmanually produce the URL required."
alert( alrt );
s.focus();
return false;
}
location.href = "/Blogs/tapahtumat.nsf/srch?SearchView&Query=" + escape( str ) + "&start=1&count=10&SearchFuzzy=True";
}
}
//Remove leading and trailing spaces from a string
//Originally written by Jim Fricker
function trim(aStr) {
return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "")
}