function checkAndEncodeSpecialSigns( val ){

  	var re = new RegExp("&", 'g');
    if (val.match(re)) {
    	val = val.replace(re,"%26" );
  	}
	
    
  	re = new RegExp("#", 'g');
    if (val.match(re)) {
    	val = val.replace(re, "%23");
  	}
	
	return val;
}


function redirectPortal(){
  	var val = document.getElementsByName('slowo')[0].value;
  	val = checkAndEncodeSpecialSigns(val);
    if ( val != null && val != ""){   		
    	location.href = "http://gazetapraca.pl/paramsCC?url=" + encodeURIComponent("http://szukaj.gazeta.pl/portalSearch.do" ) + "&s.sm.query=" + val; 
   } else { 
      	location.href = "http://szukaj.gazeta.pl/portalSearch.do";
   } 
}
function redirectInternet(){
  var val = document.getElementsByName('slowo')[0].value;
  	val = checkAndEncodeSpecialSigns(val);  
    if ( val != null && val != ""){   		
   	 location.href = "http://szukaj.gazeta.pl/internet/0,0.html?slowo=" + val; 
	} else { 
   	 location.href = "http://szukaj.gazeta.pl/internet/0,0.html";   
   } 
}
function redirectForum(){
  	var val = document.getElementsByName('slowo')[0].value;
  	val = checkAndEncodeSpecialSigns(val);  	
    if ( val != null && val != ""){   		
   		location.href = "http://gazetapraca.pl/paramsCC?url=" + encodeURIComponent("http://szukaj.gazeta.pl/forumSearch.do" ) + "&s.sm.query=" + val; 
	} else {
   		location.href = "http://szukaj.gazeta.pl/forumSearch.do";   
   } 
}
function redirectKatalogWww(){
  	var val = document.getElementsByName('slowo')[0].value;
  	val = checkAndEncodeSpecialSigns(val);  	
    if ( val != null && val != ""){   		
   		location.href = "http://szukaj.gazeta.pl/katalog/0,51443.html?slowo=" + val; 
   } else { 
   		location.href = "http://szukaj.gazeta.pl/katalog/0,0.html";   
   } 
}
function redirectArchiwum(){
  	var val = document.getElementsByName('slowo')[0].value;
  	val = checkAndEncodeSpecialSigns(val);  	
    if ( val != null && val != ""){   		
   	   location.href = "http://szukaj.gazeta.pl/archiwum/0,0.html?slowo=" + val; 
	} else { 
   		location.href = "http://szukaj.gazeta.pl/archiwum/0,0.html";
   		
   } 
}

