<!--

var gg_sid = function(_sid)
{
	try {
		$('sidFrame').contentWindow.location.replace('/api/stamping.php?code=' + encodeURI(_sid));
	}
	catch (e) {
		notify('sid - ' + e.name + ':' + e.message+' : ' + _sid);
	}
};

var gg_rd = function(sRd, sPath, sTarget)
{
	try {
		var sURL = 'http://kr.rd.yahoo.com/globalgugi/' + sRd + '/*' + sPath ;
		if(typeof sTarget == 'string' && sTarget.length > 0) {
			window.open(sURL, sTarget);
		} else {
			document.location.href = sURL;
		}
	}
	catch(e) {
		notify(sRd + ' - ' + sPath + ' - ' + sTarget);
	}
};

var goRandomPoi = function()
{
	try {
		sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/search/hotkeyword/*';
		document.location.href = sRdUrl + GlobalGugiURL + '/RandomPoi/index/';
	}
	catch(e) {
		notify('goRandomPoi');
	}
};

var searchLocation = function(woeid, sType)
{
	switch(sType) {
	    case 'search':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/search/result/*';
	    	break;
	    case 'main_tooltip':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/main/tooltip/*';
	    	break;
	    case 'locationmain_tooltip':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/locationMain/tooltip_hierachy/*';
	    	break;
	    case 'main_yah_hierachy':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/main/yah_hierachy/*';
	    	break;
	    case 'locationmain_yah_hierachy':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/locationMain/yah_hierachy/*';
	    	break;
	    case 'detail_yah_hierachy':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/detail/yah_hierachy/*';
	    	break;
	    case 'mapsearch_yah_hierachy':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/mapSearch/yah_hierachy/*';
	    	break;
	    case 'directory':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/main/directory/*';
	    	break;
	    case 'hotkeyword':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/search/hotkeyword/*';
	    	break;
	    case 'top_locationMain':
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/detail/top_locationMain/*';
	    	break;
	    case 'main_image':// if rd address by sblee 
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/main/event/image/*';
	    	break;
	    case 'main_text':// if rd address by sblee 
	    	sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/main/event/text/*';
	    	break;
	    
	    default:
			sRdUrl = '';	    	
	    	notify("Message: sRdUrl is not exists!");
	    	break;
	}
	
	try {
		document.location.href = sRdUrl + GlobalGugiURL + "/LocationMain/index/"+woeid;
	} catch(e) {
		notify("location:" + e.name + ":" + e.message);
	} 
};

var searchContents = function(woeid, tab, query)
{
	try {
		switch(tab) {
			case 'Weather':
				sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/locationMain/yah_weather/*';
				break;
			case 'Info':
				sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/locationMain/tooltip_detail/*';
				break;
			case 'btm_info':
				sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/locationMain/btm_info/*';
				tab    = 'Info';
				break;
			case 'btm_photo':
				sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/locationMain/btm_picture/*';
				tab    = 'Photo';
				break;
			case 'Info_wide':
				sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/detail/info_wide/*';
				tab    = 'Info';
				break;
			case 'srchBox_morePic':
				sRdUrl = 'http://kr.rd.yahoo.com/globalgugi/mapSearch/srchBox_morePic/*';
				tab    = 'Photo';
				break;
			
			default:
				sRdUrl = '';
				notify("Message: sRdUrl is not exists!");
				break;
		}
		
		var url = sRdUrl + GlobalGugiURL + '/Contents/index/' + woeid + '/' + tab;
		if(query != '') {
			url += '/'+ encodeURI(query);
		}
		document.location.href = url;
	} catch(e) {
		notify('contents:' + e.name + ':' + e.message);
	}
};

var searchMap = function(woeid, query, sRD)
{
	var url = '';
	try {
		url = GlobalGugiURL + '/MapSearch/index/'+woeid;
		if(query != '') {
			url += '/'+ encodeURI(query);
		}
		
		if(typeof sRD == 'string' && sRD.length > 0) {
			switch(sRD) {
				case 'locationmain_mapsearch':
					url = 'http://kr.rd.yahoo.com/globalgugi/locationMain/btm_mapSearch/*' + url;
					break;
				case 'locationmain_mapsearch_ex':
					url = 'http://kr.rd.yahoo.com/globalgugi/locationMain/btm_mapSearch_ex/*' + url;
					break;
				case 'top_mapSearch':
					url = 'http://kr.rd.yahoo.com/globalgugi/detail/top_mapSearch/*' + url;
					break;
				case 'picSrch_mapSrch':
					url = 'http://kr.rd.yahoo.com/globalgugi/detail/picSrch_mapSrch/*' + url;
					break;
				case 'srchBox_ex':
					url = 'http://kr.rd.yahoo.com/globalgugi/mapSearch/srchBox_ex/*' + url;
					break;
				case 'srchBox_wide':
					url = 'http://kr.rd.yahoo.com/globalgugi/mapSearch/srchBox_wide/*' + url;
					break;

				default:
					break;
			}
		}
		
		document.location.href = url;		
	} catch(e) {
		notify("location:" + e.name + ":" + e.message);
	} 
};

var closeDetail = function()
{
	try {
		searchLocation(MODULE_INI.sWoeid, 'top_locationMain');
	} catch(e) {
		notify("closeDetail:" + e.name + ":" + e.message);
	} 
};

var fnRssFeed = function(woeid, str)
{
	try {
		window.open(GlobalGugiModURL + "/api/?c=ApiGeoRSS&m=" + str + "&woeid=" + woeid, "_blank");
	} catch(e) {
		notify("RssFeed Popup:" + e.name + ":" + e.message);
	}
};

var fnCheckSubmitMapSearch = function()
{
	searchMap(MODULE_INI.sWoeid, document.getElementById('lmd_map_input').value, 'locationmain_mapsearch');
	return false;
};

var goWeatherPerMonth = function()
{
	try{
		var url = "http://kr.rd.yahoo.com/globalgugi/detail/weather_monAvg/*http://weather.yahoo.com/climo/"+MODULE_INI.sWeatherCode+"_c.html";

		var newWin = window.open(url, '_blank');
		newWin.focus();
	} catch(e) {
		   notify("goWeatherPerMonth:" + e.name + ":" + e.message);
	}
};	

var goWeatherDetail = function()
{
	try{
		var url = "http://kr.rd.yahoo.com/globalgugi/detail/weather_detail/*http://weather.yahoo.com/forecast/"+ MODULE_INI.sWeatherCode+".html#text";
		
		var newWin = window.open(url, '_blank');
		newWin.focus();
	} catch(e) {
		   notify("goWeatherDetail:" + e.name + ":" + e.message);
	}	
};

var goWeatherAfter6 = function()
{
	try{
		//var url = 'http://kr.rd.yahoo.com/globalgugi/detail/weather_sixday/*http://www.weather.com/outlook/travel/businesstraveler/extended/'+MODULE_INI.sWeatherCode;
		var url = 'http://www.weather.com/outlook/travel/businesstraveler/extended/'+MODULE_INI.sWeatherCode;
		
		var newWin = window.open(url, '_blank');
		newWin.focus();
	} catch(e) {
		   notify("goWeatherAfter6:" + e.name + ":" + e.message);
	}	
};

var fnSosError = function()
{
	var _li = document.createElement('li')
	$('yf').getElementsByTagName('ul')[0].appendChild(_li);
	_li.innerHTML = '<a href="https://bugzilla.seoul.corp.yahoo.com//enter_bug.cgi?product=Internal_GlobalGugi" target="_blank">긴급오류신고</a>';
	$('yf').getElementsByTagName('ul')[0].getElementsByTagName('li')[2].className = '';
	$('yf').getElementsByTagName('ul')[0].getElementsByTagName('li')[3].className = 'x';
};

//-->