// Get Data from URL Parsing
function parseGet()
{
	var tmp, pattern1, pattern2, i, keyval = new Array(), e, _get = new Array();

	pattern1 = /\?/;
	if(!pattern1.test(location.href)) {
		return true;
	}

	tmp = location.href.replace(/^.*\?/, "");

	if(tmp == "") {
		return true;
	}

	tmp = tmp.split("&");

	pattern1 = /^([^=]+)=?(.*)$/;
	pattern2 = /^(.*)\[(\d*)\]$/;
	for(i = 0; i < tmp.length; i ++) {
		if(!pattern1.test(tmp[i])) {
			window.alert("error");
		}
		keyval[0] = RegExp.$1;
		keyval[1] = RegExp.$2;
		if(pattern2.test(keyval[0])) {
			if(RegExp.$2 == "") {
				try {
					_get[RegExp.$1].push(keyval[1]);
				} catch(e) {
					_get[RegExp.$1] = new Array();
					_get[RegExp.$1][0] = keyval[1];
				}
			} else {
				try {
					_get[RegExp.$1][RegExp.$2] = keyval[1];
				} catch(e) {
					_get[RegExp.$1] = new Array();
					_get[RegExp.$1][RegExp.$2] = keyval[1];
				}
			}
		} else {
			_get[keyval[0]] = keyval[1];
		}
	}

	return _get;
}
function compare(keyword)
{
	var values  = new Array();
		values  = location.href.split("/");
	var channel = "";

	for(i = 0; i < values.length; i ++)
	{
		channel = values[i];

		if( channel == "fashion" || channel == "collection" || channel == "beauty" || channel == "entertainment" || channel == "life" || channel == "sports" )
			break;
	}

	return channel;
}

// C1 C2 °ª °¡Á®¿À±â
function getChannel()
{
	var data    = new Array();
		data    = parseGet();
	var channel = new Array();

	// Ã¤³Î Á¤º¸ Ã¼Å©
	if( typeof(data['c1']) == "undefind" || typeof(data['c2']) == "undefind" )
		return channel;

	var c1 = trim(data['c1']);
	var c2 = trim(data['c2']);

	// Ã¤³Î Á¤º¸ Ã¼Å©
	if( c1 == "" || c2 == "" )
		return channel;

	channel[0] = c1;
	channel[1] = c2;

	return channel;
}

function makeGoogleAdSense()
{
	var str;

	var channel = new Array();
		channel = getChannel();

	// Ã¤³Î Á¤º¸ Ã¼Å©
	if( channel.length == 0 )
		return;

	var c1 = trim(channel[0]);
	var c2 = trim(channel[1]);

	// Ã¤³Î Á¤º¸ Ã¼Å©
	if( c1 == "" || c2 == "" )
		return;

	// 02 01 fashion hot trend
	// 02 02 fashion styling
	// 02 03 fashion brand news
	// 02 04 fashion luxury
	// 02 05 fashion people
	if( c1 == "02" )
		google_ad_slot = "1111773859";

	// beauty brand news
	// beauty hot trend
	// beauty styling
	// life e-life
	// entertainment culture
	if( ( ( c1 == "03" ) && ( c2 == "01" || c2 == "02" || c2 == "03" ) ) || ( c1 == "04" && c2 == "04" ) || ( c1 == "05" && c2 == "03" ) )
		google_ad_slot = "3715566599";

	// korea collection
	// life economy
	// life leisure
	// life love&sex
	// life wedding
	if( ( ( c1 == "05" ) && ( c2 == "01" || c2 == "02" || c2 == "04" || c2 == "05" ) ) || ( c1 == "01" && c2 == "01" ) )
		google_ad_slot = "6373156270";

	// entertainment movie
	// entertainment music
	// entertainment photo
	// entertainment tv
	// entertainment vod
	if( ( c1 == "04" ) && ( c2 == "01" || c2 == "02" || c2 == "04" || c2 == "05" ) )
		google_ad_slot = "7006887018";

	// world collection
	if( c1 == "01" && c2 == "02" )
		google_ad_slot = "7993980798";

	// sports golf
	if( c1 == "06" && c2 == "01" )
		google_ad_slot = "6764170523";
	// sports football
	if( c1 == "06" && c2 == "02" )
		google_ad_slot = "2071813023";
	// sports baseball
	if( c1 == "06" && c2 == "03" )
		google_ad_slot = "5496652719";
	// sports other
	if( c1 == "06" && c2 == "04" )
		google_ad_slot = "6760330803";


//	if( google_ad_slot != "" )
//	{
//		document.write('<p style="margin:30 0 0 10">');
//		document.write('<sc' + 'ript ty' + 'pe="text/ja' + 'vascr' + 'ipt" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></scr' + 'ipt>');
//		document.write('</p>');
//	}
	
	if( google_ad_slot != "" )
	{
		document.write('<p style="margin:30 0 0 10">');
		document.write('<IFRAME id="googlead01" src="/inc/google/view.php?google_ad_slot=' + google_ad_slot + '&width=250&height=250" width="250" height="250" scrolling="no" frameborder="no" border="0"></IFRAME>');
		document.write('</p>');
	}
}
var google_ad_slot   = "";
var google_ad_client = "pub-9859145890131496";
var google_ad_width  = 250;
var google_ad_height = 250;



makeGoogleAdSense();



//google_ad_slot = "4636622928";

