/********************************* IMAGE_ROLLOVER ½ºÅ©¸³Æ® ***************************/
function menuOn(imgEl)
{
	imgEl.src = imgEl.src.replace(".gif", "_ov.gif");
}

function menuOut(imgEl)
{
	imgEl.src = imgEl.src.replace("_ov.gif", ".gif");
}
/********************************* IMAGE_ROLLOVER ½ºÅ©¸³Æ® ***************************/

/********************************* tab ***************************/
function tabSwap(sw) {
	for (i = 1; i < 7; i++) {
		if (sw == i) {		
			document.getElementById('tab01_0'+i+'contents').style.display='';
		} else {
			document.getElementById('tab01_0'+i+'contents').style.display='none';
		}
	}
}
/********************************* tab ***************************/

/********************************* ÆË¾÷ ***************************/
var win= null;
function NewWindow(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
/********************************* ÆË¾÷ ***************************/

function inno_brand_menu(main) {
	switch (main) {
		case 0: location.href = "/brand_inno/brand_story.php"; return;
		case 1: location.href = "/brand_inno/news_list.php"; return;
	}
}

function inno_user_menu(main) {
	switch (main) {
		case 0: location.href = "/customer/notice_list.php"; return;
		case 1: location.href = "/customer/board_list.php"; return;
		case 2: location.href = "/customer/photoBoard_list.php"; return;
		case 3: location.href = "/customer/event_list.php"; return;
	}
}

function inno_service_menu(main) {
	switch (main) {
		case 0: location.href = "/service/downloads.php"; return;
		case 1: location.href = "/service/faq_list.php"; return;
		case 2: location.href = "/service/service.php"; return;
	}
}

function inno_membership_menu(main) {
	switch (main) {
		case 0: location.href = "/member/login.php"; return;
		case 1: location.href = "/member/join_step01.php"; return;
		case 2: location.href = "/member/find_id.php"; return;
	}
}

function inno_order_menu(main) {
	switch (main) {
		case 0: location.href = "/order/shopping_cart.php"; return;
		case 1: location.href = "/order/order.php"; return;
		case 2: location.href = "/order/payment.php"; return;
		case 3: location.href = "/order/order_finish.php"; return;
	}
}

function inno_sdo_menu(main) {
	switch (main) {
		case 0: location.href = "/customer/sdoBoard_list.php?sel_type=5"; return;
		case 1: location.href = "/customer/sdoBoard_list.php?sel_type=6"; return;
		case 2: location.href = "/customer/sdoBoard_list.php?sel_type=7"; return;
		case 3: location.href = "/customer/sdoBoard_list.php?sel_type=8"; return;
		case 4: location.href = "/customer/sdoBoard_list.php?sel_type=9"; return;
	}
}

function inno_mypage_menu(main, sub) {
//	alert("main=" + main + ", sub=" + sub);
	flag = "";
	switch (main) {
		case 1: 
			switch (sub) {
				case 1: location.href = "/mypage/info_edit.php"; return;
				case 2: location.href = "/mypage/pro_register.php"; return;
				case 3: location.href = "/mypage/mem_out.php"; return;
		}
		case 2:
			switch (sub) {
				case 1: location.href = "/mypage/order_reference.php"; return;
				case 2: location.href = "/mypage/inquiry_list.php"; return;
				case 3: location.href = "/mypage/product_inquiry_list.php"; return;
				case 4: location.href = "/mypage/shop_history.php"; return;
				case 5: location.href = "/mypage/address_mng.php"; return;
				case 6: location.href = "/mypage/wish_list.php"; return;
		}
	}
}

function mainLink(main) {
	switch (main) {
		case 0: location.href = "/index.php"; return;
		case 1: location.href = "/brand_inno/brand_story.php"; return;
		case 2: location.href = "http://shop.inno.co.kr/shop/main/index.php"; return;
		case 3: location.href = "/product/product.php"; return;
		case 4: location.href = "/customer/notice_list.php"; return;
		case 5: location.href = "/service/service.php"; return;
		case 6: location.href = "/customer/sdoBoard_list.php?sel_type=5"; return;
	}
}

function subLink(main) {
	switch (main) {
		case 1: location.href = "/brand_inno/brand_story.php"; return;
		case 2: location.href = "/brand_inno/news_list.php"; return;
		case 3: location.href = "/customer/notice_list.php"; return;
		case 4: location.href = "/customer/board_list.php"; return;
		case 5: location.href = "/customer/event_list.php"; return;
		case 6: location.href = "/service/downloads.php"; return;
		case 7: location.href = "/service/faq_list.php"; return;
		case 8: location.href = "/service/service.php"; return;
		case 9: location.href = "/customer/photoBoard_list.php"; return;
		
		//case 10: alert("ÁØºñÁßÀÔ´Ï´Ù."); return;
		//case 11: alert("ÁØºñÁßÀÔ´Ï´Ù."); return;
		//case 12: alert("ÁØºñÁßÀÔ´Ï´Ù."); return;
		//case 13: alert("ÁØºñÁßÀÔ´Ï´Ù."); return;
		//case 14: alert("ÁØºñÁßÀÔ´Ï´Ù."); return;

		case 10: location.href = "/customer/sdoBoard_list.php?sel_type=5"; return;
		case 11: location.href = "/customer/sdoBoard_list.php?sel_type=6"; return;
		case 12: location.href = "/customer/sdoBoard_list.php?sel_type=7"; return;
		case 13: location.href = "/customer/sdoBoard_list.php?sel_type=8"; return;
		case 14: location.href = "/customer/sdoBoard_list.php?sel_type=9"; return;
	}
}

function inno_law_menu(main) {
	switch (main) {
		case 0: location.href = "/law_info/protect_policy.php"; return;
		case 1: location.href = "/law_info/use_guide.php"; return;
		case 2: NewWindow('/law_info/pop_email_refuse.php','name','625','393','no'); return;
	}
}

function inno_store_menu(main, sub) {
//	alert("main=" + main + ", sub=" + sub);
	switch (main) {
		case 1: 
			switch (sub) {
				case 1: location.href = "/store/store_list.php"; return;
				case 2: location.href = "/store/store_list.php"; return;
				case 3: location.href = "/store/store_list.php"; return;
				case 4: location.href = "/store/store_list.php"; return;
				case 5: location.href = "/store/store_list.php"; return;
				case 6: location.href = "/store/store_list.php"; return;
				case 7: location.href = "/store/store_list.php"; return;
		}
		case 2:
			switch (sub) {
				case 1: location.href = "/store/store_list.php"; return;
				case 2: location.href = "/store/store_list.php"; return;
		}
		case 3:
			switch (sub) {
				//case 1: location.href = "#"; return;
				//case 2: location.href = "#"; return;
				//case 3: location.href = "#"; return;
				//case 4: location.href = "#"; return;
				//case 5: location.href = "#"; return;
				//case 6: location.href = "#"; return;
		}
		case 4:
			switch (sub) {
				case 1: location.href = "/store/support_faq_list.php"; return;
				case 2: location.href = "/store/support_history_list.php"; return;
				case 3: location.href = "/store/support_qna_list.php"; return;
		}
	}
}



/********************************* flash ***************************/
function embedFlash(id, url, width, height, altText, flashVars, wmode) {
	if (!flashVars) flashVars = '';
	if (!wmode) wmode = 'window';
	if (!altText) altText = '<p style="padding-right: 8px;">ÇÃ·¡½Ã ÇÃ·¯±×ÀÎÀÌ ¼³Ä¡µÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù.<br />¾Æ·¡ ¸µÅ©¸¦ Å¬¸¯ÇÏ½Ã¸é ÇÃ·¯±×ÀÎ ´Ù¿î·Îµå ÆäÀÌÁö·Î ÀÌµ¿ÇÕ´Ï´Ù.<br /><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=shockwaveFlash">ÇÃ·¡½Ã ÇÃ·¯±×ÀÎ ´Ù¿î·Îµå ÆäÀÌÁö</a></p>';

	var str = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="' + width + '" height="' + height + '" id="' + id + '">' +
		'<param name="movie" value="' + url + '" />' +
		'<param name="wmode" value="' + wmode + '" />' +
		'<param name="FlashVars" value="' + flashVars + '" />' +
		'<!--[if !IE]>-->' +
		'<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '">' +
			'<param name="wmode" value="' + wmode + '" />' +
			'<param name="FlashVars" value="' + flashVars + '" />' +
		'<!--<![endif]-->' +
			'<div class="alt-content">' + altText + '</div>' +
		'<!--[if !IE]>-->' +
		'</object>' +
		'<!--<![endif]-->' +
	'</object>';
	document.write(str);
}
function embedFlash1(id, url, width, height, altText, flashVars, wmode) {
	if (!flashVars) flashVars = '';
	if (!wmode) wmode = 'window';
	if (!altText) altText = '<p style="padding-right: 8px;">ÇÃ·¡½Ã ÇÃ·¯±×ÀÎÀÌ ¼³Ä¡µÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù.<br />¾Æ·¡ ¸µÅ©¸¦ Å¬¸¯ÇÏ½Ã¸é ÇÃ·¯±×ÀÎ ´Ù¿î·Îµå ÆäÀÌÁö·Î ÀÌµ¿ÇÕ´Ï´Ù.<br /><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=shockwaveFlash">ÇÃ·¡½Ã ÇÃ·¯±×ÀÎ ´Ù¿î·Îµå ÆäÀÌÁö</a></p>';

	var str = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="' + width + '" height="' + height + '" id="' + id + '">' +
		'<param name="movie" value="' + url + '" />' +
		'<param name="wmode" value="' + wmode + '" />' +
		'<param name="FlashVars" value="' + flashVars + '" />' +
		'<!--[if !IE]>-->' +
		'<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '">' +
			'<param name="wmode" value="' + wmode + '" />' +
			'<param name="FlashVars" value="' + flashVars + '" />' +
		'<!--<![endif]-->' +
			'<div class="alt-content">' + altText + '</div>' +
		'<!--[if !IE]>-->' +
		'</object>' +
		'<!--<![endif]-->' +
	'</object>';
	document.write(str);
}
function embedFlash2(id,url,width,height,altText,flashVars,winMode){

	if (!flashVars) flashVars = '';
	if (!winMode) winMode = 'window';
	if (!altText) altText = '';

	var flashStr= "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+width+"' height='"+height+"' id='"+id+"' align='middle'>" +
	"<param name='movie' value='"+url+"' />" +
	"<param name='FlashVars' value='"+flashVars+"' />" +
	"<param name='wmode' value='"+winMode+"' />" +
	"<param name='menu' value='false' />" +
	"<param name='quality' value='high' />" +
	
	"<embed src='"+url+"' flashVars='"+flashVars+"' wmode='"+winMode+"' menu='false' quality='high' width='"+width+"' height='"+height+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer' /></object>";

	document.write(flashStr);
}

/********************************* flash ***************************/


/* footer links */
function selectToLink(value) {
	switch (value)
	{
		case "1": window.open('http://www.innogdn.com', '_blank'); return;
		case "2": window.open('http://www.innodesign.com', '_blank'); return;
		case "3": window.open('http://www.innoman.co.kr', '_blank'); return;
		case "4": window.open('http://www.lifecord.co.kr', '_blank'); return;
		default: return;
	}
}

/* clipboard copy */
function copy(ele) {
	targetImg = ele.parentNode.parentNode.getElementsByTagName("img");
	imgSrc =  targetImg[0].src;
	str = '<img src="' + imgSrc + '" alt="" />';
	var flashcopier = 'flashcopier';
	if(!document.getElementById(flashcopier)) {
		var divholder = document.createElement('div');
		divholder.id = flashcopier;
		document.body.appendChild(divholder);
	}
	document.getElementById(flashcopier).innerHTML = '';
	var divinfo = '<embed src="/flash/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(str)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
	document.getElementById(flashcopier).innerHTML = divinfo;
	alert("ÀÌ¹ÌÁö °æ·Î°¡ º¹»çµÇ¾ú½À´Ï´Ù.");
}

function imgDown(ele) {
	targetImg = ele.parentNode.parentNode.getElementsByTagName("img");
	imgSrc =  targetImg[0].src;
	ele.setAttribute("href", imgSrc);
}

/* µû¶ó´Ù´Ï´Â top ¹öÆ° */
/* constructor */
/* ÀÎ¼ö´Â (¿¤¸®¸ÕÆ® id, ÃÊ±â top °ª, (¼±ÅÃ»çÇ×) bottom ¸¶Áø) */
function floatedLayer(eleName, initialTop, bottomLimit) {

	if (!document.getElementById(eleName)) { return; }
	
	this.ele = document.getElementById(eleName);
	this.initialTop = initialTop;
	this.bottomLimit = (!bottomLimit)? 0 : bottomLimit;
	this.timer = null;
	this.moveLayer();
}

/* class property */
floatedLayer.INTERVAL = 10; /* µ¿ÀÛ °£°Ý: (´ÜÀ§: ¹Ð¸®ÃÊ(ms)) */
floatedLayer.DEGREE = 5; /* ¿òÁ÷ÀÓ Á¤µµ: (´ÜÀ§: ÆÛ¼¾Æ®, 0 < ¹üÀ§ <= 100) */


/* instance method */
floatedLayer.prototype.moveLayer = function () {

	var scrollHeight = 0;

	// ½ºÅ©·ÑµÈ ³ôÀÌ °è»ê (Âü°í: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow)
	if (document.body && document.body.scrollTop) {
		scrollHeight = document.body.scrollTop;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		scrollHeight = document.documentElement.scrollTop;
	}

	var top = (isNaN(parseInt(this.ele.style.top)))? this.initialTop : parseInt(this.ele.style.top);
	var exactHeight = scrollHeight + this.initialTop;

	var moveHeight = Math.ceil(Math.abs(top - exactHeight) * floatedLayer.DEGREE / 100);
	
	top = (top > exactHeight)? top - moveHeight : top + moveHeight;

	var documentHeight = document.body.offsetHeight;
	var eleHeight = this.ele.offsetHeight;

	if ((top + eleHeight) >= documentHeight - this.bottomLimit) {
		top = documentHeight - eleHeight - this.bottomLimit;
	}

	this.ele.style.top = top + "px";

	// setTimeout¿¡¼­ ÀÎ½ºÅÏ½º ¸Þ¼Òµå »ç¿ë (Âü°í: http://www.faqts.com/knowledge_base/view.phtml/aid/2311)
	var self = this;
	if (this.timer) {
		window.clearTimeout(this.timer);
	}
	this.timer = window.setTimeout(function () { self.moveLayer(); }, floatedLayer.INTERVAL);
}

/* png24 Ã³¸® */
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 '';
}

/* cookie Ã³¸® */
function setCookie(name, value, expires, path, domain, secure) {
	document.cookie= name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
}

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {
		end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
}
