                var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}
// GAZETE
function goGazette(idx)
{
 if(idx == "")
 return false;

 window.open("get_gazete.php?type=" + idx, "", "");
 return true;
}
function CattabsBox(div, id, val) { 

  http.open("GET", "gk.php?cid="+id+"&start="+val, true);  
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById(div).innerHTML = http.responseText;
    }
  }
  http.send(null);
  
}
function CatokuBox(div, id, val) { 

  http.open("GET", "gk.php?cid="+id+"&start="+val, true);  
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById(div).innerHTML = http.responseText;
    }
  }
  http.send(null);
  
}
function CatkitapBox(div, id, val) { 

  http.open("GET", "get_oku.php?cid="+id+"&start="+val, true);  
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById(div).innerHTML = http.responseText;
    }
  }
  http.send(null);
  
}
function CatBox(div, id, val) { 

  http.open("GET", "get_oku.php?cid="+id+"&start="+val, true);  
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById(div).innerHTML = http.responseText;
    }
  }
  http.send(null);
  
}
/* Manşet Göster */

function getCuff(index)
	{
		var n = 13;
		for(i=0 ; i<n ; i++)
		{
			
			if(i == index)
			{
				menuid="title"+i;
				document.getElementById(menuid).style.display = "block";
				menuid="image"+i;
				document.getElementById(menuid).style.display = "block";
				menuid="spot"+i;
				document.getElementById(menuid).style.display = "block";
			}
			else
			{
				menuid="title"+i;
				document.getElementById(menuid).style.display = "none";
				menuid="image"+i;
				document.getElementById(menuid).style.display = "none";
				menuid="spot"+i;
				document.getElementById(menuid).style.display = "none";
			}
		}
}

function textareaCounter(t, counterField, textLimit){ 
var textLength = t.value.length; 
var counterInput = document.getElementById(counterField); 
if(textLength > textLimit){ 
alert("En Fazla " + textLimit + " karakter girebilirsiniz."); 
t.value=t.value.substring(0,textLimit); 
} 
counterInput.value = (textLimit-parseInt(t.value.length)); 
}

/* 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 - 800) / 2;
	var wint = (screen.height - 450) / 2;
	window.open(href, target, 'width=800, 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 goNews(idx)
{
	return openPopUp('./news_detail.php?id=' + idx, '');
}

/**/

function goInterviews(idx)
{
	return openPopUp('./interview_detail.php?interview_id=' + idx, '');
}

/**/

function goAuthor(idx)
{
	return openPopUp('./author_article_detail.php?article_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(_WIDTH, _HEIGHT, _SRC)
{
	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="scale" value="1">');
	document.write('<embed 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>');
    
}
function SymError()
{
	return true;
}
function whichBrowser()
{
	var agt = navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1)
		return 'Opera';
	if (agt.indexOf("staroffice") != -1)
		return 'Star Office';
	if (agt.indexOf("webtv") != -1) 
		return 'WebTV';
	if (agt.indexOf("beonex") != -1)
		return 'Beonex';
	if (agt.indexOf("chimera") != -1)
		return 'Chimera';
	if (agt.indexOf("netpositive") != -1)
		return 'NetPositive';
	if (agt.indexOf("phoenix") != -1)
		return 'Phoenix';
	if (agt.indexOf("firefox") != -1)
		return 'Firefox';
	if (agt.indexOf("safari") != -1)
		return 'Safari';
	if (agt.indexOf("skipstone") != -1)
		return 'SkipStone';
	if (agt.indexOf("msie") != -1)
		return 'MSIE';
	if (agt.indexOf("netscape") != -1)
		return 'Netscape';
	if (agt.indexOf("mozilla/5.0") != -1)
		return 'Mozilla';
	if (agt.indexOf('\/') != -1)
	{
		if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') 
		{
			return navigator.userAgent.substr(0,agt.indexOf('\/'));
		}
		else
			return 'Netscape';
	}
	else if (agt.indexOf(' ') != -1)
		return navigator.userAgent.substr(0,agt.indexOf(' '));
	else
		return navigator.userAgent;
}

function changeMostlyTab(idx)
{
	if(idx == 1)
	{
		document.getElementById("mostly_readed").style.display = 'block';
		document.getElementById("mostly_commented").style.display = 'none';
	}
	else
	{
		document.getElementById("mostly_readed").style.display = 'none';
		document.getElementById("mostly_commented").style.display = 'block';
	}
}
function heightOptimizer()
{
	var _height = document.getElementById('base_middle').offsetHeight;
	
	if(_height < document.getElementById('base_right').offsetHeight)
		_height = document.getElementById('base_right').offsetHeight;
	
	document.getElementById('base').style.height = _height + "px";
	document.getElementById('base_middle').style.height = _height + "px";
	document.getElementById('base_right').style.height = _height + "px";
}
function changeTarget(elm)
{
	tmp = elm.getElementsByTagName("a");
	for(i=0; i<tmp.length; i++)
		tmp[i].target = "_blank";
}
function changeSize(elm, _size, class_name)
{
	document.getElementById(elm).className = class_name + ' ' + class_name + '_' + _size;
	Set_Cookie('text_size', _size, 30, '', '', '');
}

function changeHeadlineTab(idx)
{
	if(prevHeadlineTab == idx)
		return;
	
	document.getElementById('headline_nav').innerHTML = drawTopMenu(menuitem, idx);
	document.getElementById('headline_item_' + idx).style.display = 'block';
	if(prevHeadlineTab != "-1")
	{
		document.getElementById('headline_item_' + prevHeadlineTab).style.display = 'none';
	}
	prevHeadlineTab = idx;
}
function SymError()
{
	return true;
}


