//****************************************************************************
// ÀÌ¹ÌÁö ¸®»çÀÌÁî
// ***************************************************************************
function resizeImage()
{
	var obj = document.getElementsByName("resizeImg");
	for(i=0;i<obj.length;i++)
		if(obj[i].width>650) obj[i].width=645;
}

//****************************************************************************
// Å¬¸³º¸µå º¹»ç
// ***************************************************************************
function setClip(clipText)
{
	window.clipboardData.setData('Text', clipText);
}

//****************************************************************************
// Æ¯Á¤¿µ¿ª Å¬¸³º¸µå º¹»ç ¹× ÃâÃ³ »ðÀÔ
// ***************************************************************************
function setCopyright()
{
	if(window.event) {
		window.event.returnValue = true;
		window.setTimeout('attachClip()',30);
	}
}

function attachClip()
{
	if(window.clipboardData) {
		var txt = document.selection.createRange().htmlText;//window.clipboardData.getData('Text');
		txt = replace(txt,');" scrap','" target="_blank"');
		txt = replace(txt,'javascript:SpotOpen(','http://www.onfill.com/default.asp?spotId=');
		txt = replace(txt,'javascript:openSpot(','http://www.onfill.com/default.asp?spotId=');
		txt = txt + '\r\n\r\n<a href="'+document.location.href+'" target="_blank"><img src="http://img.onfill.com/ver2/images/common/scrapcopy02.png" border="0"></a>';
		var result = window.clipboardData.setData('Text',txt);
	}
}

//****************************************************************************
// Char c°¡ ¿µ¹®ÀÚ ÀÎÁö Ã¼Å©
// RETURN : true/false
// ***************************************************************************
function isLetterChar(c)
{
	return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}

//****************************************************************************
// Char c°¡ ¼ýÀÚ ÀÎÁö Ã¼Å©
// RETURN : true/false
// ***************************************************************************
function isDigitChar(c)
{
	return ((c >= "0") && (c <= "9"))
}
//****************************************************************************
// Char  C°¡ whitechar ÀÎÁö Ã¼Å©
//****************************************************************************
function isWhiteChar(c)
{
	 return (c == ' ' || c == '\t' || c == '\n' || c == '\r')
}
//****************************************************************************
//* char ch °¡ ÇÑ±ÛÀÎÁö  Ã¼Å©
// RETURN : true/false
//****************************************************************************
function isKoreanChar( ch )
{
	var chStr = escape(ch); //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ
	if (chStr.length < 2)
		return false;

	//ÇÑ±Û ==> %uAC00 ~ %uD7A3
	if (chStr.substring(0, 2) == '%u')
	{
			if (chStr.substring(2,4) == '00')
					return false;
			else
					return true;         //ÇÑ±Û
	}
	else if (chStr.substring(0,1) == '%')
	{
			if (parseInt(chStr.substring(1,3), 16) > 127)
					return true;        //ÇÑ±Û
			else
					return false;
	}
	else
			return false;
}

//************************************************
// str ÀÌ °ø¹éÀÌ³ª NULL ÀÌ¸é TRUE ¾Æ´Ï¸é FALSE  *
//************************************************
function isEmpty(str) {
	if( str != null )
	{
		for( i=0 ; i < str.length ; i++)
		{
			if( !isWhiteChar( str.charAt(i) ) )
				return false;
		}
	}
	return ((str == null) || (str.length == 0));
}

//****************************************************************************
// str ÀÌ °ø¹éÀÌ³ª ÅÜ , ¸®ÅÏ ¹®ÀÚµé·Î ½ÇÁ¦¹®ÀÚ°¡ ¾øÀ»°æ¿ì TRUE ¾Æ´Ï¸é FALSE *
//****************************************************************************
function isWhitespace (str) {
	var whitespace = " \t\n\r";
	var i;
	if (isEmpty(str)) {
		return true;
	}
	for (i = 0; i < str.length; i++) {
		var chr = str.charAt(i);
		if (whitespace.indexOf(chr) == -1) {
			return false;
		}
	}
	return true;
}

//responseText -> responseXml (FFX Áö¿ø¿ë)
function parse_xml(req) {
	try {
		return (new DOMParser()).parseFromString(req.responseText, "text/xml");
	}
	catch(e) {
		return req.responseXML;
	}
}

//nodeTypeValue, nodeValue -> text (FFX Áö¿ø¿ë)
function getText(el) {
	var text = "";

	if (el != null) {
		if (el.childNodes) {

			for (var i = 0; i < el.childNodes.length; i++) {
				var childNode = el.childNodes[i];

				if (childNode.nodeValue != null) {
					text = text + childNode.nodeValue;
				}
			}
		}
	}

	return text;
}

// ÆÄ¶ó¹ÌÅÍ ±¸ÇÏ±â
function fnGetQueryString(param)
{
	var location_querystring = (location.search).toLowerCase();
	var location_param, location_query, result_value = {};
	location_querystring = location_querystring.slice(1);
	location_param = location_querystring.split("&");

	for(var i=0; i<location_param.length; i++)
	{
		location_query = location_param[i].split("=");
		result_value[location_query[0]] = location_query[1];
	}

	if(result_value[param] != null)
	{
		return result_value[param];
	}
	else
	{
		return '';
	}
}

// ¹®ÀÚ¿­ Å©±â
function bytelen(s){
	var len = 0;
	if ( s == null ) {return 0;}
	for( i = 0; i < s.length; i++) {
		c = escape(s.charAt(i));
		if ( c.length == 1 ) len ++;
		else if ( c.indexOf("%u") != -1 ) len += 2;
		else if ( c.indexOf("%")  != -1 ) len += c.length/3;
	}
	return len;
}

// »çÀÌÄ¡È¯ ÇÔ¼ö
function GetStrReplace(sTxt,startText,endText,replaceText)
{
	var iLoc1 = sTxt.indexOf(startText);
	if(iLoc1 < 0)
		return sTxt;

	var	sTmp1 = sTxt.substring( 0,iLoc1 + startText.length);
	var	sTmp2 = sTxt.substring(iLoc1+startText.length );

	var	iCnt = sTmp2.indexOf(endText);
	if(iCnt < 0 )
		return sTxt;

	var	sTmp3 = sTmp2.substring(iCnt);
	var	sTmp2 = sTmp2.substring(0,iCnt);
	return sTmp1 + replaceText + sTmp3;
}

// »çÀÌ¹ÝÈ¯ ÇÔ¼ö
function GetStrBetween(sTxt,sStartTag,sEndTag)
{
	var iLoc1 = sTxt.indexOf(sStartTag);
	var iLoc2 = sTxt.indexOf(sEndTag);
	return sTxt.substring(iLoc1,iLoc2-iLoc1+1);
}

// ÁÂÃø°ø¹é Á¦°Å
function Ltrim(strValue)
{
	while (strValue.length>0)
	{
		if(strValue.charAt(0)==" ")
			strValue=strValue.substring(1,strValue.length);
		else
			return strValue;
	}

	return strValue;
}

// ¿ìÃø°ø¹é Á¦°Å
function Rtrim(strValue)
{
	while (strValue.length>0)
	{
		if(strValue.charAt(strValue.length-1)==" ")
			strValue=strValue.substring(0,strValue.length-1);
		else
			return strValue;
	}
	return strValue;
}

// °ø¹é Á¦°Å
function Trim(strValue)
{
   strValue = Ltrim(strValue);
   strValue = Rtrim(strValue);
   return strValue;
}

// Replace
function replace(str,otxt,rtxt)
{
	if(otxt==rtxt) return str;
	while(str.indexOf(otxt)>0)
	{
		str = str.replace(otxt,rtxt);
	}
	return str;
}

function openWinUni(url, x, y, w, h, s, r, winname)
{
	/*
	width=screen.width;
	height=screen.height;
	x=(width/2)-(w/2);
	y=(height/2)-(h/2);
	*/

	opt = "left=" + x + ", top=" + y + ", width=" + w + ", height=" + h;
	opt = opt + ", toolbar=no,location=no,directories=no,status=no,menubar=no";
	opt = opt + ",scrollbars=" + s;
	opt = opt + ",resizable=" + r;
	objWin = window.open(url, winname, opt);
}

function openLayerLogin()
{
	loginWindow = dhtmlmodal.open('loginBox','iframe','/com/com/main/LayerLoginForm.asp','','width=324px,height=148px,center=1,resize=0,scrolling=0');
	loginWindow.onclose = function(){window.location.reload();return true;};
};


function openReport() {
	var ttl = arguments[0];
	var entityId = arguments[1];
	reportWindow = dhtmlmodal.open('reportBox','iframe','/_pt_module/cts.report.form.asp?ttl='+ttl+'&entityId='+entityId,'','width=284px,height=237px,center=1,resize=0,scrolling=0');
}

function printPopupOpen(url, w, h, s, r, winname) {
	width=screen.width;
	height=screen.height;

	x=(width/2)-(w/2);
	y=(height/2)-(h/2);

	opt = "left=" + x + ", top=" + y + ", width=" + w + ", height=" + h;
	opt = opt + ", toolbar=no,location=no,directories=no,status=no,menubar=no";
	opt = opt + ",scrollbars=" + s;
	opt = opt + ",resizable=" + r;
	return window.open(url, winname, opt);
}

function openSpot(){
	spitId = arguments[0]==undefined ? spitId : arguments[0];
	spotWindow = dhtmlmodal.open('spotBox','spot','/cts/spot/defaultLoad.asp?spotId='+spitId,'','width=668px,height=675px,center=1,resize=0,scrolling=0');
}

function openSpotRvw(){
	spitId = arguments[0]==undefined ? spitId : arguments[0];
	spotWindow = dhtmlmodal.open('spotBox','spot','/cts/spot/review.asp?spotId='+spitId,'','width=668px,height=675px,center=1,resize=0,scrolling=0');
}

function openSpotMap(){
	spitId = arguments[0]==undefined ? spitId : arguments[0];
	spotWindow = dhtmlmodal.open('spotBox','spot','/cts/spot/mapLoad.asp?spotId='+spitId,'','width=668px,height=675px,center=1,resize=0,scrolling=0');
}

function SpotReviewOut(){
		rvwId = arguments[0]==undefined ? rvwId : arguments[0];
		window.open('/cts/blog/viewBlog.asp?rvwId='+rvwId,'rvw','');
}

function error(){return true;};
window.onerror = error;


//google statics
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
var pageTracker = _gat._getTracker("UA-6267838-3");
pageTracker._trackPageview();

//skylog
function sky_script_exec(sky_uid)
{
    var Srv_Send_Info; var skyTurl;
    Srv_Url = 'http://'+sky_uid+'.sublog.co.kr/log_script/skycounter.php';
    skyCuid = sky_uid;
    Doc_Url = document.URL;
    skyCcpu = (navigator.cpuClass==''?'undefined':navigator.cpuClass);
    skyCcpu = (skyCcpu=='undefined'?'UNKNOWN':skyCcpu);
    CuserAgent = navigator.userAgent.toLowerCase();
    skyClang = (typeof(navigator.language) == 'undefined')?navigator.browserLanguage:navigator.language;
    skyCje = (navigator.javaEnabled() == true)?'1':'0';
    skyCce = (navigator.cookieEnabled == true)?'1':'0';
    skyCref = (document.referrer == ''?'bookmark':document.referrer); eval('try{ skyTref=top.document.referrer; }catch(_e){}');eval('try{skyTurl = top.document.location.href; }catch(_e){}');if(skyCref==skyTurl){ skyCref = (skyTref==''?'bookmark':skyTref)}; skyCtz = -((new Date()).getTimezoneOffset()/60); skyCcd = (typeof(screen.colorDepth) == 'undefined')?screen.pixelDepth:screen.colorDepth;	skyCswh = screen.width+'*'+screen.height; skyCid = (typeof(skyMemberId)=='undefined'?'':skyMemberId); Srv_Send_Info = Srv_Url+'?Cuid='+skyCuid+'&Doc_Url='+escape(Doc_Url)+'&Ccpu='+skyCcpu+'&CuserAgent='+CuserAgent+'&Clang='+skyClang+'&Cje='+skyCje+'&Cce='+skyCce+'&Cref='+escape(skyCref)+'&Ctz='+skyCtz+'&Ccd='+skyCcd+'&Cswh='+skyCswh+'&Cid='+skyCid; return Srv_Send_Info;
}
if(typeof(sky_script_exec) == 'function')
{
    Sky_Srv_Send_Info = sky_script_exec('1268268579');
    var Sky_Cimg=new Image(); setTimeout('Sky_Cimg.src=Sky_Srv_Send_Info;',1);
}