//flash
function flash_contents(file,width,height){
	document.writeln("<OBJECT classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' WIDTH='"+width+"' HEIGHT='"+height+"' id='contents' ALIGN=''>");
	document.writeln("<PARAM NAME=movie value='"+file+"' />");
	document.writeln("<PARAM NAME=quality VALUE=high>");
	document.writeln("<PARAM NAME=bgcolor VALUE=#fff>");
	document.writeln("<PARAM NAME=menu VALUE=false>");
	document.writeln("<PARAM NAME=wmode VALUE=transparent> ");
	document.writeln("<embed src='"+file+"' quality='high' bgcolor='#fff' width='"+width+"' height='"+height+"' name='contents' align='left' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.writeln("</OBJECT>");
}

function flash_contents_new(file, xml, login, width, height) {
	document.writeln("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-4445535100%00' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+width+"' height='"+height+"' id='main' align='middle'>");
	document.writeln("<param name='allowScriptAccess' value='always' />");
	document.writeln("<param name='allowFullScreen' value='false' />");
	document.writeln("<param name='movie' value='"+file+"?xmlURL="+xml+"&login="+login+"' />");
	document.writeln("<param name='quality' value='high' />");
	document.writeln("<param name='bgcolor' value='#fcfaf8' />");
	document.writeln("<param name='scale' value='noscale' />");
	document.writeln("<param name='wmode' value='transparent' />");
	document.writeln("<embed src='"+file+"' quality='high' bgcolor='#fcfaf8' width='"+width+"' height='"+height+"' name='main' wmode='transparent' align='middle' allowScriptAccess='always' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' scale='noscale'/>");
	document.writeln("</object>");
}

function flash_contents_intro(file, width, height) {
	document.writeln("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+width+"' height='"+height+"' id='intro' align='middle'>");
	document.writeln("<param name='allowScriptAccess' value='always' />");
	document.writeln("<param name='allowFullScreen' value='false' />");
	document.writeln("<param name='movie' value='"+file+"' />");
	document.writeln("<param name='quality' value='high' />");
	document.writeln("<param name='bgcolor' value='#FBFAF6' />");
	document.writeln("<embed src='"+file+"' quality='high' bgcolor='#FBFAF6' width='"+width+"' height='"+height+"' name='intro' align='middle' allowScriptAccess='always' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.writeln("</object>");
}

//#############¹®ÀåÃ¼Å©############################
String.prototype.trim=function(){
	 var str=this.replace(/(\s+$)/g,"");
	 return str;
}


//##### Flash¸¦ ÆäÀÌÁö¿¡ ³ÖÀ»¶§
function showFlash(swfUrl,swfW,swfH,bg,wmode,code,id){
	document.writeln(getFlash(swfUrl,swfW,swfH,bg,wmode,code,id));
}


function getFlash(swfUrl,swfW,swfH,bg,wmode,code,id)
{
	var result = "";
	if(id==''||id===undefined){idStr='id=House'}else{idStr='id='+id}
	if(wmode){
		wmodeStr1='<param name="wmode" value="transparent" />'
		wmodeStr2='wmode=transparent'
	} else {
		wmodeStr1='<param name="wmode" value="opaque" />';
		wmodeStr2='wmode=opaque';
	}
	result += ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '+idStr+' width='+swfW+' height='+swfH+'>')
	result += ('<param name="movie" value="'+swfUrl+'" />')
	result += ('<param name="menu" value="false" />')
	result += ('<param name="allowScriptAccess" value="always" />')
	result += ('<param name="quality" value="best" />')
	result += ('<param name="flashVars" value="'+code+'" />')
	result += (wmodeStr1)
	result += ('<embed src="'+swfUrl+'" width='+swfW+' height='+swfH+' '+idStr+' '+wmodeStr2+' menu=false allowScriptAccess=always quality=best type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
	result += ('</object>')

	return result;
}


//##### Á¡¼±Á¦°Å
function bluring(){
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;

//#############¹®ÀåÃ¼Å©############################
String.prototype.trim=function(){
	 var str=this.replace(/(\s+$)/g,"");
	 return str;
}


function detProductPopup(vps_cd) {
	var uri	= "/product/view_pop.asp?vps_cd=" + vps_cd;
	window.open(uri, '½ºÆ÷Ã÷ÀÌº¥Æ®°¶·¯¸®','width=670,height=800,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no');
}

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.0
  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 && document.getElementById) x=document.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];}
}


//############# Layer Popup ############################


function SLB_setCenter(obj) {
	if (obj) {
		var h = window.innerHeight || self.innerHeight || document.body.clientHeight;
		var w = window.innerWidth || self.innerWidth || document.body.clientWidth;
		//var l = (document.body.scrollLeft + ((w-(obj.width||parseInt(obj.style.width)||obj.offsetWidth))/2));
		var l = 0;
		//var t = (document.body.scrollTop + ((h-(obj.height||parseInt(obj.style.height)||obj.offsetHeight))/2));
		var t = 0;
		if((obj.width||parseInt(obj.style.width)||obj.offsetWidth) >= w) l = 0;
		if((obj.height||parseInt(obj.style.height)||obj.offsetHeight) >= h) t = document.body.scrollTop;
		document.getElementById('SLB_content').style.left = l + "px";

		if(SLB_cnt == 0) {
			document.getElementById('SLB_content').style.top = t + "px";
			if(document.getElementById('SLB_content').offsetHeight >= h) {
				SLB_cnt ++;
			}
		}
		obj.style.visibility = 'visible';
		if(obj.nextSibling && (obj.nextSibling.className == 'SLB_close' || obj.nextSibling.className == 'SLB_caption')) {
			obj.nextSibling.style.display = 'block';
			if(document.getElementById('SLB_content').offsetHeight < h) {
				document.getElementById('SLB_content').style.top = parseInt(document.getElementById('SLB_content').style.top) -  (obj.nextSibling.offsetHeight/2) + "px";
			}
		}
		if(!arguments[1]) {
			document.getElementById('SLB_loading').style.display = "none";
		} else {
			obj.style.left = l + "px";
			obj.style.top = t + "px";
		}
	}
}


var SLB_cnt = 0;
function SLB_show(url, type)
{
	var a = document.getElementById('SLB_film');
	var b = document.getElementById('SLB_content');
	var c = document.getElementById('SLB_loading');

	var win_width = document.body.clientWidth - 0;
	var win_height = document.body.clientHeight - 0;

	if(url) {
		a.style.top = 0;
		a.style.left = 0;
		a.style.display = "";
		a.style.width = document.body.scrollWidth + 'px';
		a.style.height = document.body.scrollHeight + 'px';
		
		document.getElementById('SLB_loading').style.display = "block";
		SLB_setCenter(c,true);
		
		if(type == 'image') {
			b.innerHTML="<img src=" + url + " class='SLB_center' onload='SLB_setCenter(this);' />";
			if(arguments[2]) a.onclick = function () { SLB_show() };
			if(arguments[3]) b.innerHTML += "<div class='SLB_caption'>"+ arguments[3] +"</div>";
		} else if (type == 'iframe') {
			//b.innerHTML="<iframe src=" + url + " width="+ arguments[2] +" height="+ arguments[3] +" class='SLB_center' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' onload='SLB_setCenter(this);' /></iframe>";
			if(!document.getElementById("SLB_film")) return false;
			document.getElementById("SLB_film").style.width = "1600px";
			document.getElementById("nutrilite_gnb").style.width = "1600px";
			document.getElementById("dvwrap").style.width = "1600px";
			document.getElementById("dvhead").style.width = "1600px";
			b.innerHTML = "<iframe src=" + url + " width='1600' height='850' class='SLB_center' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' scrolling='no' onload='SLB_setCenter(this);' allowTransparency='true' /></iframe>";
			//b.innerHTML = "<iframe src=" + url + " width=" + win_width + " height=" + win_height + " class='SLB_center' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' scrolling='no' onload='SLB_setCenter(this);' allowTransparency='true' /></iframe>";
			//if(arguments[4]) {
			//	b.innerHTML = "<div class='SLB_close' onclick='SLB_show();' title='´Ý±â'>close</div>";
			//}
			//b.onclick = ''; b.firstChild.style.cursor = 'default';
		} else if (type == 'html'){
			b.innerHTML = url;
			SLB_setCenter(b.firstChild);
			if(arguments[2]) b.onclick = '';
		}
//		else if (type == 'tag'){
			//b.innerHTML = url;
			//SLB_setCenter(b.firstChild);
			//showFlash(url+",'202','200','','1','','ABNshopping'");
			//if(arguments[2]) b.onclick = '';


//			b.innerHTML += "<div style='border:1px solid red;'>";
//			b.innerHTML += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='202' height='200' id='ABNshopping' align='middle'>";
//			b.innerHTML += "<param name='allowScriptAccess' value='always' />";
//			b.innerHTML += "<param name='allowFullScreen' value='false' />";
//			b.innerHTML += "<param name='movie' value="+url+" />";
//			b.innerHTML += "<param name='quality' value='high' />";
//			b.innerHTML += "<param name='bgcolor' value='#FBFAF6' />";
//			b.innerHTML += "<embed src="+url+" quality='high' bgcolor='#FBFAF6' width='202' height='200' name='ABNshopping' align='middle' allowScriptAccess='always' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
//			b.innerHTML += "</object>";
//			b.innerHTML += "</div>";
//		}

	//hideSelect();
	} else {
		if(!document.getElementById("SLB_film")) return false;
		document.getElementById("SLB_film").style.width = "100%";
		document.getElementById("nutrilite_gnb").style.width = "100%";
		document.getElementById("dvwrap").style.width = "100%";
		document.getElementById("dvhead").style.width = "100%";
		document.getElementById("start").focus();
		
		a.onclick = '';
		a.style.display = "none";
		b.innerHTML = "";
		b.onclick = function () { SLB_show() };
		c.style.display = "none";
		//showSelect();
		SLB_cnt = 0;
	}
}
