taglar = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[alinti]','[/alinti]','[sola]','[/sola]','[ortala]','[/ortala]','[saga]','[/saga]','[baslik1]','[/baslik1]','[baslik2]','[/baslik2]','[resim]','[/resim]','[url]','[/url]');

function stil(stilno) 
{
	var txtarea = document.formy.cevap;

	txtarea.focus();
	theSelection = false;
	
	theSelection = document.selection.createRange().text; 
	if (theSelection) 
	{
		document.selection.createRange().text = taglar[stilno] + theSelection + taglar[stilno+1];
		txtarea.focus();
		theSelection = '';
		return;
	}
}

function bbfontstyle(bbopen, bbclose) 
{
	theSelection = document.selection.createRange().text;
	if (!theSelection) 
	{
		document.formy.cevap.value += bbopen + bbclose;
		document.formy.cevap.focus();
		return;
	}
	document.selection.createRange().text = bbopen + theSelection + bbclose;
	document.formy.cevap.focus();
	return;
	}

function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

function pop()
{
	var popup =window.open("","pop",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=420,height=370');
}

function textCounter(field,cntfield,maxlimit) 
{
	if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit);
	else cntfield.value = maxlimit - field.value.length; 
}

function sorusorma_checkform( form )
{
	if (form.kategorik.value == "-1") 
	{
		alert( "You should select a category for your question");
		form.kategorik.focus();
		return false ;
	}
	if (form.konu.value == "")
	{
		alert("You should specify a title for your question.");
		form.konu.focus();
		return false ;
	}
	else if(form.soru.value == "" || form.soru.value.length < 6)
	{
		alert( "Question space is unfilled or your question is too short. Please correct.");
		form.soru.focus();
		return false ;
	}
	else if(form.soru_anahtar.value == "" || form.soru_anahtar.value.length < 3)
	{
		alert( "You should enter at least one keyword related to your question.");
		form.soru_anahtar.focus();
		return false ;
	}
	return true;
}

function uyelik_checkform( form )
{
if (form.sy_username.value == "") 
{
	alert( "You should fill in the user name space.");
	form.sy_username.focus();
	return false ;
}
else if(form.sy_username.value.length < 6 || form.sy_username.value.length > 20)
{
	alert( "Username entered should be between 6 and 20 characters.");
	form.sy_password1.focus();
	return false ;
}
if (form.sy_password1.value == "" || form.sy_password2.value == "") 
{
	alert( "You should fill in the password field.");
	form.sy_password1.focus();
	return false ;
}
else if(form.sy_password1.value.length < 6 || form.sy_password2.value.length > 20)
{
	alert( "Password entered should be between 6 and 20 characters");
	form.sy_password1.focus();
	return false ;
}
else if(form.sy_password1.value != form.sy_password2.value)
{
	alert( "Two passwords entered are different. Please try again");
	form.sy_password1.focus();
	return false ;
}
if (form.sy_name.value == "") 
{
	alert( "You should fill in the your name space");
	form.sy_name.focus();
	return false ;
}
if (form.sy_email.value == "") 
{
	alert( "You should fill in the your e-mail address field.");
	form.sy_email.focus();
	return false ;
}
if (form.sec_code.value == "") 
{
	alert( "You should enter the numbers given on the box in to the security code field.");
	form.sec_code.focus();
	return false ;
}
return true ;
}

function arama_checkform( form )
{
	if (form.aranan.value.length < 3) 
	{
		alert("The key word that you entered is too short");
		form.aranan.focus();
		return false;
	}
	if (form.kat_k.checked == false && form.kat_t.checked == false && form.kat_l.checked == false && form.kat_i.checked == false && form.kat_m.checked == false && form.kat_u.checked == false) 
	{
		alert("You should select a location for searching");
		form.kat_k.checked = true;
		return false ;
	}
	return true ;
}

function contact_checkform( form )
{
	if (form.contact_isim.value.length < 3) 
	{
		alert("You should fill in the your name space");
		form.contact_isim.focus();
		return false;
	}
	if (form.contact_eposta.value.length < 3) 
	{
		alert("You should fill in the your e-mail address field");
		form.contact_eposta.focus();
		return false;
	}
	if (form.contact_konu.value.length < 3) 
	{
		alert("You should fill in the topic field");
		form.contact_konu.focus();
		return false;
	}
	if (form.contact_mesaj.value.length < 3) 
	{
		alert("You should fill in the your message space");
		form.contact_mesaj.focus();
		return false;
	}
	if (form.sec_code.value == "") 
	{
		alert( "You should enter the numbers given on the box into the security code field.");
		form.sec_code.focus();
		return false ;
	}
	return true ;
}

function advice_checkform( form )
{
	if (form.kullanici_isim.value.length < 3) 
	{
		alert("You should fill in the your name space.");
		form.kullanici_isim.focus();
		return false;
	}
	if (form.kullanici_eposta.value.length < 3) 
	{
		alert("You should fill in the your e-mail address field");
		form.kullanici_eposta.focus();
		return false;
	}
	if (form.adresler.value.length < 3) 
	{
		alert("You should fill in the e-mails you want to advice us to field");
		form.adresler.focus();
		return false;
	}
	if (form.ozelnot.value.length < 3) 
	{
		alert("You didn’t write your comment");
		form.ozelnot.focus();
		return false;
	}
	if (form.sec_code.value == "") 
	{
		alert( "You should enter the numbers given on the box into the security code field.");
		form.sec_code.focus();
		return false ;
	}
	return true ;
}

function changeSize(elm, _size, class_name)
{
	document.getElementById(elm).className = class_name + ' ' + class_name + '_' + _size;
	Set_Cookie('text_size', _size, 30, '', '', '');
}