var user_agent = navigator.userAgent;
var isOpera = user_agent.indexOf("Opera") >= 0;
var isFirefox = user_agent.indexOf("Firefox") >= 0;
var isWin32up = user_agent.indexOf("Win32") >= 0 
	|| user_agent.indexOf("Win64") >= 0
	|| user_agent.indexOf("Windows NT") >= 0;

var isIE = !isOpera && user_agent.indexOf("MSIE") >= 0;
var isIE55up = isIE && isWin32up && user_agent.match(/MSIE ((5\.5)|[6789])/);
var isIE70up = isIE && isWin32up && user_agent.match(/MSIE ([789])/);
var isIE55dn = isIE && !isIE55up;
var browser = "other";


/* Site Ana Sayfam Yap & Favorilerime Ekle */
function add2Favorites(ths, url, title) {
	if (isIE && window.external != null) {
		window.external.AddFavorite(url,title);
	} else if (isFirefox && window.sidebar && window.sidebar.addPanel) {
		window.sidebar.addPanel(title, url, '');
	} else if (isOpera) {
		ths.rel = "sidebar";
		ths.title = title
		ths.href = url;
	}
}

function setHomePage2(ths, url) {
	ths.style.behavior='url(#default#homepage)';
	ths.setHomePage(url);
}

var i=0;
var eskiNo=0;
var tmp=0;
var mDegisim = "";

function degisimTemizle(){
	clearInterval(mDegisim);
}
function degisimGit() {
	mDegisim = setInterval('mansetDegistir(+1)',6000);
}

function mansetGoster(no)
{
	menuid="image"+eskiNo;
	document.getElementById(menuid).style.display = "none";
	menuid="spot"+eskiNo;
	document.getElementById(menuid).style.display = "none";
	
	menuid="image"+no;
	document.getElementById(menuid).style.display = "block";
	menuid="spot"+no;
	document.getElementById(menuid).style.display = "block";
	
	document.getElementById("mansetno"+eskiNo+"").className="numbers";
    document.getElementById("mansetno"+no+"").className="numbers2";
	
    eskiNo = no;
	
    clearInterval(mDegisim);
}

function mansetGoster2(no)
{
	clearInterval(mDegisim);
	mDegisim = setInterval('mansetDegistir(+1)',6000);
}

function mansetDegistir(no)
{
    clearInterval(mDegisim);
    no = eskiNo + no;
    
	if(no > 9) no = 0;
    if(no < 0) no = 9;
    
	menuid="image"+eskiNo;
	document.getElementById(menuid).style.display = "none";
	menuid="spot"+eskiNo;
	document.getElementById(menuid).style.display = "none";
	
	menuid="image"+no;
	document.getElementById(menuid).style.display = "block";
	menuid="spot"+no;
	document.getElementById(menuid).style.display = "block";
	
	document.getElementById("mansetno"+eskiNo+"").className="numbers";
    document.getElementById("mansetno"+no+"").className="numbers2";
    
	eskiNo = no;
   	
	mDegisim = setInterval('mansetDegistir(+1)',6000);
    
}

/* Textarea Yazı Limiti */
function validateLength(el, word_left_field, len)
{
	document.all[word_left_field].value = len - el.value.length;
	if(document.all[word_left_field].value < 1)
	{
		alert("En Fazla " + len + " karakter girebilirsiniz.");
		el.value = el.value.substr(0, len);
		document.all[word_left_field].value = 0;
		return false;
	}
	return true;
}

/* Yazı Boyutu Değiştir */
function changeSize(elm, _size, class_name)
{
	document.getElementById(elm).className = class_name + ' ' + class_name + '_' + _size;
}

function changeTarget(elm)
{
	tmp = elm.getElementsByTagName("a");
	for(i=0; i<tmp.length; i++)
		tmp[i].target = "_blank";
}

function openPopUp_520x390(href, target)
{
	var winl = (screen.width - 520) / 2;
	var wint = (screen.height - 390) / 2;
	window.open(href, target, 'width=520, height=390, top=' + wint + ', left=' + winl + ', toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}

function openPopUp(href, target)
{
	var winl = (screen.width - 600) / 2;
	var wint = (screen.height - 450) / 2;
	window.open(href, target, 'width=600, height=450, top=' + wint + ', left=' + winl + ', toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}

function userPopup(href, target, width, height)
{
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	window.open(href, target, 'width = '+width+', height=' + height +', top=' + wint + ',left=' + winl + ', toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}

function goPage(idx)
{
	return window.location = "./page_detail.php?page_id=" + idx;
}
function changeArticle(idx)
{
	return window.location = "./author_article_detail.php?article_id=" + idx;
}
function blinkIt()
{
	if(!document.all)
		return;
	else
	{
		for(i=0; i<document.all.tags('blink').length; i++)
		{
			s=document.all.tags('blink')[i];
			s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
		}
	}
}
_ZINDEX = 0;
function getSWF(_WIDTH, _HEIGHT, _SRC)
{
	document.write('<div style="width: ' + _WIDTH + '; height: ' + _HEIGHT + '; z-index: ' + _ZINDEX + ';">');
	document.write('<object width="' + _WIDTH + '" height="' + _HEIGHT + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">');
	document.write('<param name="movie" value="' + _SRC + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="opaque">');
	document.write('<param name="scale" value="1">');
	document.write('<embed style="z-index: ' + _ZINDEX + ';" src="' + _SRC + '" width="' + _WIDTH + '" height="' + _HEIGHT + '" scale="exactfit" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>');
	document.write('</object>');
	document.write('</div>');
	_ZINDEX += 1;
}

function SymError()
{
	return true;
}

function kHaber(_kid, _id, _baslik, _spot, _resim)
{
	document.getElementById('k_h_baslik'+_kid).innerHTML 	= ""+_baslik+"";
	document.getElementById('k_h_aciklama'+_kid).innerHTML 	= ""+_spot+"";
	document.getElementById('k_h_resim'+_kid).src 			= "images/news/"+_resim;
	document.getElementById('k_h_link'+_kid).href 			= "news_detail.php?id="+_id;
}