////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   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("_1"+ftype, ftype);
    else imgEl.src = imgEl.src.replace(ftype, "_1"+ftype);
}


/*Ã¼Å©¹Ú½º ÀÌ¹ÌÁö·Î*/
/**
 * Created by Çàº¹ÇÑ°í´Ï
 *
 * Homepage    : http://mygony.com
 * Last update : 2005/02/22
 *
 * 2004-09-23 
 *     - Ã¹¹øÂ° ¸±¸®Áî
 * 2005-02-22
 *     - checked ·Î ¼³Á¤ÇßÀ»°æ¿ì Ã¹¹øÂ° Å¬¸¯¿¡ ¹ÝÀÀÇÏÁö ¾Ê´ø ¿À·ù¼öÁ¤ (¿¬È÷ ´Ô)
 *     - undefined Ã¼Å© ±¸¹® ¼öÁ¤ (ºô ´Ô)
 */
function imgCbox(N, tabstop)
{
	var objs, cboxes, Img, Span, A;

	if (typeof N == 'undefined') return false;
	if (typeof tabstop == 'undefined') tabstop = true;
	if ((objs=document.getElementsByName(N)) == null) return false;

	for (var i=0; i < objs.length; i++) {
		if (objs[i].tagName.toLowerCase() != "input" || objs[i].type.toLowerCase() != "checkbox") cnotinue;
		
		if (typeof imgCbox.Objs[N] == 'undefined') {
			imgCbox.Objs[N] = new Array;
			imgCbox.ImgObjs[N] = new Array;
		}
		
		var len = imgCbox.Objs[N].length;
		imgCbox.Objs[N][len] = objs[i];
		imgCbox.ImgObjs[N][len] = {};

		// anchor element for tab stop
		A = document.createElement("A");
		if (tabstop) {
			A.href = "javascript:;";
		}
		A.onclick =  new Function("imgCbox.onclick('"+N+"',"+len+")");
		A.style.borderWidth = "0px";
		A.style.cursor = "pointer";

		// for image cache
		Img = document.createElement("IMG");
		Img.src = objs[i].getAttribute("onsrc");
		Img.style.borderWidth = "0px";
		Img.style.display = objs[i].checked?"":"none";
		imgCbox.ImgObjs[N][len]["on"] = Img;
		A.appendChild(Img);

		Img = document.createElement("IMG");
		Img.src = objs[i].getAttribute("offsrc");
		Img.style.borderWidth = "0px";
		Img.style.display = objs[i].checked?"none":"";
		imgCbox.ImgObjs[N][len]["off"] = Img;
		A.appendChild(Img);

		// insert object
		Span = objs[i].parentNode;
		Span.style.display = "none";
		Span.parentNode.insertBefore(A, Span);

	}
}
imgCbox.onclick = function(N, idx) {
	var C = imgCbox.Objs[N][idx];
	var I = imgCbox.ImgObjs[N][idx];

	C.checked = !C.checked;
	if (C.checked) {
		I["on"].style.display = "";
		I["off"].style.display = "none";
	} else {
		I["on"].style.display = "none";
		I["off"].style.display = "";
	}
	
	// fire event
	if (typeof C.onclick != 'undefined' && C.onclick != null) C.onclick();
}
imgCbox.Objs = {};
imgCbox.ImgObjs = {};

function boxRound(mode,wh) { 
	if (mode=="top") {
			if (wh>0){
		document.write('<table width="'+wh+'" cellspacing="0" cellpadding="0" style="margin:0 auto;">');
			}else{
		document.write('<table width="100%" cellspacing="0" cellpadding="0" style="margin:0 auto;">');
			}
		document.write('<tr>');
		document.write('<td width="8" height="8"><img src="/_image/shop/box_left_top.gif" border="0" alt="" /></td>');
		document.write('<td width="100%" height="8" background="/_image/shop/box_top.gif"></td>');
		document.write('<td width="8" height="8"><img src="/_image/shop/box_right_top.gif" border="0" alt="" /></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td colspan="3" bgcolor="#ececec" style="padding:0 1px;">');
		document.write('<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#f3f3f3">');
		document.write('<tr>');
		document.write('<td style="padding:0 5px;">');
		document.write('<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#ffffff">');
		document.write('<tr>');
		document.write('<td style="padding:3px 5px;">');
	}else if (mode=="bottom") {
		document.write('</td>');
		document.write('</tr>');
		document.write('</table>');
		document.write('</td>');
		document.write('</tr>');
		document.write('</table>');
		document.write('</td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td width="8" height="8"><img src="/_image/shop/box_left_bottom.gif" border="0" alt="" /></td>');
		document.write('<td width="100%" height="8" background="/_image/shop/box_bottom.gif"></td>');
		document.write('<td width="8" height="8"><img src="/_image/shop/box_right_bottom.gif" border="0" alt="" /></td>');
		document.write('</tr>');
		document.write('</table>');
	}
}

function eaChg(f,pm){
    if (pm == 1) {
        f.buy_ea.value++;
    }else {
        if (f.buy_ea.value <= 1) return;
        f.buy_ea.value--;
    }
	totalCal(f);
}



////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   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 go_url(ss)
{
	//alert(ss);

	switch(ss)
	{
		case "01":
			location.replace('/shop/big_section.php?cno1=1001');
		break;
		case "01_01":
			location.replace('/shop/big_section.php?cno1=1009');
		break;
		case "01_02":
			location.replace('/shop/big_section.php?cno1=1010');
		break;
		case "01_03":
			location.replace('/shop/big_section.php?cno1=1011');
		break;


        case "02":
			location.replace('/shop/big_section.php?cno1=1002');
		break;
		case "02_01":
			location.replace('/shop/big_section.php?cno1=1012');
	    break;
		case "02_02":
			location.replace('/shop/big_section.php?cno1=1013');
	    break;
		case "02_03":
			location.replace('/shop/big_section.php?cno1=1014');
	    break;
		case "02_04":
			location.replace('/shop/big_section.php?cno1=1015');
		break;

        case "03":
			location.replace('/shop/big_section.php?cno1=1003');
		break;
		case "03_01":
			location.replace('/shop/big_section.php?cno1=1016');
	    break;
		 case "03_02":
			location.replace('/shop/big_section.php?cno1=1017');
	    break;
		
		case "":
			location.replace('/shop/big_section.php?cno1=1004');
		break;
		case "04_01":
			location.replace('/shop/big_section.php?cno1=1018');
	    break;
		 case "04_02":
			location.replace('/shop/big_section.php?cno1=1019');
	    break;

        case "05":
			location.replace('/shop/big_section.php?cno1=1005');
		break;
		case "05_01":
			location.replace('/shop/big_section.php?cno1=1020');
	    break;
		case "05_02":
			location.replace('/shop/big_section.php?cno1=1021');
	    break;
		case "05_03":
			location.replace('/shop/big_section.php?cno1=1022');
	    break;
		case "05_04":
			location.replace('/shop/big_section.php?cno1=1023');
	    break;
		case "05_05":
			location.replace('/shop/big_section.php?cno1=1024');
	    break;
		case "05_06":
			location.replace('/shop/big_section.php?cno1=1032');
	    break;

		case "06":
			location.replace('/shop/big_section.php?cno1=1006');
		break;

		case "07":
			location.replace('/shop/big_section.php?cno1=1007');
		break;
		case "07_01":
			location.replace('/shop/big_section.php?cno1=1025');
	    break;
		 case "07_02":
			location.replace('/shop/big_section.php?cno1=1026');
	    break;
		case "07_03":
			location.replace('/shop/big_section.php?cno1=1027');
	    break;

		case "08":
			location.replace('/shop/big_section.php?cno1=1008');
		break;
	}
}

function textarea_decrease(id, row)
{
	if (document.getElementById(id).rows - row > 0)
		document.getElementById(id).rows -= row;
}

function textarea_original(id, row)
{
	document.getElementById(id).rows = row;
}

function textarea_increase(id, row)
{
	document.getElementById(id).rows += row;
}

// Bluring onClick

function bluring(){
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring;

function autoBlur(){
	try{
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
	}catch(e) {}
}
document.onfocusin=autoBlur;



// Flash Embedding Script
function FlashMainbody(Ftrans,wid,hei) {
	mainbody = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+ wid +"' height='"+ hei +"'>";
	mainbody += "<param name='movie' value='"+ Ftrans +"'>";
	mainbody += "<param name='quality' value='high'>";
	mainbody += "<param name='wmode' value='transparent'>";
	mainbody += "<param name='menu' value='false'>";
	mainbody += "<param name='allowScriptAccess' value='always'>"; 
	mainbody += "<param name='allowNetworking' value='all'>"; 
	mainbody += "<embed src='"+ Ftrans +"' quality='high' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ wid +"' height='"+ hei +"'></embed>"
	mainbody += "</object>";

	//document.body.innerHTML = mainbody;
	document.write(mainbody);
	return;
}



// png Transparent
function setPng24(obj) { 
  obj.width=obj.height=1; 
  obj.className=obj.className.replace(/\bpng24\b/i,''); 
  obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
  obj.src='';  
  return ''; 
}


//image rollover
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//open new window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

