/******************************************************** 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("Please be sure to enter something to search for."); 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 = "/members/mbhwebmaster/9to5.nsf/srch?SearchView&Query=" + escape( str ) + "&start=1&count=10&SearchFuzzy=True"; } } function doGoButton ( s ) { var str = s.value; location.href = "/members/mbhwebmaster/9to5.nsf/bycategory?OpenView&count=-1&RestrictToCategory=" + escape( str ) + ""; } function doGoButtonHome ( s,c ) { var str = s.value; var ccode = c.value location.href = "/members/mbhwebmaster/9to5.nsf/bloglocation?OpenView&cid="+ escape( ccode ) + "&count=-1&RestrictToCategory=" + escape( str ) + ""; } //Remove leading and trailing spaces from a string //Originally written by Jim Fricker function trim(aStr) { return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") } //To determine to display Hirecules Jobs or Indeed Jobs when users press Find button function doFindButton ( s,c,k ) { var str = s.value; var prof = 'Category'; var loc = 'Location'; var ccode = c.value; var srchkey = k.value; if (str.match(loc) == 'Location'|| str.match(prof) == 'Category'){ alert('Please select the appropriate search criteria.'); return false } else { location.href = "/members/mbhwebmaster/9to5.nsf/doFind?OpenAgent&key="+ escape( srchkey ) + "&cid="+ escape( ccode ) + "&loc=" + escape( str ) + ""; } } // This function is for the eland or employers form function doListButton ( s,c,k ) { var str = s.value; var prof = 'Category'; var loc = 'Location'; var ccode = c.value; var srchkey = k.value; if (str.match(loc) == 'Location'|| str.match(prof) == 'Category' || srchkey == '' || srchkey == 'Job title'){ alert('Please select or enter the appropriate job listing criteria.'); return false } else { location.href = "/members/mbhwebmaster/9to5.nsf/blog?OpenForm&login&jT="+ escape( srchkey ) + "&Key="+ escape( str ) + "&cid="+ escape( ccode ) + ""; } } // This function is for the home form (in the new design) function doHomeButton (c,k) { var ccode = c.value; var srchkey = k.value; if (srchkey == ''){ alert('Please enter a Keyword.'); return false } else { location.href = "/members/mbhwebmaster/9to5.nsf/doFind?OpenAgent&key="+ escape( srchkey ) + "&cid="+ escape( ccode ) + "&loc=doHome"; } } // This function is for the candidate form where srch query string is 3 (in the new design) function doFindCompanyButton (s,c) { var str = s.value; var country = c.value; var company = 'Company'; if (str.match(company) == 'Company'){ alert('Please select a Company.'); return false } else { location.href = "/members/mbhwebmaster/9to5.nsf/doFind?OpenAgent&key=company%3A"+ escape( str ) + "&cid="+ escape( country ) + "&loc=doHome"; } }