// JavaScript Document
function arama_temizle(geciciyazi)
{    
	var strtmp;
	var myresult;
	   strtmp=new String(geciciyazi);
		
        //***Türkçe karakter düzeltme***		
		myresult = replace(new String(strtmp),'<', ''); //küçüktür
		strtmp=myresult;
		
        myresult = replace(new String(strtmp),'>', ''); //büyüktür
		strtmp=myresult;
		
        myresult = replace(new String(strtmp),"'", ''); //tek tırnak
		strtmp=myresult;
		
        myresult = replace(new String(strtmp),"&", ''); //tek tırnak
		strtmp=myresult;
		
        myresult = replace(new String(strtmp),"&amp;", ''); //tek tırnak
		strtmp=myresult;
        
		myresult = replace(new String(strtmp),"%", ''); //tek tırnak
		strtmp=myresult;
		
		myresult = replace(new String(strtmp),"#", ''); //tek tırnak
		strtmp=myresult;
		
		//***Istenmeyen Karakter ayıklama***
        myresult = replace(new String(strtmp),String.fromCharCode(10), '');  //satır başı
		strtmp=myresult;
		
        myresult = replace(new String(strtmp),String.fromCharCode(34), '');  //çift tıarnak
		strtmp=myresult;
		
        myresult = replace(new String(strtmp),String.fromCharCode(13), ' '); //yeni satır

		strtmp=myresult;

        while( myresult.indexOf('  ') !=-1 ) //iki aralık
		{
			strtmp=myresult;
			
            myresult = replace(new String(strtmp), '  ', ' ');
		};
        
        strtmp = Trim(myresult); //önündeki sonundaki boşlukları da attık mı tamam

   return myresult;
}

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0,txtLength))) return string;
	if (i == -1) return string;

	var newstr = string.substring(0,i) + by;

	if (i+txtLength < strLength)
		newstr += replace(string.substring(i+txtLength,strLength),text,by);
   return newstr;
}

function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
		return "";
	}
	else{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function




























