﻿//popup
function openwin01(sno, filename, item1)
{
	window.open("/include/wallpaper_pop.asp?sno=" + sno +"&filename=" + escape(filename) + "&item1=" + escape(item1) ,"wallpaper1", "width=600px,height=450p,left=0,top=0,resizable=yes")
}

function openwin02(filename)
{
	window.open("/include/screensaver_pop.asp?filename=" + escape(filename),"screensaver","width=640, height=480, left=0 top=0")
}

function openwin03(filename)
{
	window.open("/include/ecard_pop.asp?filename=" + escape(filename),"ecard","width=600px,height=450p,left=0,top=0,resizable=yes")
}

//범용 팝업
function openwin(url,name,width,height)
{
	//var flag = supremoEV.flag.value;
	var winPopAll = window.open(url,name,"width="+width+"px,height="+height+"px,left=10,top=10,resizable=yes,scrollbars=yes,status=yes,toolbar=no,resizable=0,location=no,menu=no")
}

//scrolling
function initMoving(target, topPosition, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = topPosition;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";

	obj.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 0;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 500;
		}
	}
	obj.move = setInterval(function() {
		//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		pos = obj.getTop() + topPosition;

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit
		if (pos < obj.topLimit)
			pos = obj.topLimit

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}

//iframe resize
/*var iframeids=["myframe"] // iframe 에 사용할 ID 를 지정 해 주세요

var iframehide="yes"

function resizeCaller() 
{
	var dyniframe=new Array()
	for (i=0; i<iframeids.length; i++)
	{
		if (document.getElementById)
			resizeIframe(iframeids[i])
		if ((document.all || document.getElementById) && iframehide=="no")
		{
			var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
			tempobj.style.display="block"
		}
	}
}

function resizeIframe(frameid)
{
	var currentfr=document.getElementById(frameid)
	if (currentfr && !window.opera)
	{
		currentfr.style.display="block"
		if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
			currentfr.height = currentfr.contentDocument.body.offsetHeight;
		else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
			currentfr.height = currentfr.Document.body.scrollHeight;
		if (currentfr.addEventListener)
			currentfr.addEventListener("load", readjustIframe, false)
		else if (currentfr.attachEvent)
			currentfr.attachEvent("onload", readjustIframe)
	}
}

function readjustIframe(loadevt) 
{
	var crossevt=(window.event)? event : loadevt
	var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
	if (iframeroot)
		resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url)
{
	if (document.getElementById)
	document.getElementById(iframeid).src=url
}

if (window.addEventListener)
	window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
	window.attachEvent("onload", resizeCaller)
else
	window.onload=resizeCaller
*/




/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	
	// MS phishing filter 로 인해 swfobject detectflash 기능이 의심되는 phishing object로 간주되어
	// SWFObject 가 실행이 안되는 것을 방지하기 위해 detecting 기능을 제외한다.
	this.skipDetect=true;
	//////////////////////
	
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
	
	
	// addRequestParamValue
	// added by occhio
	var q = document.location.search || document.location.hash;
	if(q) {
		var pairs = q.substring(1).split("&");
		for (var i=0; i < pairs.length; i++) {
		//	alert(pairs[i].substring(0, pairs[i].indexOf("=")));
		//	alert(pairs[i].substring((pairs[i].indexOf("=")+1)));
			this.addVariable(pairs[i].substring(0, pairs[i].indexOf("=")), pairs[i].substring((pairs[i].indexOf("=")+1)));
		}
	}
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs[variablePairs.length] = key +"="+ variables[key];
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
//				document.write("player v: "+ counter);
				PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
			} catch (e) {
				axo = null;
			}
		}
	} else { // Win IE (non mobile)
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if (param == null) { return q; }
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i = objects.length - 1; i >= 0; i--) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
if (deconcept.SWFObject.doPrepUnload) {
	if (!deconcept.unloadSet) {
		deconcept.SWFObjectUtil.prepUnload = function() {
			__flash_unloadHandler = function(){};
			__flash_savedUnloadHandler = function(){};
			window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
		}
		window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
		deconcept.unloadSet = true;
	}
}
/* add document.getElementById if needed (mobile IE < 5) */
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;



/* 플래쉬 호출==============================================*/
// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 변수, 윈도우모드)
function flashWrite(url,w,h,id,bg,vars,win)
{	
	
	var so = new SWFObject(url, id, w, h, "8", bg);
	so.addParam("wmode", win);
	so.addParam("menu", "false");
	so.addParam("quality", "high");
	so.addParam("allowScriptAccess", "always");
	so.addParam("flashVars", vars);
	
	document.write(so.getSWFHTML());
}

function writeFlash(str)
{
	document.write(str);
}


function getCookie(cookieName)
{
	var search=cookieName + "=";
	if(document.cookie.length > 0) // 쿠키가 설정되어 있다면
	{
		offset = document.cookie.indexOf(search);
		if(offset != -1) // 쿠키가 존재하면
		{
			offset += search.length;
			// set index of beginning of value
			end=document.cookie.indexOf(";", offset);
			// 쿠키 값의 마지막 위치 인덱스 번호 설정
			if(end == -1)
			{
				end=document.cookie.length;
			}
			trace(cookieName + " : " + unescape(document.cookie.substring(offset, end)));
			return unescape(document.cookie.substring(offset, end));
		}
	}
	return "";
}

function setCookie(name, value)
{
	trace(name + " : " + value);
	
	var argv = setCookie.arguments;
	var argc = setCookie.arguments.length;
	var expires = (2 < argc) ? argv[2] : null;
	var path = (3 < argc) ? argv[3] : null;
	var domain = (4 < argc) ? argv[4] : null;
	var secure = (5 < argc) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); 
}

function trace(s)
{
//	alert(s);
}

// 로그인상태를 반환한다.
function getSignInState()
{
	/*
	var IsLogin=this.getCookie("IsLogin");
	
	if(IsLogin != "" && CustGB != "")
	{
		var signInObj=new Object();
		signInObj.IsLogin=Boolean(IsLogin);
		return signInObj;
	}
	else
	{
		return;
	}
	*/
	
	// test
	var signInObj=new Object();
	signInObj.IsLogin=false;
	return signInObj;
}

// favoriteCoffee_div
function showFavoriteCoffeeMovie(showing)
{
	if(showing)
	{
		// todo
		// favoriteCoffee_div 을 화면 중앙에 위치하고 보이게 합니다.
		
		// 다음 코드로 해당 div에 플래시태그를 씁니다.
		var so = new SWFObject("/flash/favoriteCoffee.swf", "favoriteCoffee", "335", "332", "8", "#000000");
		so.addParam("allowScriptAccess", "always");
		so.addParam("scale", "noscale");
		so.addParam("wmode", "transparent");
		so.write("favoriteCoffee_div");
	}
	else
	{
		// todo
		// favoriteCoffee_div 을 없앱니다.
		
		// temp
		favoriteCoffee_div.style.display="none";
	}
}

function setFavoriteCoffee(coffee)
{
	var loginflash=document.getElementById("login");
	if(loginflash != undefined)
	{
		if(loginflash.setFavoriteCoffee != undefined)
		{
			loginflash.setFavoriteCoffee(coffee);
		}
	}
	
	var main=document.getElementById("main");
	if(main != undefined)
	{
		if(main.setFavoriteCoffee != undefined)
		{
			main.setFavoriteCoffee(coffee);
		}
	}
}



//070615 추가
/*document.write("<form name='loginform' action='/membership/login_act.asp' method='post'><input type='hidden' name='LoginID'/><input type='hidden' name='LoginPasswd'/><input type='hidden' name='rtnUrl'/><input type='hidden' name='rtnParam'/></form>");

function submitFlashLogIn(loginID, loginPasswd)
{
	document.all["loginform"].LoginID.value=loginID;
	document.all["loginform"].LoginPasswd.value=loginPasswd;
	
	var urlstr=document.location.href;
	var urlarr=urlstr.split("?");
	if(urlarr[0] != undefined)
		document.all["loginform"].rtnUrl.value=urlarr[0];
	if(urlarr[1] != undefined)
		document.all["loginform"].rtnParam.value=urlarr[1];
	
	
	alert(document.all["loginform"].LoginID.value);
	alert(document.all["loginform"].LoginPasswd.value);
	alert(document.all["loginform"].rtnUrl.value);
	alert(document.all["loginform"].rtnParam.value);
	

	document.all["loginform"].submit();
}
*/

//070620 추가
var host_url = document.location.host
document.write("<form name='loginform' action='https://"+host_url+"/membership/login_act.asp' method='post'><input type='hidden' name='LoginID'/><input type='hidden' name='LoginPasswd'/><input type='hidden' name='rtnUrl'/><input type='hidden' name='rtnParam'/></form>");

function submitFlashLogIn(loginID, loginPasswd)
{
	document.all["loginform"].LoginID.value=loginID;
	document.all["loginform"].LoginPasswd.value=loginPasswd;
	document.all["loginform"].rtnUrl.value=document.location.pathname+document.location.search;
	
	
	/*
	alert(document.all["loginform"].LoginID.value);
	alert(document.all["loginform"].LoginPasswd.value);
	alert(document.all["loginform"].rtnUrl.value);
	*/

	document.all["loginform"].submit();
}


function delicio_micro(){
		
		IEmajorStart = navigator.appVersion.indexOf("MSIE")+4;
		IEmajorEnd =(IEmajorStart + 5);
		var theMajor=navigator.appVersion.substring(IEmajorStart,IEmajorEnd);
		var chk_version = Number(theMajor.substring(1,2))	// 버전에 따라 사이즈 추가 값을 위해 브라우저 버전체크
		
			
		var x = Math.floor(screen.width);
		var y = Math.floor(screen.height);


			var url = "/delicio_promotion/index.asp";
			var wscreen = 1024;
			var hscreen = 710;
		
			var leftpix =	Math.floor(x-wscreen)/2;
			var toppix =	Math.floor(y-hscreen)/2-50;
		
			var pavvMicrosite =  window.open( url,'pavvMicrosite','width='+ wscreen +', height=' + hscreen +',resizable=no,status=yes,left='+leftpix+' top='+toppix+'');
			pavvMicrosite.focus();
		

			
	}