function openPopUp_520x390(href, target)
{
	window.open(href, target, 'width=520, height=390, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}
function openPopUp_600x450(href, target)
{
	window.open(href, target, 'width=800, height=600, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}
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 SymError()
{
	return true;
}
function commentBox(disp)
{
	document.getElementById("commentBox").style.display = disp;
	return false;
}
function deleteConfirm()
{
	var restart = confirm("Bu Kayıtı Silmek İstediğinizden Emin misiniz?");
	if(restart)
		return true;
	else
		return false;
}
function topicDelete(idx)
{
	if(deleteConfirm())
		window.location='forum_editor_action.php?processType=unpublishTopic&id=' + idx + '';
	return false;
}
function editConfirm()
{
	var restart = confirm("Bu Kayıtı Düzenlemek İstediğinizden Emin misiniz?");
	if(restart)
		return true;
	else
		return false;
}
function topicEdit(idx)
{
	if(editConfirm())
		window.location='forum_topic_edit.php?id=' + idx + '';
	return false;
}
function postDelete(idx)
{
	if(deleteConfirm())
		window.location='forum_editor_action.php?processType=unpublishPost&id=' + idx + '';
	return false;
}
function authorChange(author_id, seo_link, article_id, _title, _date, gazette)
{
	document.all["author_img"].src = 'images/author/' + author_id + "_s.jpg";
	document.all["author_article_title"].innerHTML = '<a href="' + seo_link + '">' + _title + "</a>";
	document.all["author_article_date"].innerHTML = _date;
	document.all["author_article_gazette"].innerHTML = gazette;
}
function authorSelectChanged(authorId)
{
	if(authorId != "")
		window.location = "author_article_detail.php?authorId=" + authorId;
	return false;
}

function mostlyPage(type, page)
{
    mostly_type = type;
	var xmlHttpReq = false;
    var self = this;
    var strURL = 'x_mostly.php?type=' + type + '&page=' + page;
    
    if (window.XMLHttpRequest)
    {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-javascript; charset=iso-8859-9');
    self.xmlHttpReq.onreadystatechange = function()
    {
        if (self.xmlHttpReq.readyState == 4)
        {
        	mostlyLoad(type, self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send('');
    return false;
}
function mostlyLoad(type, str)
{
	eval(str);
	document.getElementById("mostly_items_data").innerHTML = mostly_items;
	changeMostly(type, 0);
}

function changeMostly(type, idx)
{
	eval('elm = mostly_data_' + type);
	
	if(typeof(window['elm']) == "undefined")
		return;
	document.getElementById("mostly_image_" + type).src = './images/news/' + elm[idx]['image'] + '.jpg';
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );

	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" + escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
function Get_Cookie( name )
{
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 )
		return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 )
		end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
function Delete_Cookie( name, path, domain )
{
	if ( Get_Cookie( name ) )
		document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function changeSize(elm, _size, class_name)
{
	document.getElementById(elm).className = class_name + ' ' + class_name + '_' + _size;
	Set_Cookie('text_size', _size, 30, '', '', '');
}

function heightOptimizer()
{
	
	var _height = document.getElementById('base_middle').offsetHeight;	
	if(_height < document.getElementById('base_left').offsetHeight)
		_height = document.getElementById('base_left').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_left').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++)
	{
		if(tmp[i].href.indexOf(baseURL) == -1 || tmp[i].href.indexOf('http://') == -1)
			tmp[i].target = "_blank";
	}
}

function changeNewsDetail(idx)
{
	document.getElementById('news_spot').innerHTML = spotArr[idx];
	document.getElementById('news_headline').innerHTML = headlineArr[idx];
	if(previousItem != -1)
	{
		document.getElementById("news_img_" + previousItem).style.display = 'none';
	}
	document.getElementById("news_img_" + idx).style.display = 'block';
	previousItem = idx;
	return false;
}
					
function getHealineNews(page, count)
{
    
	var xmlHttpReq = false;
    var self = this;
    var strURL = 'x_headline.php?page=' + page + '&limit=' + count;
    
    if (window.XMLHttpRequest)
    {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-javascript; charset=iso-8859-9');
    self.xmlHttpReq.onreadystatechange = function()
    {
        if (self.xmlHttpReq.readyState == 4)
        {
        	headlinePageLoad(self.xmlHttpReq.responseText);
        	
        }
    }
    self.xmlHttpReq.send('');
    return false;
}

function headlinePageLoad(str)
{
	eval(str);
	document.getElementById('headline').innerHTML = headlineLINKS;
	document.getElementById('image_list').innerHTML = imgContent;
	changeNewsDetail(0);
}

function showSubMenu(n)
{
	var menu = document.getElementById('top_menu_' + n);
	menu.style.display = 'block';
}

function hideSubMenu(n)
{
	var menu = document.getElementById('top_menu_' + n);
	menu.style.display = 'none';
}

function getNewCategory(base)
{
	var seoObj = document.getElementById('seo_link');
	var seoIndex = seoObj.selectedIndex;
	var link = seoObj.options[seoIndex].value;

	var yearObj = document.getElementById('year');
	var yearIndex = yearObj.selectedIndex;
	var year = yearObj.options[yearIndex].value;

	document.location.href = base + link + "?year=" + year;
}