//flash(Ãâ·Â¿µ¿ªID¹×NAME,ÇÃ·¡½ÃÆÄÀÏ°æ·Î,WIDTH,HEIGHT,FLASHVARS,BackgroundColor,WMOD)
function flash(fid,fnm,wid,hei,fvs,bgc,wmd) {
	var flash_tag = "";
	flash_tag = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+wid+'" height="'+hei+'" id="'+fid+'" align="middle">';
	flash_tag +='<param name="allowScriptAccess" value="always" />';
	flash_tag +='<param name="allowFullScreen" value="false" />';
	flash_tag +='<param name="movie" value="'+fnm+'" />';
	flash_tag +='<param name="FlashVars" value="'+fvs+'" />';
	flash_tag +='<param name="quality" value="high" />';
	flash_tag +='<param name="bgcolor" value="'+bgc+'" />';
	flash_tag +='<param name="wmode" value="'+wmd+'" />';
	flash_tag +='<embed src="'+fnm+'" quality="high" bgcolor="'+bgc+'" FlashVars="'+fvs+'" wmode="'+wmd+'" width="'+wid+'" height="'+hei+'" name="'+fid+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	flash_tag +='</object>';
	
	document.write(flash_tag);
}

// png ÆÄÀÏ Åõ¸í Ã³¸® 
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 '';
}

// ÀÌ¹ÌÁö ¿À¹ö/¾Æ¿ô
function imageOver(imgs) {
	imgs.src = imgs.src.replace("off.gif", "on.gif");
}
function imageOut(imgs) {
	imgs.src = imgs.src.replace("on.gif", "off.gif");
}

/*
// select full down
$(document).ready(function() {
	var stateA = 'show';
	var stateB = 'show';
	var stateC = 'show';
	var stateD = 'show';
	// line up
	$('#lineUpSelTitle').click(function() {
		if (stateA == 'show') {
			$('#lineUpSel').show();
			stateA = '';
		} else {
			$('#lineUpSel').hide();
			stateA = 'show';
		}
	});

	$('#lineUpSel > ul > li > a').click(function() {
		var seltxt = this.firstChild.nodeValue;
		document.getElementById('lineUpSelTitle').firstChild.nodeValue = seltxt;
		$('#lineUpSel').hide();
		stateA = 'show';
	});


	// Collection
	$('#collectionSelTitle').click(function() {
		if (stateB == 'show') {
			$('#collectionSel').show();
			stateB = '';
		} else {
			$('#collectionSel').hide();
			stateB = 'show';
		}
	});

	$('#collectionSel > ul > li > a').click(function() {
		var seltxt = this.firstChild.nodeValue;
		document.getElementById('collectionSelTitle').firstChild.nodeValue = seltxt;
		$('#collectionSel').hide();
		stateB = 'show';
	});

	// season
	$('#seasonSelTitle').click(function() {
		if (stateC == 'show') {
			$('#seasonSel').show();
			stateC = '';
		} else {
			$('#seasonSel').hide();
			stateC = 'show';
		}
	});

	$('#seasonSel > ul > li > a').click(function() {
		var seltxt = this.firstChild.nodeValue;
		document.getElementById('seasonSelTitle').firstChild.nodeValue = seltxt;
		$('#seasonSel').hide();
		stateC = 'show';
	});

	// season02
	$('#seasonSelTitle02').click(function() {
		if (stateC == 'show') {
			$('#seasonSel02').show();
			stateC = '';
		} else {
			$('#seasonSel02').hide();
			stateC = 'show';
		}
	});

	$('#seasonSel02 > ul > li > a').click(function() {
		var seltxt = this.firstChild.nodeValue;
		document.getElementById('seasonSelTitle02').firstChild.nodeValue = seltxt;
		$('#seasonSel02').hide();
		stateC = 'show';
	});

	// designer
	$('#designerSelTitle').click(function() {
		if (stateD == 'show') {
			$('#designerSel').show();
			stateD = '';
		} else {
			$('#designerSel').hide();
			stateD = 'show';
		}
	});

	$('#designerSel > ul > li > a').click(function() {
		var seltxt = this.firstChild.nodeValue;
		document.getElementById('designerSelTitle').firstChild.nodeValue = seltxt;
		$('#designerSel').hide();
		stateD = 'show';
	});
});
*/

   
/*	General DOM-Traversal Utilities and Helper Functions
	----------------------------------------------- */
	function getElements(classname, tagname, root){
		if(!root) root = document;
		else if (typeof root == "string") root = document.getElementById(root);
		if(!tagname) tagname = "*";
		var all = root.getElementsByTagName(tagname);
		if(!classname) return all;
		var elements = [];
		for(var i = 0; i < all.length; i++){
			var element = all[i];
			if(isMember(element,classname))
				elements.push(element)
		}
		return elements;
	}
	function isMember(element, classname){
		var classes = element.className;
		if(!classes) return false;
		if(classes ==classname) return true;
		var whitespace = /\s+/;
		if (!whitespace.test(classes)) return false;
		var c = classes.split(whitespace);
		for(var i = 0; i < c.length; i++)
			if (c[i] == classname) return true;
		return false;
	}
	function isDescendant(ancestor, descendant){
		if(!ancestor || !descendant) return;
		var similarDescendants = ancestor.getElementsByTagName(descendant.nodeName);
		for(var i=0; i<similarDescendants.length; i++)
			if( similarDescendants[i] == descendant ) return true;
		return false;
	}
    function getAncestors(element){
        var parents = new Array( );
        while( element.parentNode ){
            if( element.parentNode.nodeType == 1 )
                parents.push(element.parentNode);
                element = element.parentNode;
        }
        return parents;
    }


// DropdownMenu ½ºÅ¸ÀÏ ¸¶¿ì½º ¿À¹ö ·¹ÀÌ¾î
function DropdownMenu(args){
	this.args = args;
	this.list = document.getElementById(args.listId);
	this.itemElements = this.getItems( );
	this.itemObjects = this.setupItems( );
}
DropdownMenu.prototype.getItems = function( ){
	var itemElements = new Array( );
	for(var i=0; i<this.list.childNodes.length; i++)
		if(this.list.childNodes[i].nodeName == 'LI')
			itemElements.push(this.list.childNodes[i]);
	return itemElements;
}
DropdownMenu.prototype.setupItems = function( ){
	var itemObjects, openFunc, closeFunc;
	openFunc = this.openFunc, closeFunc = this.closeFunc;
	itemObjects = new Array( );
	for(var i=0; i<this.itemElements.length; i++)
		itemObjects.push(
			new DropdownItem({
				itemElement: this.itemElements[i],
				hiddenMenuClass: this.args.hiddenMenuClass,
				openFunc: this.args.openFunc,
				closeFunc: this.args.closeFunc
			}) 
		);
	return itemObjects;
}

function DropdownItem(args){
	var instance = this;
	this.itemElement = args.itemElement;
	this.trigger = getElements(args.triggerClass,null,this.itemElement)[0];
	this.openFunc = args.openFunc;
	this.closeFunc = args.closeFunc;
	this.menu = getElements(args.hiddenMenuClass,null,this.itemElement)[0];
	if(this.menu){
		this.itemElement.onmouseover = function(event){instance.handleLIMouseOver(event);}
		this.itemElement.onmouseout = function(event){instance.handleLIMouseOut(event);}
	}
}
DropdownItem.prototype.handleLIMouseOver = function(event){
	var evt, prevElement, useId, tmpName;
	evt = event || window.event;
	prevElement = evt.relatedTarget || evt.fromElement;
	if(prevElement != this.itemElement && !isDescendant(this.itemElement,prevElement)) {
		tmpName = "" + this.itemElement.id;
		useId = tmpName.substring(4,5);
		this.activate( );
	}
}
DropdownItem.prototype.handleLIMouseOut = function(event){
	var evt, nextElement, useId, tmpName;
	evt = event || window.event; 
	nextElement = evt.relatedTarget || evt.toElement;
	if(nextElement != this.itemElement && !isDescendant(this.itemElement,nextElement)) {
		tmpName = "" + this.itemElement.id;
		useId = tmpName.substring(4,5);
		this.deactivate( );
	}
}
DropdownItem.prototype.activate = function(event){
	this.menu.className = this.menu.className.replace(/inactive/g,'');
	var ancestors = getAncestors(this.menu);
	for(var i=0; i<ancestors.length; i++)
		ancestors[i].style.zIndex = '5'
	if(this.openFunc) this.openFunc( );
}
DropdownItem.prototype.deactivate = function(event){
	var ancestors = getAncestors(this.menu);
	for(var i=0; i<ancestors.length; i++)
		ancestors[i].style.zIndex = ''
	this.menu.className += ' inactive';
	if(this.closeFunc) this.closeFunc( );
}

/*
// bg È°¼ºÈ­
$(document).ready(function() {
	$('.popularVideo > ol > li, .casterList > ol > li, .elleFileList > li').mouseover(function() {
		$(this).addClass('overBg');
	});
	
	$('.popularVideo > ol > li, .casterList > ol > li, .elleFileList > li').mouseout(function() {
		$(this).removeClass('overBg');
	});
});
*/

/* line up select(trend) //////// ¼öÁ¤ ÇÊ¿ä
function trendSelector(id) {
	var idObj = document.getElementById('trendType'+id);
	
	$('.trend > dd > .thumb').click(function() {
		for(i=1; i<8; i++) {
			if(i == id) {
				idObj.src = idObj.src.replace("off.gif", "on.gif");
			} else {
				document.getElementById('trendType'+i).src = document.getElementById('trendType'+i).src.replace("on.gif", "off.gif");
			}
		}
		$('.trend > dd > .thumb').removeClass('selectTrendBeauty');
		$(this).addClass('selectTrendBeauty');
	});
}
*/

/*
// line up select(color)
$(document).ready(function() {
	$('.color > .defult > dd').click(function() {
		$('.color > .defult > dd').removeClass('selectColor');
		$(this).addClass('selectColor');
	});

	$('.color > .related > dd').click(function() {
		$('.color > .related > dd').removeClass('selectColor');
		$(this).addClass('selectColor');
	});
});
*/

// ½ºÆä¼È ¹è³Ê
function endBannerMovie() {
	$('#sbannerWrap').hide();
}

// search layer
function searchScale(str) {
	if(str == "O") {
		document.getElementById('search').style.height = "211";
	} else {
		document.getElementById('search').style.height = "20";
	}
}

// hide, show
function showHide(obj, current) {
	if(current == 0) {
		$('#' + obj + '').hide();
	} else {
		$('#' + obj + '').show();
	}
}

// toggle 
function toggle(obj, count) {
	count = count + 1;

	for(i=1; i<count; i++) {
		$('#toggle' + i + '').hide();
	}
	$('#' + obj + '').show();
}

/*
$(document).ready(function() {
	var num = $('.number > li > img').length + 1;
	$('.number > li > a > img, .abc > li > a > img, .hangul > li > a > img').mouseover(function() {
		this.src = this.src.replace("off.gif", "on.gif");
	});

	$('.number > li > a > img, .abc > li > a > img, .hangul > li > a > img').mouseout(function() {
		this.src = this.src.replace("on.gif", "off.gif");
	});
});
*/

//function openPopup(){
//	window.open('/footer/emailPopup.html','email','width=366,height=228');
//}

function openPopupZip(){
	window.open('/popup/zipcodePop.html','scrap','width=366,height=176');
}

function openPopupZipT(){
	window.open('/popup/zipcodePop_s.html','scrap','width=366,height=176');
}

function LoginCheck(){
		alert('·Î±×ÀÎÀÌ ÇÊ¿äÇÕ´Ï´Ù.\n·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿ÇÏ½Ã°Ú½À´Ï±î?');
		location.href='http://ssl.elle.co.kr/login/login.html?rurl=' + encodeURIComponent(document.location);
	}

/*******************************************************************

	popup ¶ç¿ì´Â ÇÔ¼ö

*******************************************************************/
function openPopup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}