function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}


function gonder(){

	var k_dil  					= trim(document.form1.k_dil.options[document.form1.k_dil.selectedIndex].text);
	var h_dil  					= trim(document.form1.h_dil.options[document.form1.h_dil.selectedIndex].text);
	var ceviri_tipi  			= trim(document.form1.ceviri_tipi.options[document.form1.ceviri_tipi.selectedIndex].text);
	var ceviri_suresi  			= trim(document.form1.ceviri_suresi.options[document.form1.ceviri_suresi.selectedIndex].text);
	var metin  					= trim(document.form1.metin.value);
	
	var isim 					= trim(document.form1.isim.value);
	var telefon 				= trim(document.form1.telefon.value);
	var mail					= trim(document.form1.mail.value);
	var firma 					= trim(document.form1.firma .value);
	var toplam_miktar 			= trim(document.form1.toplam_miktar.value);
	
	if(k_dil.length==0 || h_dil.length==0 || ceviri_tipi.length==0 || ceviri_suresi==0 || metin.length==0 || isim.length==0 || 
		telefon.length==0 || mail.length==0 || toplam_miktar ==0     )
		
			alert('Lütfen gerekli alanlari doldurunuz!');
	
	else{
	

		
		document.form1.k_dil2.value 			= trim(document.form1.k_dil.options[document.form1.k_dil.selectedIndex].text);
		document.form1.h_dil2.value 			= trim(document.form1.h_dil.options[document.form1.h_dil.selectedIndex].text);
		document.form1.ceviri_tipi2.value 		= trim(document.form1.ceviri_tipi.options[document.form1.ceviri_tipi.selectedIndex].text);
		document.form1.ceviri_suresi2.value 	= trim(document.form1.ceviri_suresi.options[document.form1.ceviri_suresi.selectedIndex].text);
		
		
		document.form1.action = 'default.asp?action=yolla';
		document.form1.submit();
		
	}

}



function aktifet(){
	
	document.getElementById("fiyat_buton").disabled = false;
	document.getElementById('div1').style.display = 'none'; 
	document.getElementById('bilgilendirme').style.display = 'none'; 
	
}

	
function hesap(){
	
	kaynak_dil 		= document.form1.k_dil.value;
	hedef_dil 		= document.form1.h_dil.value;
	ceviri_tipi		= document.form1.ceviri_tipi.value;
	ceviri_suresi 	= document.form1.ceviri_suresi.value;
		
	temp = document.form1.metin.value.replace(/ /g,"");
	temp = temp.replace(/\n/g,"");
	temp = temp.replace(/\r/g,"");
	temp = temp.replace(/\t/g,"");
		

	ln = temp.length;
		
		
		if(kaynak_dil == "0"){
			alert('Lütfen kaynak dil seçiniz!');
		}
		else if(hedef_dil == "0"){
			alert('Lütfen hedef dil seçiniz!');
		}
		else if(hedef_dil == kaynak_dil){
			alert('Hedef dil ve kaynak dil ayni olamaz!');
		}
		else if(kaynak_dil != "-1" && hedef_dil != "-1"){
			alert('Kaynak veya hedef dilden en az birisi Türkçe olmali!');
		}
		
		
		else if(ceviri_tipi == "0"){
			alert('Lütfen çeviri tipini seçiniz');
		}
		else if(ceviri_suresi == "0"){
			alert('Lütfen çeviri süresini seçiniz');
		}
		else if(ln<600){
			alert('En az 600 karakter giriniz!');
		}
		
		else{
			
			document.getElementById('ggg').style.display = 'block'; 
			document.getElementById('karakter').innerHTML = ln;
			
			fyt = -1 * Math.round(kaynak_dil * hedef_dil * ceviri_tipi * ceviri_suresi * ln / 1000);
			document.getElementById('fiyat').innerHTML = fyt;
			
			document.getElementById('div1').style.display = 'block'; 
			document.getElementById('kosullar').innerHTML = ''
			
			document.getElementById("fiyat_buton").disabled = true;
			
			//document.form1.odenecek_miktar.value = fyt/2 + ' TL';
			document.form1.toplam_miktar.value = fyt + ' TL';
			//document.getElementById('mktr').innerHTML = fyt/2;
		}
}