function bluring()
{
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;



function login_form() 
{
	var user_id='<?=$member[user_id]?>';
	if(user_id) 
	{
		alert('ÀÌ¹Ì ·Î±×ÀÎ µÇ¾î ÀÖ½À´Ï´Ù.');
	}
	else 
	{
		window.open('http://www.cuonet.com/cuoshop/shop/login_form.php?url=<?=$PHP_SELF?>','duplication','width=390,height=305,toolbar=no,status=no,resizable=no');
	}
}

//»õÃ¢¿­±â by Á¤»óÈÆ
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  cookie_str = document.cookie;
  cookie_str.toString();

  pos_start  = cookie_str.indexOf(name);
  pos_start  = cookie_str.indexOf('=', pos_start);
  pos_end    = cookie_str.indexOf(';', pos_start);
  
  if (pos_end <= 0) pos_end = cookie_str.length;
  cookie_val = cookie_str.substring(pos_start + 1, pos_end);

  if (cookie_val  == "done")return;

  window.open(url, name,'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function review_open(com_no)
{
	window.open('./review_more.php?com_no='+com_no,'howweb','width=600, height=750, scrollbars=yes');
}

function item_view(item_id)
{
	window.open("./item_view.php?item_id="+item_id, "item_view", "titlebar=no, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=300,left="+200+",top=100");
}

function add_cart_list(item_id) {
  if(confirm("Àå¹Ù±¸´Ï¿¡ Ãß°¡ÇÏ½Ã°Ú½À´Ï±î?")) {
    document.location.href = "./baguni_ok2.php?item_id="+item_id+"";
  }
}


//°ü½É»óÇ° ´ã±â ajax Ã³¸®ºÎºÐ by Á¤»óÈÆ 20080107
function mywish_ajx(no) 
{
	if(document.all)
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		http = new XMLHttpRequest();
	}
	url = "http://www.cuonet.com/cuoshop/shop/mywish_ok3.php?item_id="+no;

	http.open("GET", url, true);
	http.onreadystatechange = mywishopen;
	http.send(null);
} 
function mywishopen() 
{
	if (http.readyState == 4) {
		var textout = http.responseText;
		if(textout == '1') alert('°ü½É»óÇ°¿¡ µî·ÏÇÏ¿´½À´Ï´Ù');
		else if(textout == '-1') alert('ÀÌ¹Ì µî·ÏµÇ¾î ÀÖ½À´Ï´Ù');
		//alert(textout);
	}
}

//Àå¹Ù±¸´Ï¿¡ ´ã±â ajax ¹öÁ¯ by Á¤»óÈÆ 20080107
function baguni_at_vclass_ajx(no) 
{
	if(document.all)
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		http = new XMLHttpRequest();
	}
	url = "http://www.cuonet.com/cuoshop/shop/baguni_ok2.php?item_id="+no;

	http.open("GET", url, true);
	http.onreadystatechange = baguni_at_list_open;
	http.send(null);
} 

function baguni_at_list_open() 
{
	if (http.readyState == 4) {
		var textout = http.responseText;
		if(textout == '1') alert('¹Ù±¸´Ï¿¡ ´ã¾Ò½À´Ï´Ù.');
		else if(textout == '2') alert('ÀÌ¹Ì ´ã°ÜÀÖ¾î¼­ ¼ö·®À» Ãß°¡Çß½À´Ï´Ù');
		else if(textout == '0') alert('´ã±âÁß ¿À·ù¹ß»ý');
		//alert(textout);
	}
	//else alert(textout);
}


function bbs_add_favorite(bbs_info) 
{
	if(document.all)
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		http = new XMLHttpRequest();
	}
	url = "http://www.cuonet.com/zboard/add_favorite.php?bbs_info="+bbs_info;

	http.open("GET", url, true);
	http.onreadystatechange = addfavoriteopen;
	http.send(null);
} 
function addfavoriteopen() 
{
	if (http.readyState == 4) {
		var textout = http.responseText;
		if(textout == '1') alert('È¸¿ø´ÔÀÇ Å¥¿ÀÆ÷ÄÏ Áñ°ÜÃ£±â¿¡ µî·ÏµÇ¾ú½À´Ï´Ù.');
		else if(textout == '-1') alert('ÀÌ¹Ì µî·ÏµÇ¾î ÀÖ½À´Ï´Ù');
		//alert(textout);
	}
}

//ÇÃ·¡½¬ÆÄÀÏ»ðÀÔ°ü·Ã
function playflash(file,width,height,bgcolor,quality,name){
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="'+name+'">'); 
    document.write('<param name="movie" value="'+file+'" />');
    document.write('<param name="quality" value="'+quality+'" />');
	document.write('<param name="wmode" value="transparent" />');  //Åõ¸íÇÃ·¡½¬°¡ ¾Æ´Ò°æ¿ì ÀÌ ¶óÀÎÀ» »èÁ¦
    document.write('<param name="bgcolor" value="'+bgcolor+'" />');
    document.write('<embed src="'+file+'" quality="'+quality+'" wmode="transparent" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>')
}

function playflash_var(file,param,width,height,bgcolor,quality,name){
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="'+name+'">'); 
    document.write('<param name="movie" value="'+file+'" />');
	document.write('<param name="FlashVars" value="'+param+'" />');
    document.write('<param name="quality" value="'+quality+'" />');
	document.write('<param name="wmode" value="transparent" />');  //Åõ¸íÇÃ·¡½¬°¡ ¾Æ´Ò°æ¿ì ÀÌ ¶óÀÎÀ» »èÁ¦
    document.write('<param name="bgcolor" value="'+bgcolor+'" />');
    document.write('<embed src="'+file+'" quality="'+quality+'" wmode="transparent" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>')
}





var SLB_cnt = 0;  
function SLB_show(url, type)      
{      
	var a = document.getElementById('SLB_film');      
	var b = document.getElementById('SLB_content');      
	var c = document.getElementById('SLB_loading');   
	var loading = document.getElementById('SLB_loading');
	if(url) {      
		a.style.top = 0;      
		a.style.left = 0;      
		a.style.display = "";      
		a.style.height = document.body.scrollHeight + 'px';      
		loading.style.display = "block";      
		SLB_setCenter(c,true);      
		if(type == 'image') {      
			b.innerHTML="<img  src=" + url + " class='SLB_center' onload='SLB_setCenter(this);' / >";      
			if(arguments[2]) a.onclick = function () { SLB_show() };      
			if(arguments[3]) b.innerHTML += "<div class='SLB_caption'>"+ arguments[3] +"</div>";;      
		} else if (type == 'iframe') {      
			b.innerHTML="<iframe src=" + url + " width="+ arguments[2] +" height="+ arguments[3] +" class='SLB_center' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' onload='SLB_setCenter(this);' /></iframe>";        
			if(arguments[4]) {      
				b.innerHTML += "<div class='SLB_close' onclick='SLB_show();' title='´Ý±â'>ÀÌ Ã¢À» ´Ý½À´Ï´Ù</div>";      
			}      
			b.onclick = ''; b.firstChild.style.cursor = 'default';      
		} else if (type='html'){      
			b.innerHTML = url;      
			SLB_setCenter(b.firstChild);      
			if(arguments[2]) b.onclick = '';      
		}  
		hideSelect();  
	} else {      
		a.onclick = '';      
		a.style.display = "none";      
		b.innerHTML = "";      
		b.onclick = function () { SLB_show() };      
		c.style.display = "none";      
		showSelect();  
		SLB_cnt = 0;  
	}      
}      

function SLB_show_iframe(url, type)      
{      
	var a = parent.document.getElementById('SLB_film');      
	var b = parent.document.getElementById('SLB_content');      
	var c = parent.document.getElementById('SLB_loading');   
	var loading = parent.document.getElementById('SLB_loading');
	if(url) {      
		a.style.top = 0;      
		a.style.left = 0;      
		a.style.display = "";      
		a.style.height = parent.document.body.scrollHeight + 'px';      
		loading.style.display = "block";      
		SLB_setCenter(c,true);      
		if(type == 'image') {      
			b.innerHTML="<img  src=" + url + " class='SLB_center' onload='SLB_setCenter(this);' / >";      
			if(arguments[2]) a.onclick = function () { SLB_show() };      
			if(arguments[3]) b.innerHTML += "<div class='SLB_caption'>"+ arguments[3] +"</div>";;      
		} else if (type == 'iframe') {      
			b.innerHTML="<iframe src=" + url + " width="+ arguments[2] +" height="+ arguments[3] +" class='SLB_center' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' onload='SLB_setCenter(this);' /></iframe>";        
			if(arguments[4]) {      
				b.innerHTML += "<div class='SLB_close' onclick='SLB_show();' title='´Ý±â'>ÀÌ Ã¢À» ´Ý½À´Ï´Ù</div>";      
			}      
			b.onclick = ''; b.firstChild.style.cursor = 'default';      
		} else if (type='html'){      
			b.innerHTML = url;      
			SLB_setCenter(b.firstChild);      
			if(arguments[2]) b.onclick = '';      
		}  
		hideSelect();  
	} else {      
		a.onclick = '';      
		a.style.display = "none";      
		b.innerHTML = "";      
		b.onclick = function () { SLB_show() };      
		c.style.display = "none";      
		showSelect();  
		SLB_cnt = 0;  
	}      
}      
	  
function SLB_setCenter(obj) {      
	if (obj) {      
		var h = window.innerHeight || self.innerHeight || document.body.clientHeight;      
		var w = window.innerWidth || self.innerWidth || document.body.clientWidth;      
		var l = (document.body.scrollLeft + ((w-(obj.width||parseInt(obj.style.width)||obj.offsetWidth))/2));      
		var t = (document.body.scrollTop + ((h-(obj.height||parseInt(obj.style.height)||obj.offsetHeight))/2));      
		if((obj.width||parseInt(obj.style.width)||obj.offsetWidth) >= w) l = 0;      
		if((obj.height||parseInt(obj.style.height)||obj.offsetHeight) >= h) t = document.body.scrollTop;      
		document.getElementById('SLB_content').style.left = l + "px";  
		if(SLB_cnt == 0) {        
			document.getElementById('SLB_content').style.top = t + "px";    
			if(document.getElementById('SLB_content').offsetHeight >= h) {  
				SLB_cnt ++;  
			}  
		}  
		obj.style.visibility = 'visible';      
		if(obj.nextSibling && (obj.nextSibling.className == 'SLB_close' || obj.nextSibling.className == 'SLB_caption')) {      
			obj.nextSibling.style.display = 'block';  
			if(document.getElementById('SLB_content').offsetHeight < h) {  
				document.getElementById('SLB_content').style.top = parseInt(document.getElementById('SLB_content').style.top) -    (obj.nextSibling.offsetHeight/2) + "px";  
			}  
		}      
		if(!arguments[1]) {      
			document.getElementById('SLB_loading').style.display = "none";  
		} else {  
			obj.style.left = l + "px";      
			obj.style.top = t + "px";  
		}      
	}      
}  
  
function hideSelect() {  
	var windows = window.frames.length;  
	var selects = document.getElementsByTagName("SELECT");  
	for (i=0;i < selects.length ;i++ )  
	{  
		selects[i].style.visibility = "hidden";  
	}  

	if (windows > 0) {  
		for(i=0; i < windows; i++) {  
			try {  
				var selects = window.frames[i].document.getElementsByTagName("SELECT");  
				for (j=0;j<selects.length ;j++ )  
				{  
					selects[j].style.visibility = "hidden";  
				}  
			} catch (e) {}  
		}  
	}  
}  

function showSelect() {  
	var windows = window.frames.length;  
	var selects = document.getElementsByTagName("SELECT");  
	for (i=0;i < selects.length ;i++ )  
	{  
		selects[i].style.visibility = "visible";  
	}  

	if (windows > 0) {  
		for(i=0; i < windows; i++) {  
			try {  
				var selects = window.frames[i].document.getElementsByTagName("SELECT");  
				for (j=0;j<selects.length ;j++ )  
				{  
					selects[j].style.visibility = "visible";          
				}  
			} catch (e) {}  
		}  
	}  
}  

var prevOnScroll = window.onscroll;      
window.onscroll = function () {      
	if(prevOnScroll != undefined) prevOnScroll();      
	document.getElementById('SLB_film').style.height = document.body.scrollHeight + 'px';      
	document.getElementById('SLB_film').style.width = document.body.scrollWidth + 'px';      
	SLB_setCenter(document.getElementById('SLB_content').firstChild);                
}      
var prevOnResize = window.onresize;        
window.onresize = function () {      
	if(prevOnResize != undefined) prevOnResize();      
	document.getElementById('SLB_film').style.height = document.body.offsetHeight + 'px';      
	document.getElementById('SLB_film').style.width = document.body.offsetWidth + 'px';      
	SLB_setCenter(document.getElementById('SLB_content').firstChild);            
}      


function getXmlHttpObject()
{
    var xmlHttp=null;
    try {
	// Firefox, Opera 8.0+, Safari
	xmlHttp=new XMLHttpRequest();
    } catch (e) {
	// Internet Explorer
	try {
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
    }
    return xmlHttp;
}

var xmlHttp;
var elementId;

function stateChanged()
{
    if (xmlHttp.readyState == 4) {
	document.getElementById(elementId).innerHTML = xmlHttp.responseText;
    }
}

function ajaxDisplay(url, element_id)
{
    elementId = element_id;
    xmlHttp = getXmlHttpObject();
    if (xmlHttp == null) {
	return;
    }
    xmlHttp.onreadystatechange = stateChanged;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}



function list_copy(obj) 
{
	//var text = obj.innerText;
	var text = obj;
	if (window.clipboardData) 
	{
		window.clipboardData.setData('Text',text);
		document.execCommand("Copy");
		window.clipboardData.getData("Text");
		alert(text+' °¡ º¹»çµÇ¾ú½À´Ï´Ù.');
	}
}