function urlencode(str) {
str = escape(str);
str = str.replace('+', '%2B');
str = str.replace('%20', '+');
str = str.replace('*', '%2A');
str = str.replace('/', '%2F');
str = str.replace('@', '%40');
return str;
}

function change_s1(){
 obj1 = document.getElementById('search1');
 obj2 = document.getElementById('search2');
 obj3 = document.getElementById('csearch');
 obj4 = document.getElementById('importt');
 obj4.name = "ACT";

 obj1.style.backgroundPosition = "0 17px";
 obj1.title = "site";

 obj2.style.backgroundPosition = "0 -8px";
 obj2.title = "";

 obj3.action = "index.php?/search/";
}

function change_s2(){
 obj1 = document.getElementById('search1');
 obj2 = document.getElementById('search2');
 obj3 = document.getElementById('csearch');
 obj4 = document.getElementById('keywords');
 obj5 = document.getElementById('importt');
 obj5.name = "ACT0";

 kw = obj4.value;
 kw = urlencode(kw);

 obj1.style.backgroundPosition = "0 -8px";
 obj1.title = "";

 obj2.style.backgroundPosition = "0 17px";
 obj2.title = "web";

 obj3.action = "index.php?/search/google/"+kw;
}

function change_s3(){
 obj1 = document.getElementById('search1');
 obj2 = document.getElementById('search2');
 obj3 = document.getElementById('csearch');
 obj4 = document.getElementById('keywords');

 kw = obj4.value;
 kw = urlencode(kw);

 if(obj2.title == "web"){
 obj3.action = "index.php?/search/google/"+kw;
 }

}

function more_btn_over(obj){
 obj.style.backgroundPosition="0px 0px";
}

function more_btn_out(obj){
 obj.style.backgroundPosition="45px 0px";
}

function show_hide(btn,divid,btnid){

obj = document.getElementById(divid);
obj2 = document.getElementById(btnid);
display = obj.style.display;

if(display=="none"){
 obj.style.display = "block";
 btn.style.display = "none";
 obj2.style.display = "block";
}
else{
 obj.style.display = "none";
 btn.style.display = "none";
 obj2.style.display = "block";
}
}


function pagination_over(obj){
 obj.style.backgroundPosition="0px 0px";
 obj.style.color="#a32d1b";
}

function pagination_out(obj){
 obj.style.backgroundPosition="15px 0px";
 obj.style.color="white";
}


function pagnum_over(obj){obj.style.color="#a32d1b";}

function pagnum_out(obj){obj.style.color="white";}


function mc_over(obj){
 obj.style.backgroundPosition="0px 0px";
}

function mc_out(obj){
 obj.style.backgroundPosition="171px 0px";
}

function cityCo(city,country){
 stroka = city + ", " + country;
 if(stroka.length>21){document.write(city);}
 else{document.write(stroka);}}

function cutIt(summary,num){
		 if(summary.length>num){
		 		summary = summary.substr(0,num);		 	 
		 	 	sLength = summary.length
		 		var i = 0;
		 
		 		while(i<sLength){
		   		 i++;
				 symbol=summary.substr((sLength-i-1),1)					  
		 		 if(symbol==' '){
				     position = sLength - i;
					 	i = sLength;				 		
				 }			
		 		}
				newSumm = summary.substr(0,position);
				document.write(newSumm+"...");
			}
		    else{document.write(summary);}
		 
}






