
// ÀÌ¹ÌÁö ·Ñ¿À¹ö
function over(obj,type){
    if(type) obj.src = obj.src.replace(".gif","_on.gif");
    else  obj.src = obj.src.replace("_on.gif",".gif");
}

// Tab Content
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		if (thismenu.imgEl) {
			thismenu.onclick = function () {
				//this.onclick();
			}
		}
		thismenu.onclick = tabMenuClick;
		
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	tabContainer.first.onclick();
}

function tabMenuClick() {
	currentmenu = this.container.current;
	if (currentmenu != this) {
		if (currentmenu) {
			currentmenu.targetEl.style.display = "none";
			if (currentmenu.imgEl) {
				currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
			} else {
				currentmenu.className = currentmenu.className.replace(" on", "tab");
			}
		}

		this.targetEl.style.display = "block";
		if (this.imgEl) {
			this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
		} else {
			this.className += " on";
		}
		this.container.current = this;
	}
	return false;
}

// ¸ÞÀÎ ³×ºñ°ÔÀÌ¼Ç
function initNavigation(seq) {
	nav = document.getElementById("category");
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;
	
	allA = nav.getElementsByTagName("a")
	for(k = 0; k < allA.length; k++) {
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
		}
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			setTimeout(function () {
				if (nav.isOver == false) {
					if (nav.menu[seq])
						nav.menu[seq].onmouseover();
					else if(nav.current) {
						menuImg = nav.current.childNodes.item(0);
						if (nav.current.submenu)
							nav.current.submenu.style.display = "none";
						nav.current = null;
					}
				}
			}, 500);
		}
	}

	for (i = 0; i < navLen; i++) {
		navItem = nav.childNodes.item(i);
		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);
		
		navAnchor.onmouseover = navAnchor.onfocus = function () {
			if (nav.current) {
				menuImg = nav.current.childNodes.item(0);
				if (nav.current.submenu)
					nav.current.submenu.style.display = "none";
				nav.current = null;
			}
			if (nav.current != this) {
				menuImg = this.childNodes.item(0);
				if (this.submenu)
					this.submenu.style.display = "block";
				nav.current = this;
			}
			nav.isOver = true;
		}
		nav.menuseq++;
		nav.menu[nav.menuseq] = navAnchor;
	}
	if (nav.menu[seq])
		nav.menu[seq].onmouseover();
}

// ÆË¾÷
function pop(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=no,status=1'); } //Popup(½ºÅ©·Ñ¹Ù¾øÀ½)
function pops(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=yes'); } //Popup(½ºÅ©·Ñ¹ÙÀÖÀ½)
function newwin(url){ window.open(url,'new','location=1,directories=1,resizable=1,status=1,toolbar=1,menubar=1,scrollbars=1') } //NewPopup(½ºÅ©·Ñ¹Ù¾øÀ½)

//Product Layer
function prodLayerView(CiPSeq,url){
		var params = {CiPSeq : CiPSeq}
		$("#basicModalContent").html();
		$.post(url, params, function(responseData){
			$("#basicModalContent").html(responseData);
				$("#basicModalContent").modal({
					overlayCss: {backgroundColor:"#000"},
					containerCss:{
						backgroundColor:"transparent",
						padding:0,
						height:403,
						width:485
					},
					autoResize:true
				});
		});
}

//Press Star Layer
function prodLayerView02(CiPSeq,url){
		var params = {CiPSeq : CiPSeq}
		$("#basicModalContent").html();
		$.post(url, params, function(responseData){
			$("#basicModalContent").html(responseData);
				$("#basicModalContent").modal({
					overlayCss: {backgroundColor:"#000"},
					containerCss:{
						backgroundColor:"transparent",
						padding:0,
						height:480,
						width:280
					},
					autoResize:true
				});
		});
}

//Press Magazine Layer
function prodLayerView03(CiPSeq,url){
		var params = {CiPSeq : CiPSeq}
		$("#basicModalContent").html();
		$.post(url, params, function(responseData){
			$("#basicModalContent").html(responseData);
				$("#basicModalContent").modal({
					overlayCss: {backgroundColor:"#000"},
					containerCss:{
						backgroundColor:"transparent",
						padding:0,
						height:682,
						width:478
					},
					autoResize:true
				});
		});
}

//SHOP Layer
function prodLayerView04(CiPSeq,url){
		var params = {CiPSeq : CiPSeq}
		$("#shopContent").html();
		$.post(url, params, function(responseData){
			$("#shopContent").html(responseData);
				$("#shopContent").modal({
					overlayCss: {backgroundColor:"#000"},
					containerCss:{
						backgroundColor:"transparent",
						padding:0,
						height:682,
						width:478
					},
					autoResize:true
				});
		});
}

//All Product Sort
function checkProd(check){
	var prodList = document.getElementById("prodList").getElementsByTagName("li");

	if(check.checked==false){	
		for(i=0; i<prodList.length; i++){
			if(prodList[i].getAttribute("id").indexOf(check.value)>=0){
				prodList[i].style.display="none";
			}
		}
	}
	else{
		for(i=0; i<prodList.length; i++){
			if(prodList[i].getAttribute("id").indexOf(check.value)>=0){
				prodList[i].style.display="block";
			}
		}
	}

}

// ·¹ÀÌ¾î ³ëÃâ
function stdShow(id) {
	document.getElementById(id).style.display = "block";
}
function stdHidden(id) {
	document.getElementById(id).style.display = "none";
}
