////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   bookmarksite
//
//**************************************************************************************************************
//
//  Usage) Áñ°ÜÃ£±â
//
//  Example)
//      <img src="ÀÌ¹ÌÁö" alt="" title="" onclick="addBookmark()">
//      -  À§»ç¸ôÀÇ °æ¿ì 
//         °°ÀÌ phpº¯¼ö¿Í ÇÔ²² »ç¿ë°¡´É
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function addBookmark() {
    var url = root_url;
    var title = document.title;

    if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, ""); 

    else if(window.opera && window.print) { // opera
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    }

    else if(document.all) // IE
    window.external.AddFavorite(url, title);
}

//////// Æ÷Ä¿½º ÀÎ ///////////////////
function focusIn(a) {
	a=a.style.backgroundImage='';	
}
//////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   imgOver
//
//**************************************************************************************************************
//
//  Example)
//      <img src="/_image/common/ÀÌ¹ÌÁö.jpg" alt="" title="" onmouseover="imgOver(this)" onmouseout="imgOver(this,'out')">
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function imgOver(imgEl,opt) {
    var src = imgEl.getAttribute('src');
    var ftype = src.substring(src.lastIndexOf('.'), src.length);
    
    if (opt == 'out') imgEl.src = imgEl.src.replace("_o"+ftype, ftype);
    else imgEl.src = imgEl.src.replace(ftype, "_o"+ftype);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   eaChg(
//
//**************************************************************************************************************
//
//  Usage) input text ¼ýÀÚ up & down
//
//  Example)
//      <img src="¾÷" alt="" title="" onclick="eaChg(f,pm)">
//      <img src="´Ù¿î" alt="" title="" onclick="eaChg(f,pm)">
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function eaChg(f,pm){
    if (pm == 1) {
        f.buy_ea.value++;
    }else {
        if (f.buy_ea.value <= 1) return;
        f.buy_ea.value--;
    }
}

function imgresize(obj, limit, open) {//ÀÌ¹ÌÁö ¸®»çÀÌÂ¡
    var box = document.getElementById(obj);
	if (!box) return true;
    var img = box.getElementsByTagName('img');

	if (img.length > 0){
		for (var i=0;i<img.length;i++) {
			var iSrc = img[i].src;
			
			if (img[i].offsetWidth > limit) {
				img[i].style.width = limit+"px";
				img[i].style.cursor='pointer';
				if (!open){
					img[i].onclick = function(){
						window.open(this.src);
					}
				}
			}
		}
	}
}

function acheck(no) {
    var aa = document.getElementById('middleCate'+no);
    var li_obj = aa.getElementsByTagName("a").length;
    document.getElementById('middleCate'+no).style.width = 80 * li_obj;
}
