/**/
var allMetas = document.all.tags('META');
var metaCont;
var locurl = location.href;

for (var i=0;i<allMetas.length;i++){
	if (allMetas[i].name && allMetas[i].name == "HITLOG"){
		metaCont = allMetas[i].content;
		break;
	}
}

if (metaCont != "") {
	var hitlogArticle = metaCont.split(';');
	if (hitlogArticle.length == 3) {
		var url = "http://hitweb.chosun.com/php/InMainData_SP.php?sitecode=" + hitlogArticle[0] + "&catcode=" + hitlogArticle[1] + "&artcode=" + hitlogArticle[2] + "&ref=" + escape(getURL(document.referrer)) + "&cur=" + escape(getURL(location.href));

		if (hitlogArticle[0] == "A1" || hitlogArticle[0] == "A2" || hitlogArticle[0] == "A3")
			url = "http://hitweb.chosun.com/php/InMainData_SP_2.php?sitecode=" + hitlogArticle[0] + "&catcode=" + hitlogArticle[1] + "&artcode=" + hitlogArticle[2] + "&ref=" + escape(getURL(document.referrer)) + "&cur=" + escape(getURL(location.href));

		(new Image).src = url;

		if (locurl.indexOf("site/data/html_dir") != -1 || locurl.indexOf("ViewArticle") != -1 || locurl.indexOf("/html/news/") != -1 || locurl.indexOf("ArticleView") != -1) {
			if (hitlogArticle[0] == "1" || hitlogArticle[0] == 1) {
				(new Image).src = "http://218.145.28.118/nullimage.php?id=" + hitlogArticle[2] + "&code=" + hitlogArticle[1];
			}	
			else if (getSiteCode(hitlogArticle[0]) != null) {
				(new Image).src = "http://hitlog2.chosun.com/hitlog?id=" + hitlogArticle[2] + "&code=" + getSiteCode(hitlogArticle[0]) + "&scode=" + hitlogArticle[1];
			}
			else {
				(new Image).src = "http://hitlog2.chosun.com/hitlog?id=" + hitlogArticle[2] + "&code=" + hitlogArticle[0] + "&scode=" + hitlogArticle[1];
			}
		} 
		else if (locurl == "http://www.chosun.com" || locurl == "http://news.chosun.com" || locurl == "http://www.chosun.com/" || locurl == "http://news.chosun.com/" || locurl == "http://www.chosun.com/index.html" || locurl == "http://news.chosun.com/index.html") {
			(new Image).src = "http://218.145.28.118/main_nullimage.php";
		}
	}
}

function getURL (str) {
	var domain = "http://";
	var delimiter = "/";
	var url = str;

	if (url.indexOf(domain) != -1) {
		url = str.substring(str.indexOf(domain)+domain.length, str.length);
	}
	if (url.indexOf(delimiter) != -1) {
		url = url.substring(0, url.indexOf(delimiter));
	}

	return url;
}

function getCookiesDz(name)
{
	var pcookie = document.cookie.split("; ");
	for (var i=0; i < pcookie.length; i++)
	{
		var values = pcookie[i].split("=");
		if (name == values[0])
			return unescape(values[1]);
	}
	return null;
}

function getSiteCode(siteid)
{
	if (siteid == "2")		return "kid";
	else if (siteid == "3")		return "books";
	else if (siteid == "4")		return "review";
	else if (siteid == "5")		return "photo";
	else if (siteid == "6")		return "bike";
	else if (siteid == "7")		return "issue";
	else if (siteid == "8")		return "health";
	else if (siteid == "10")	return "se";
	else if (siteid == "13")	return "weekly";
	else if (siteid == "16")	return "businesstv";
	else if (siteid == "17")	return "san";
	else if (siteid == "A1")	return "chn";
	else if (siteid == "A2")	return "chn";
	else if (siteid == "A3")	return "english";
	else if (siteid == "A19")	return "game";
	else if (siteid == "A20")	return "danmee";
	else if (siteid == "A30")	return "fishing";
	else if (siteid == "A34")	return "car";
	else return null;
}
/**/
