function sifredegistir() {
	document.getElementById("sifdeg1").style.display = "none";
	document.getElementById("sifdeg0").style.display = "block";
}

function giris_un_focus() {
}

function giris_un_blur() {
}

function giris_pw_focus() {
}

function giris_pw_blur() {
}

function guvenlikKoduYenile() {
	document.getElementById("captcha").src = 'captcha.php?a=' + Math.random();
}

function doGetCaretPosition(ctrl) {
	var CaretPos = 0;
	if (document.selection) {
		ctrl.focus ();
		var Sel = document.selection.createRange ();
		Sel.moveStart ('character', -ctrl.value.length);
		CaretPos = Sel.text.length;
	} else if (ctrl.selectionStart || ctrl.selectionStart == '0') {
		CaretPos = ctrl.selectionStart;
	}
	return (CaretPos);
}

function setCaretPosition(ctrl, pos) {
	if(ctrl.setSelectionRange) {
		ctrl.focus();
		ctrl.setSelectionRange(pos,pos);
	} else if (ctrl.createTextRange) {
		var range = ctrl.createTextRange();
		range.collapse(true);
		range.moveEnd('character', pos);
		range.moveStart('character', pos);
		range.select();
	}
}

function toolbarAction(act, item) {
	var textarea = document.getElementById(item);
	var userSelection;
	var caretPos = doGetCaretPosition(document.getElementById(item));
	var replace;
	if (window.getSelection) {
		textarea.focus();
		var len = textarea.value.length;
		var start = textarea.selectionStart;
		var end = textarea.selectionEnd;
		var sel = textarea.value.substring(start, end);
		replace = '['+act+']' + sel + '[/'+act+']';
		// Here we are replacing the selected text with this one
		textarea.value =  textarea.value.substring(0,start) + replace + textarea.value.substring(end,len);
	} else if (document.selection) {
		textarea.focus();
		var sel = document.selection.createRange();
		replace = '['+act+']' + sel.text + '[/'+act+']';
		sel.text = '['+act+']' + sel.text + '[/'+act+']';
	}
	setCaretPosition(document.getElementById(item), caretPos + replace.length);
}
/*
function giris_un_focus() {
	if (document.getElementById("girisusername").value === 'kullanıcı adı') {
		document.getElementById("girisusername").value = '';
		document.getElementById("girisusername").style.color = 'black';
	}
}

function giris_un_blur() {
	if (document.getElementById("girisusername").value === '') {
		document.getElementById("girisusername").value = 'kullanıcı adı';
		document.getElementById("girisusername").style.color = '#aaaaaa';
	}
}

function giris_pw_focus() {
	if (document.getElementById("girispassword").value === 'şifre') {
		document.getElementById("girispassword").type = "password";
		document.getElementById("girispassword").value = '';
		document.getElementById("girispassword").style.color = 'black';
		//var input=document.getElementById("girispassword"); 
		//var input2= input.cloneNode(false); 
		//input2.type='password'; 
		//input.parentNode.replaceChild(input2,input);
	}
}

function giris_pw_blur() {
	if (document.getElementById("girispassword").value === '') {
		document.getElementById("girispassword").type = "text";
		document.getElementById("girispassword").value = 'şifre';
		document.getElementById("girispassword").style.color = '#aaaaaa';
	}
}
*/

