// Cascais content system © 2006 Tom Vatland // Avanti Media AS - www.finnalle.no function search_post( p, q, s, g, c ) { q = q.replace( /^\s+|\s+$/g, "" ); if ( q ) { document.search.elements[1].style.cursor='progress'; var a=""; q = q.replace( /[ \+]/g, "_" ); q = q.replace( /[\\\/]/g, "" ); q = escape( utf8_encode( q ) ); document.search.q.disabled = true; if ( s > 1 ) { if ( document.search.s ) { document.search.s.disabled = true; } a = "s"+ s; } if ( g ) { document.search.g.disabled = true; a = a +"-g"+ g; } if ( c ) { document.search.c.disabled = true; a = a +"-c"+ c; } if ( a ) { q = "/"+ q +"/"+ a.replace( /^\-/g, "" ) +".html"; } else { q = "/"+ q +".html"; } if ( p != "" && p != "/" ) { top.window.location.href = "/"+ p.replace( /\//g, "" ) + q; } else { top.window.location.href = q; } return false; } else { document.search.q.value = q; return false; } } function utf8_encode( string ) { for (var n=0, u=""; n < string.length; n++) { var c=string.charCodeAt(n); if (c < 128) { u += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { u += String.fromCharCode((c >> 6) | 192); u += String.fromCharCode((c & 63) | 128); } else { u += String.fromCharCode((c >> 12) | 224); u += String.fromCharCode(((c >> 6) & 63) | 128); u += String.fromCharCode((c & 63) | 128); } } return u; }