function confirmUri(msg) {
	if(!msg) msg = 'Emin misiniz?';
	if(confirm(msg)) return true;
	else return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openwin(href, target) {
	window.open(href, target, 'width=535, height=400, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}

function showhide(element, show) {
	element = findObj(element);
	if(!element) return;
	if(show == true)
		element.style.display = 'block';
	else
		element.style.display = 'none';
}

function findObj(theObj, theDoc) {
	var p, i, foundObj;
	
	if(!theDoc) theDoc = document;
	if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0,p);
		}
		
	if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
	
	for (i=0; !foundObj && i < theDoc.forms.length; i++) 
		foundObj = theDoc.forms[i][theObj];
	for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
		foundObj = findObj(theObj,theDoc.layers[i].document);
	if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
	
	return foundObj;
}

function checkhaberform() {
	hata = '0';
	hatamsg = '';
	if (document.haberform.bolum_id.value == '0') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = "- Lütfen bir bölüm seçiniz.";
		hata = '1';
	}
	if (document.haberform.ust_baslik.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen üst başlığı giriniz.";
		hata = '1';
	}
	if (document.haberform.ana_baslik.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen ana başlığı giriniz.";
		hata = '1';
	}
	if (document.haberform.ozet.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen özeti giriniz.";
		hata = '1';
	}
/*	
	if (document.haberform.haber.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen haber metnini giriniz.";
		hata = '1';
	}
*/
	if (hata == '1') {
		alert(hatamsg);
		return false;
	}
	else
		return true;
}

function checkyaziform() {
	hata = '0';
	hatamsg = '';
	if (document.haberform.ana_baslik.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen ana başlığı giriniz.";
		hata = '1';
	}
	if (hata == '1') {
		alert(hatamsg);
		return false;
	}
	else
		return true;
}

function checkkullform() {
	hata = '0';
	hatamsg = '';
	if (document.haberform.bolum_id.value == '0') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = "- Lütfen bir bölüm seçiniz.";
		hata = '1';
	}
	if (document.haberform.ust_baslik.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen üst başlığı giriniz.";
		hata = '1';
	}
	if (document.haberform.ana_baslik.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen ana başlığı giriniz.";
		hata = '1';
	}
	if (document.haberform.ozet.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen özeti giriniz.";
		hata = '1';
	}
/*	
	if (document.haberform.haber.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen haber metnini giriniz.";
		hata = '1';
	}
*/
	if (hata == '1') {
		alert(hatamsg);
		return false;
	}
	else
		return true;
}

function checkyorumform() {
	hata = '0';
	hatamsg = '';
	if (document.formyorum.baslik.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = "- Lütfen bir başlık yazınız.";
		hata = '1';
	}
	if (document.formyorum.yorum.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen bir yorum yazınız.";
		hata = '1';
	}
	if (document.formyorum.yorum.value.length > 1000) {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Yazdığınız yorum 1000 karakteri geçemez.";
		hata = '1';
	}
	if (hata == '1') {
		alert(hatamsg);
		return false;
	}
	else
		return true;
}

function yorumcount() {
   var old = document.formyorum.yorum.value.length;
	var limit = 500;
   //alert(old);
	if (old > limit)
		document.getElementById("counttext").innerHTML = (old - limit)+' tane karakter silmelisiniz';
	else
		document.getElementById("counttext").innerHTML = (limit - old)+' karakter yazabilirsiniz';
}


function checkbolumform() {
	hata = '0';
	hatamsg = '';
	if (document.bolumform.bolum_adi.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = "- Lütfen bölüm adını giriniz.";
		hata = '1';
	}
	if (hata == '1') {
		alert(hatamsg);
		return false;
	}
	else
		return true;
}

function checkarkgonderform() {
	hata = '0';
	hatamsg = '';
	var kime = document.formarkgonder.kime.value;
	if (kime == '0' || kime.indexOf('@') == -1 || kime.indexOf('.') == -1) {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = "- Lütfen kime bölümüne bir email adresi yazınız.";
		hata = '1';
	}
	if (document.formarkgonder.mesaj.value == '') {
		if (hatamsg.length > 0 )
			hatamsg = hatamsg + "\n";
		hatamsg = hatamsg + "- Lütfen bir mesaj yazınız.";
		hata = '1';
	}
	if (hata == '1') {
		alert(hatamsg);
		return false;
	}
	else
		return true;
}

function foto1_arsiv_sil() {
	document.getElementById("sfoto1").innerHTML='&nbsp;';
	document.haberform.foto1_arsiv.value='';
    document.haberform.foto1_aciklama.disabled=false;
	document.haberform.foto1.disabled=false;
}

function font_size( trgt,sz ) {
	if (!document.getElementById) return
	var d = document,cEl = null,i,j,cTags;
	
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = sz;

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = sz; //szs[ sz ];
	}
}
