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);
}

/* Manşet Göster */

function getCuff(index)
	{
		var n = 10;
		for(i=0 ; i<n ; i++)
		{
			
			if(i == index)
			{
				menuid="image"+i;
				document.getElementById(menuid).style.display = "block";
			}
			else
			{
				menuid="image"+i;
				document.getElementById(menuid).style.display = "none";
				}
		}
}
_ZINDEX = 2000;
/* Banner Kodu */
function getBannerSWF(_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;
}

/* 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';
		}
	}
}


function getSWF(swWidth, swHeight, swFile, swWmode)
{
	var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width='+swWidth+'  height='+swHeight+'>';
	str += ' <param name="movie" value="'+swFile+'" /> ';
	str += ' <param name="quality" value="high" /> ';
	str += ' <param name="wmode" value="'+swWmode+'" /> ';
	str += ' <embed src='+swFile+' width='+swWidth+' height='+swHeight+' quality="high" pluginspage="http://www .macromedia.com/go/getflashplayer" type="application/x-shoc kwave-flash" wmode="transparent"></embed> ';
	str += ' </object> ';
	document.write(str);
}
function SymError()
{
	return true;
}

