//-------------------------------------------------------------------------------------
//	OPMS ANALYSIS SCRIPT Ver. 0.5	for	HANSOLH
//	
//	Last Modify : 2005/08/08	Song, YoungKi
//	 
//	COPYRIGHT (C) 2005 OPMS Co.,Ltd. ALL RIGHTS RESERVED.
//	
//	
//	!!!!!!!! DO NOT MODIFY THIS SCRIPT. !!!!!!!!!!!!!!!!!!!!!!
//------------------------------------------------------------------------------------->	

// ------------------------------------------------------------------------------------
//	ENV
//------------------------------------------------------------------------------------->
var _OPMS_DOMAIN="adworks.opms.co.kr";				// SERVER_ADDRESS
var _OPMS_SITE_ID="287";							// CLIENT_IDENTITY
var _OPMS_SCRIPT_KIND = "INFO1";					// SCRIPT KIND	(FULL, INFO2, INFO1)
var _OPMS_PAGE = "/basicScript_HANSOLH.opms";	// SERVER PAGE
var _OPMS_IS_PAGEINFO = false;						// IS PAGE INFO. EXISTS?
var _OPMS_AD_OV = true;								// OVERTURE AD


function _OPMS_setCookie(name,value,expire) 
{ 
	var today=new Date(); 
	today.setDate(today.getDate()+parseInt(expire));
	if (expire == 0)
		document.cookie=name+"="+escape(value)+";path=/;";
	else
		document.cookie=name+"="+escape(value)+";path=/;expires="+today.toGMTString()+";";
}

function _OPMS_getCookie(name) 
{ 
	var cookieName=name+"="; 
	var x=0; 
	
	while(x<=document.cookie.length) 
	{ 
		var y=(x+cookieName.length); 
		if(document.cookie.substring(x,y)==cookieName) 
		{  
			if((endOfCookie=document.cookie.indexOf(";",y))==-1) endOfCookie=document.cookie.length;  
			
			return unescape(document.cookie.substring(y,endOfCookie)); 
		} 
		
		x=document.cookie.indexOf(" ",x)+1; 
		
		if(x == 0) break; 
	} 
	
	return "";
}

function _OPMS_getParameter(name) 
{ 
	var paraName=name+"="; 
	var URL=""+self.document.location.search; 
	var tURL=""; 
	eval("try{ tURL=top.document.location.search; }catch(_e){}"); 
	
	URL=URL+"&"+tURL; 
	if(URL.indexOf(paraName)!=-1) 
	{ 
		var x=URL.indexOf(paraName)+paraName.length;
		var y=URL.substr(x).indexOf("&"); 
		if(y!=-1) return URL.substring(x,x+y); 
		else return URL.substr(x);
	} 
	
	return "";
}

function _OPMS_escape(_str) 
{ 
	var str, ch; 
	var bEncURI = "N"; 
	eval("try{bEncURI=encodeURI('O');}catch(_e){ }" );		
	if( bEncURI == "O" ) str=encodeURI(_str); 
	else str = escape(_str); 
	
	str=str.split("+").join("%2B");
	str=str.split("/").join("%2F"); 
	str=str.split("&").join("%26");
	str=str.split("?").join("%3F"); 
	str=str.split(":").join("%3A"); 
	str=str.split("#").join("%23"); 

	return str;
}

function _OPMS_make_code(_OPMS_SERVER,_OPMS_CLIENT) 
{ 
	var dt=document.title.toString(); 
	dt=dt.substr(0,128); 
	var dr=self.document.referrer;

	var tdr=""; 
	eval("try{ tdr=top.document.referrer; }catch(_e){}"); 
	var tdu=""; 
	eval("try{ tdu=top.document.location.href; }catch(_e){}"); 
	var bFrm=false; 

	if(dr==tdu) 
	{ 
		dr=tdr; 
		bFrm=true; 
	} 
	
	if(dr=="undefined") dr="";
	var du=self.document.location.href; 
	if(du.substr(0,4)=="file") return ""; 
	
	var adKeyVal = ""; 
	
	if(bFrm) 
	{ 
		adKeyVal=_OPMS_getParameter("OVKEY"); 
		
		if(adKeyVal!="" && du.indexOf("OVKEY=")<0) 
		{  
			if(du.indexOf("?")!=-1) du=du+"&OVKEY="+adKeyVal; 
			else du=du+"?OVKEY="+adKeyVal;  
			
			adKeyVal=_OPMS_getParameter("OVRAW");  
			if(adKeyVal!="" && du.indexOf("OVRAW=")<0 ) 
			if(du.indexOf("?")!=-1) du=du+"&OVRAW="+adKeyVal; 
			else du=du+"?OVRAW="+adKeyVal;
			
			adKeyVal=_OPMS_getParameter("OVMTC");  
			if(adKeyVal!="" && du.indexOf("OVMTC=")<0 ) 
			if(du.indexOf("?")!=-1) du=du+"&OVMTC="+adKeyVal; 
			else du=du+"?OVMTC="+adKeyVal;
		} 
	} 

	if (du.indexOf("_OPMS_OTCAMP") > 0) {
		_OPMS_setCookie("_OPMS_VALID_C", "TRUE", 90);
		_OPMS_IS_PAGEINFO = true;		
	}
	
	if (_OPMS_SCRIPT_KIND != "FULL") {
		if (_OPMS_AD_OV) {
			if (du.indexOf("OVKEY") > 0) {
				_OPMS_setCookie("_OPMS_VALID_C", "TRUE", 90);
				_OPMS_IS_PAGEINFO = true;
			}
		}
	}
	
	if(!dt) dt=""; 
	if(!dr) dr=""; 
	if(!du) du=""; 
	
	var tc = ""; 
	var prtcl=document.location.protocol.indexOf("https")!=-1?"https://":"http://"; 
	
	if(prtcl=="https://") _OPMS_SERVER="ssl."+_OPMS_DOMAIN; 
	
	tc=tc+prtcl+_OPMS_SERVER;
	
	tc=tc+ _OPMS_PAGE; 
	
	tc=tc+"?u="+_OPMS_CLIENT+"&XU="; 
	
	tc=tc+"&dr="+_OPMS_escape(dr)+"&XDR="+"&dt="+dt+"&du="+_OPMS_escape(du);
	if((typeof _OPMS_CP)!="undefined" && _OPMS_CP!="") {
		tc=tc+"&CP="+_OPMS_CP+"&XCP=";
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_PI)!="undefined" && _OPMS_PI!="") {
		tc=tc+"&PI="+_OPMS_PI;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_PN)!="undefined" && _OPMS_PN!="") {
		tc=tc+"&PN="+_OPMS_PN;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_MF)!="undefined" && _OPMS_MF!="") {
		tc=tc+"&MF="+_OPMS_MF;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_OA)!="undefined" && _OPMS_OA!="") {
		tc=tc+"&OA="+_OPMS_OA;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_OP)!="undefined" && _OPMS_OP!="") {
		tc=tc+"&OP="+_OPMS_OP;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_EP)!="undefined" && _OPMS_EP!="") {
		tc=tc+"&EP="+_OPMS_EP;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_OE)!="undefined" && _OPMS_OE!="") {
		tc=tc+"&OE="+_OPMS_OE;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_CC)!="undefined" && _OPMS_CC!="") {
		tc=tc+"&CC="+_OPMS_CC;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_RK)!="undefined" && _OPMS_RK!="") {
		tc=tc+"&RK="+_OPMS_RK;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_SX)!="undefined" && _OPMS_SX!="") {
		tc=tc+"&SX="+_OPMS_SX;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_AG)!="undefined" && _OPMS_AG!="") {
		tc=tc+"&AG="+_OPMS_AG;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_IK)!="undefined" && _OPMS_IK!="") {
		tc=tc+"&IK="+_OPMS_IK;
		_OPMS_IS_PAGEINFO = true;
	}
	if((typeof _OPMS_OTA)!="undefined" && _OPMS_OTA!="") {
		tc=tc+"&OTA="+_OPMS_OTA;
		_OPMS_IS_PAGEINFO = true;
	}
	
	return tc;
}



var _OPMS_code_base=_OPMS_make_code(_OPMS_DOMAIN, _OPMS_SITE_ID);
var _OPMS_code_chan="";
var _OPMS_img_base=new Image();
var _OPMS_img_chan=new Image();
var _OPMS_img_base_click=new Image();
var _OPMS_img_chan_click=new Image();

var _OPMS_isMSIE=(document.all)?true:false;
var _OPMS_isJS12=(window.screen)?true:false;

if (_OPMS_SCRIPT_KIND == "FULL")
{
	if(_OPMS_isJS12==true) 
	{ 
		if(_OPMS_isMSIE) 
		{ 
			_OPMS_img_base.src=_OPMS_code_base; 
			//if(_OPMS_CLIENT!="") _OPMS_img_chan.src=_OPMS_code_chan; 
		} 
		else 
		{ 
			setTimeout("_OPMS_img_base.src=_OPMS_code_base;",1); 
			//if(_OPMS_CLIENT!="") setTimeout("_OPMS_img_chan.src=_OPMS_code_chan;",1); 
		}
	} 
	else 
	{ 
		if(_OPMS_isMSIE) document.write('<div style=\"display: none\">'); 
		document.write('<img src=\"'+_OPMS_code_base+'\" height=\"0\" width=\"0\">'); 
		//if(_OPMS_CLIENT!="") document.write('<img src=\"'+_OPMS_code_chan+'\" height=\"0\" width=\"0\">'); 
		if(_OPMS_isMSIE) document.write('</div>');
	}
}
else if (_OPMS_SCRIPT_KIND == "INFO2") {
	if(_OPMS_getCookie("_OPMS_VALID_C") == "TRUE")
	{
		if(_OPMS_isJS12==true) 
		{ 
			if(_OPMS_isMSIE) 
			{ 
				_OPMS_img_base.src=_OPMS_code_base; 
				//if(_OPMS_CLIENT!="") _OPMS_img_chan.src=_OPMS_code_chan; 
			} 
			else 
			{ 
				setTimeout("_OPMS_img_base.src=_OPMS_code_base;",1); 
				//if(_OPMS_CLIENT!="") setTimeout("_OPMS_img_chan.src=_OPMS_code_chan;",1); 
			}
		} 
		else 
		{ 
			if(_OPMS_isMSIE) document.write('<div style=\"display: none\">'); 
			document.write('<img src=\"'+_OPMS_code_base+'\" height=\"0\" width=\"0\">'); 
			//if(_OPMS_CLIENT!="") document.write('<img src=\"'+_OPMS_code_chan+'\" height=\"0\" width=\"0\">'); 
			if(_OPMS_isMSIE) document.write('</div>');
		}
	}
}
else if (_OPMS_SCRIPT_KIND == "INFO1") {
	if(_OPMS_getCookie("_OPMS_VALID_C") == "TRUE" && _OPMS_IS_PAGEINFO == true)
	{
		if(_OPMS_isJS12==true) 
		{ 
			if(_OPMS_isMSIE) 
			{ 
				_OPMS_img_base.src=_OPMS_code_base; 
				//if(_OPMS_CLIENT!="") _OPMS_img_chan.src=_OPMS_code_chan; 
			} 
			else 
			{ 
				setTimeout("_OPMS_img_base.src=_OPMS_code_base;",1); 
				//if(_OPMS_CLIENT!="") setTimeout("_OPMS_img_chan.src=_OPMS_code_chan;",1); 
			}
		} 
		else 
		{ 
			if(_OPMS_isMSIE) document.write('<div style=\"display: none\">'); 
			document.write('<img src=\"'+_OPMS_code_base+'\" height=\"0\" width=\"0\">'); 
			//if(_OPMS_CLIENT!="") document.write('<img src=\"'+_OPMS_code_chan+'\" height=\"0\" width=\"0\">'); 
			if(_OPMS_isMSIE) document.write('</div>');
		}
	}
}