function changeNewsDetail(idx)
{
	if(previousItem != -1)
	{
		document.getElementById("news_headline_" + previousItem).style.display = 'none';
	}
	document.getElementById("news_headline_" + idx).style.display = 'block';
	
	document.getElementById("news_image").src = './images/news/' + imageArr[idx] + '.jpg';
	document.getElementById("news_spot").innerHTML = "<a href=\"news_detail.php?id=" + idArr[idx] + "\">" + spotArr[idx] + "</a>";
	document.getElementById("news_link").href = "news_detail.php?id=" + idArr[idx];
	
	previousItem = idx;
	return false;
}
function authorChange(author_id, author_name, article_id, article_link, _title, _spot)
{
	document.getElementById("author_img").src = './images/author/' + author_id + "_s.jpg";
	document.getElementById("author_article_name").innerHTML = '<a href="' + article_link + '">' + author_name + "</a>";
	document.getElementById("author_article_title").innerHTML = '<a href="' + article_link + '">' + _title + "</a>";
}
function authorSelectChanged(authorId)
{
	if(authorId != "")
		window.location = "author_article_detail.php?authorId=" + authorId;
	return false;
}
function mostlyPage(type, page)
{
    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=UTF-8');
    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_" + type).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/110x84/' + elm[idx]['image'] + '.jpg';
	document.getElementById("mostly_title_" + type).innerHTML = '<a href="news_detail.php?id=' + idx + '">' + elm[idx]['title'] + '</a>';
	document.getElementById("mostly_short_content_" + type).innerHTML = "<a href=\"news_detail.php?id=" + idx + "\">" + elm[idx]['short_content'] + "</a>";
	document.getElementById("mostly_link_" + type).href = "news_detail.php?id=" + idx;
}