/**********************************
**  NIP ºñ±³ÇÏ±â  ½ÃÀÛ  	 **
***********************************/

var COMPLIST_PRDNO = "compListPrdNo";

function multiinsertCompListNIP(key, reqSite){
	//ÀÌÀü ÄíÅ°°ª
	compListPrd = getCompCookieNIP(COMPLIST_PRDNO).split(",");
	
	//ÇöÀç °ª
	var delvKey 	= document.getElementsByName(key);
	var prdNoList = new Array;
	var j=0;
	var cnt = 0;
	for (var i=0; i < delvKey.length; i++)
	{
		var delvKeyItem = delvKey.item(i); 
		if (delvKeyItem.checked)
		{			
			prdNoList[j] = delvKeyItem.value.split(',')[0]; // modify by ¿äÇÑ. KEY°ªÀÌ [»óÇ°¹øÈ£, CNT] ·Î µÇÀÖ´Â°æ¿ìµµ ÀÖ±â¶§¹®¿¡
			j++;
			cnt++;
		}
	}
	
	if(j == 0){
		alert("¼±ÅÃÇÏ½Å »óÇ°ÀÌ ¾ø½À´Ï´Ù.\n»óÇ°À» ¼±ÅÃÇÏ½ÅÈÄ ¹öÆ°À» ´­·¯ÁÖ½Ê½Ã¿À.");
		return;
	}else{
		if(prdNoList.length > 4){
			alert("ÇÑ¹ø¿¡ ÃÖ´ë 4°³ÀÇ »óÇ°¸¸ ´ãÀ»¼ö ÀÖ½À´Ï´Ù.");			
			return;
		}
		
		var prdNoListReal = new Array;
		var k=0;		
		
		for(var r=0;r<prdNoList.length ; r++){
		prdNoListReal[r] =  prdNoList[r];
		k++;
		}
		if(cnt < 4){
		if(compListPrd != "" && compListPrd != null){
			
			for(var i = 0; i<compListPrd.length; i++)
			{					
				IsData = false;	
				idx = 0;
				for(var m = 0;m<prdNoList.length ;m++){

					if((prdNoList[m] == compListPrd[i]) || (compListPrd[i] =="0") ||(compListPrd[i] ==""))
					{
						IsData = true;						
						//prdNoListReal[k] = compListPrd[i];							
					}				
				}	
				if(IsData == false){
				prdNoListReal[k] = compListPrd[i];						
				k++;
				}
				if(k>3){
				break;
				}
			}//forÀÌÀü °ª°ú ºñ±³ end							
		}		
		}
		
		var leng = compListPrd.length;
		var realleng = prdNoListReal.length;
		
		setCompCookieNIP(COMPLIST_PRDNO,prdNoListReal,1);	//ÄíÅ° »ý¼º 	

		window.open('/malls/CompList.do?_method=initialNIP&cnt='+cnt+"&reqSite=SHOP",'pop_productcompare','status=yes,menubar=0,resizable=0,scrollbar=no,width=340,height=220,left=50,top=50');
	}	
}


function goCompListNIP() {
	
	window.open('/malls/CompList.do?_method=listNIP','pop_productcompare_nip','status=yes,menubar=0,resizable=yes,scrollbar=no,width=340,height=220,left=500,top=50');
	
}


function getCompCookieNIP(name){
	var nameOfCookie = name + "=";	
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			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 setCompCookieNIP(name, value, expiredays) {
	var cookie = name + "=" + escape(value)
				+ "; domain=" + DEFAULT_COOKIE_DOMAIN;
				
	if (expiredays < 0) {
		var date = new Date();
		date.setSeconds(date.getSeconds() + expiredays);
		cookie += "; expires=" + date.toGMTString();
	}
	cookie += "; path="+DEFAULT_COOKIE_PATH+";";
	document.cookie = cookie;	

}
/**********************************
**  NIP ºñ±³ÇÏ±â  ³¡  	 **
***********************************/

/**********************************
**  NIP »óÇ°½½¶óÀÌµå  	 **
***********************************/
function slideShow(key,shopNo,dispNo){
	var delvKey 	= document.getElementsByName(key);
	var prdNoList = new Array;
	if(delvKey.length < 1){
		return;
	}
	for (var i=0; i < delvKey.length; i++){
		var delvKeyItem = delvKey.item(i); 				
		prdNoList[i] = delvKeyItem.value.split(',')[0];
	}	
	//700 * 516
	var url = "/malls/SlideShow.do?_method=Initial&sc.slidePrdNo="+prdNoList+"&sc.shopNo="+shopNo+"&sc.dispNo="+dispNo;
	window.open(url,'slide','status=yes,menubar=0,resizable=0,scrollbars=no,width=700,height=516,left=500,top=50');
}
/**********************************
**  NIP »óÇ°½½¶óÀÌµå  ³¡	 **
***********************************/

/**********************************
**  NIP »óÇ° ÀÌ¹ÌÁö È®´ëº¸±â ½ÃÀÛ **
***********************************/
function DetailImgNIP(prdNo){
		temp_url = "http://www.interpark.com/product/ProductDetailImage.do?_method=detailNIP&sc.prdNo="+prdNo;
		var	newwindow =	window.open(temp_url, "", "width=382, height=430, left=0,right=0,status=yes,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no");
}
/**********************************
**  NIP »óÇ° ÀÌ¹ÌÁö È®´ëº¸±â ³¡ **
***********************************/


/////////////////////////////////////////////////////////////////////////////////////////////////////
/***************************************** ÀÌº¥Æ® È£Ãâ ½ÃÀÛ ******************************************/
/////////////////////////////////////////////////////////////////////////////////////////////////////
function obj2evt2func( obj, evt_name, func_name )
{
	if ( !obj ) return ;
	var evt_name = ( document.all ) ? evt_name : evt_name.substring( 2, evt_name.length ) ;
	if ( document.all )
	{
		obj.attachEvent( evt_name, eval(func_name) ) ;
	}
	else
	{
		obj.addEventListener( evt_name, eval(func_name), true ) ;
	}
}

function obj2evt2func_delete( obj, evt_name, func_name )
{
	if ( !obj ) return ;
	var evt_name = ( document.all ) ? evt_name : evt_name.substring( 2, evt_name.length ) ;
	if ( document.all )
	{
		obj.detachEvent( evt_name, eval(func_name) ) ;
	}
	else
	{
		obj.removeEventListener( evt_name, eval(func_name), true ) ;
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/***************************************** ÀÌº¥Æ® È£Ãâ ³¡ ******************************************/
///////////////////////////////////////////////////////////////////////////////////////////////////

/*À©µµ¿ì Æ÷Ä¿½Ì ºí·¯ Ã³¸®*/
function bluring()
{ 
    try{
        if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG")
        {
        	document.body.focus();
        }
	}catch(e){
	}
        
}
function onfocusin()
{
	document.onfocusin=bluring;
}
obj2evt2func(window,'onload','onfocusin')


/////////////////////////////////////////////////////////////////////////////////////////////////
/***************************************** ÇÃ·¡½ÃÈ£Ãâ ******************************************/
/////////////////////////////////////////////////////////////////////////////////////////////////
function swf_obj(src,w,h,swfid){
	swf_html = '';
	swf_html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="'+swfid+'">';
	swf_html += '<param name="allowScriptAccess" value="always">';
	swf_html += '<param name="movie" value="'+src+'">';
	swf_html += '<param name="quality" value="high">';
	swf_html += '<param name="bgcolor" value="#FFFFFF">';
	swf_html += '<PARAM NAME="wmode" VALUE="transparent">';
	swf_html += '<embed src="'+src+'" quality="high" bgcolor="#FFFFFF" width="'+w+'" height="'+h+'" name="'+swfid+'" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
	swf_html += '</object>';
	document.write(swf_html);
}


// »õ·Î°íÄ§½Ã Flash9 ocx ¿¡·¯ ¹æÁö
window.onbeforeunload= function(){
	deconcept.SWFObjectUtil.prepUnload();
}


/*ExternalInterface °ü·Ã ÇÔ¼ö ½ÃÀÛ*/
function cleanup()
{
	__flash_unloadHandler = function()
	{
		externalProbSet = true;
		obj = document.getElementsByTagName('OBJECT');
		for (i=0;i<obj.length;i++)
		{
			var theObj = eval(obj[i]);
			theObj.style.display = "none";
			for (var prop in theObj)
			{
				if (typeof(theObj[prop]) == "function")
				{
					theObj[prop]=null
				}
			}
		}
	}

	if (window.onunload != __flash_unloadHandler)
	{
		__flash_savedUnloadHandler = window.onunload;
		window.onunload = __flash_unloadHandler;
	}
}
window.onbeforeunload=cleanup;
/*ExternalInterface °ü·Ã ÇÔ¼ö ³¡*/

/////////////////////////////////////////////////////////////////////////////////////////////////
/******************************************** µµ¿ò¸» *******************************************/
/////////////////////////////////////////////////////////////////////////////////////////////////

function disp_div(div_name,xmouse,ymouse)
{
	help_divwid = parseInt(document.getElementById(div_name).style.width,10);
	if(document.body.clientWidth > (help_divwid+xmouse+15))
	{
		document.getElementById(div_name).style.left = document.body.scrollLeft + xmouse + 10;
		document.getElementById(div_name).style.top = document.body.scrollTop + ymouse;
	}else{
		document.getElementById(div_name).style.left = (document.body.scrollLeft + xmouse) - (help_divwid+10);
		document.getElementById(div_name).style.top = document.body.scrollTop + ymouse;
	}
	document.getElementById(div_name).style.visibility = "visible";
}

function show_div(div_name)
{
	document.getElementById(div_name).style.visibility = "visible";
}

function hide_div(div_name)
{
	document.getElementById(div_name).style.visibility = "hidden";
}