﻿// flashWrite(파일경로, 가로, 세로[, 변수][,배경색][,윈도우모드])
function flashWrite(url,w,h,vars,bg,win,flashvar){
	
	var id=url.split("/")[url.split("/").length-1].split(".")[0]; //id는 파일명으로 설정
	if(vars==null) vars='';
	if(bg==null) bg='#FFFFFF';
	if(win==null) win='transparent';
	if(flashvar==null) flashvar = "";


	// 플래시 코드 정의
	var flashStr= "	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'";
		flashStr+="			codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'";
		flashStr+="			width='"+w+"'";
		flashStr+="			height='"+h+"'";
		flashStr+="			id='"+id+"'";
		flashStr+="			align='middle'>";

		flashStr+="		<param name='allowScriptAccess' value='always' />";
		flashStr+="		<param name='movie' value='"+url+"' />";
		flashStr+="		<param name='FlashVars' value='"+vars+"' />";
		flashStr+="		<param name='wmode' value='"+win+"' />";
		flashStr+="		<param name='menu' value='false' />";
		flashStr+="		<param name='quality' value='high' />";
		flashStr+="		<param name='bgcolor' value='"+bg+"' />";
		flashStr+="		<param name='flashVars' value='"+flashvar+"' />";
	
		flashStr+="		<embed src='"+url+"'";
		flashStr+="		       flashVars='"+vars+"'";
		flashStr+="		       wmode='"+win+"'";
		flashStr+="		       menu='false'";
		flashStr+="		       quality='high'";
		flashStr+="		       bgcolor='"+bg+"'";
		flashStr+="		       width='"+w+"'";
		flashStr+="		       height='"+h+"'";
		flashStr+="		       name='"+id+"'";
		flashStr+="		       align='middle'";
		flashStr+="		       flashVars='"+flashvar+"'";
		flashStr+="		       allowScriptAccess='always'";
		flashStr+="		       type='application/x-shockwave-flash'";
		flashStr+="		       pluginspage='http://www.macromedia.com/go/getflashplayer' />";
		flashStr+=" </object>";

	// 플래시 코드 출력
	document.write(flashStr);
}

// flashWrite(파일경로, 가로, 세로[, 변수][,배경색][,윈도우모드])
function flashIDWrite(id,url,w,h,vars,bg,win,flashvar){
		
	if(vars==null) vars='';
	if(bg==null) bg='#FFFFFF';
	if(win==null) win='transparent';
	if(flashvar==null) flashvar = "";


	// 플래시 코드 정의
	var flashStr= "	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'";
		flashStr+="			codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'";
		flashStr+="			width='"+w+"'";
		flashStr+="			height='"+h+"'";
		flashStr+="			id='"+id+"'";
		flashStr+="			align='middle'>";

		flashStr+="		<param name='allowScriptAccess' value='always' />";
		flashStr+="		<param name='movie' value='"+url+"' />";
		flashStr+="		<param name='FlashVars' value='"+vars+"' />";
		flashStr+="		<param name='wmode' value='"+win+"' />";
		flashStr+="		<param name='menu' value='false' />";
		flashStr+="		<param name='quality' value='high' />";
		flashStr+="		<param name='bgcolor' value='"+bg+"' />";
		flashStr+="		<param name='flashVars' value='"+flashvar+"' />";
	
		flashStr+="		<embed src='"+url+"'";
		flashStr+="		       flashVars='"+vars+"'";
		flashStr+="		       wmode='"+win+"'";
		flashStr+="		       menu='false'";
		flashStr+="		       quality='high'";
		flashStr+="		       bgcolor='"+bg+"'";
		flashStr+="		       width='"+w+"'";
		flashStr+="		       height='"+h+"'";
		flashStr+="		       name='"+id+"'";
		flashStr+="		       align='middle'";
		flashStr+="		       flashVars='"+flashvar+"'";
		flashStr+="		       allowScriptAccess='always'";
		flashStr+="		       type='application/x-shockwave-flash'";
		flashStr+="		       pluginspage='http://www.macromedia.com/go/getflashplayer' />";
		flashStr+=" </object>";

	// 플래시 코드 출력
	document.write(flashStr);
}

// Quick Banner
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() - 32;
		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)
}
//top 버튼
function onTheTop()
{
	location.hash = "top";
}
// 플래시 리사이즈 - 상단 플래시 호출 함수
function resizeFlash(he,wi)
{
	document.index.height = he;
	document.index.width = wi;
}

// 플래시 리사이즈 - 좌측 플래시 호출 함수
function resizeFlash2(he,wi)
{
	he1 = he;
	wi1 = wi;
	he_temp1 = he+90;
	he_side = he_temp1+"px";
	he_sideL = he+"px";//FF2에서는 높이, 너비 등에 px가 빠지면 인식 안함
	if(document.getElementById("sideL") !=null ){
		document.getElementById("sideL").style.height=he_sideL;
	}	
	document.indexLeft.height = he;
	document.indexLeft.width = wi;
}

// 콤포넌트를 숨기는 함수
function hideComponent ()
{
	hideControl('select',index);
	hideControl('embed',index);
	hideControl('select',indexLeft);
	hideControl('embed',indexLeft);
}
// 콤포넌트를 보여주는 함수
function showComponent ()
{
	showControl(index);
	showControl(indexLeft);
}
//셀렉트 박스 숨기기
function hideControl (tagName, popupObj)
{
    if (document.all) {

        var x = cmGetX (popupObj);
        var y = cmGetY (popupObj);
        var w = popupObj.offsetWidth;
        var h = popupObj.offsetHeight;

        var i;
        for (i = 0; i < document.getElementsByTagName(tagName).length; ++i) {
            var obj = document.getElementsByTagName(tagName)[i];
            if (!obj || !obj.offsetParent) continue;

            var ox = cmGetX (obj);
            var oy = cmGetY (obj);
            var ow = obj.offsetWidth;
            var oh = obj.offsetHeight;

            if (ox > (x + w) || (ox + ow) < x) continue;
            if (oy > (y + h) || (oy + oh) < y) continue;
            
            if(obj.style.visibility == "hidden") continue;

            if(!popupObj.overFlag)
                popupObj.overFlag = new Array ();

            popupObj.overFlag[popupObj.overFlag.length] = obj;
            obj.style.visibility = "hidden";
        }
    }

}

function showControl(popupObj)
{
    if (popupObj.overFlag) {
        var i;
        for (i = 0; i < popupObj.overFlag.length; ++i)
            popupObj.overFlag[i].style.visibility = "";
    }
    popupObj.overFlag = null;
}

function cmGetX (obj)
{
    var x = 0;
    do
    {
        x += obj.offsetLeft;
        obj = obj.offsetParent;
    }
    while (obj);
    return x;
}

function cmGetY (obj)
{
    var y = 0;
    do
    {
        y += obj.offsetTop;
        obj = obj.offsetParent;
    }
    while (obj);
    return y;
}

//레프트 네비게이션 플래시 링크 호출
function leftCallScript(callpara){
    var nCurrentURL = window.location.href.split('/')[0] + window.location.href.split('/')[1] + "//" + window.location.href.split('/')[2];
    
	var locationURL;
	locationURL = siteLocation();
	//alert(callpara);
	switch(callpara){
		case "fastInquiry" :
		//로그인 전 빠른조회 서비스 누르면 나타남.
			alert("빠른조회 서비스를 이용하시면 포인트 정보, 이벤트 참여 내역을 편하게 조회하실 수 있습니다.\n\n로그인 후 이용가능합니다.");
			break;
		case "fastEvent" :
		//로그인 전 빠른이벤트응모 누르면 나타남.
			alert("빠른이벤트 응모를 이용하시면 문화이벤트에 빠르고 편하게 응모하실 수 있습니다.\n\n로그인 후 이용가능합니다.");
			break;
		case "memberSearch" :
		//로그인 전 좌측 플래시의 아이디/비밀번호 찾기
		    //window.open("http://" + nPointURL + "/npass/searchIdForm.do?chnl=610010&rtn_url=" + nCurrentURL, "id_search").focus();
			//document.location.replace(locationURL+"/Member/gsck_memb_f017.aspx");
			document.location.replace(locationURL+"/common/Npass/Npass_GatePage.aspx?nPassFlag=3");
			break;
		case "memberJoin" :
		//로그인 전 좌측 플래시의 회원가입 
			document.location.replace(locationURL+"/common/Npass/Npass_GatePage.aspx?nPassFlag=5");
			break;
		case "Grade" :
		//로그인 후 좌측 플래시의 회원등급 링크
			document.location.replace(locationURL+"/MyPage/gsck_mypa_f001.aspx");
			break;
		case "Point" :
		//로그인 후 좌측 플래시의 가용포인트 링크
			document.location.replace(locationURL+"/MyPage/gsck_mypa_f002.aspx");
			break;
		case "reduction" :
		//로그인 후 문화이벤트 응모기회 링크
			document.location.replace(locationURL+"/Event/Comm/IngEventList.aspx");
			break;
		case "guarantee" :
		//로그인 후 당첨보장제 링크
			window.open("/event/comm/p_winnguarantee.aspx","_blank","top=100,left=100,width=600,height=568,scrolling=no");
			break;
		case "checkProduct" :
		//로그인 후 사은품 찜 링크
			document.location.replace(locationURL+"/MyPage/gsck_mypa_f021.aspx");
			break;
		case "eventResult" :
		//로그인 후 이벤트 응모당첨 내역 링크
			document.location.replace(locationURL+"/MyPage/gsck_mypa_f007.aspx");
			break;
		case "memberInfoModify" :
		//로그인 후 개인정보수정 링크
			//document.location.replace(locationURL+"/MyPage/gsck_mypa_f016.aspx");
			//window.open("http://" + nPointURL + "/npass/memberAdjustSelect.do?chnl=610010&rtn_url=" + nCurrentURL, "user_new").focus();
			//document.location.replace("http://" + nPointURL + "/npass/memberAdjustSelect.do?chnl=610010&rtn_url=" + nCurrentURL);
			document.location.replace(locationURL + "/common/Npass/Npass_GatePage.aspx?nPassFlag=1");
			break;
		case "cardOnlineRegister" :
		//빠른조회서비스-포인트 정보 탭-보너스카드 온라인 등록
			document.location.replace("/Common/GatePage/Https_GatePage.aspx?pageNm=gsck_cust_f006");
			break;
		case "detailPointInfo" :
		//빠른조회서비스-포인트 정보 탭-상세 포인트 정보 보기
			document.location.replace(locationURL+"/MyPage/gsck_mypa_f002.aspx");
			break;
		case "donatePoint" :
		//빠른조회서비스-포인트 정보 탭-포인트 기부하기
			document.location.replace("/Common/GatePage/Https_GatePage.aspx?pageNm=gsck_nanu_f003");
			break;
		case "requestProductList" :
		//빠른조회서비스-사은품 신청 및 찜-상세 사은품 신청 내역 보기
			document.location.replace(locationURL+"/MyPage/gsck_mypa_f008.aspx");
			break;
		case "eventDetatilList" :
		//빠른조회서비스-이벤트참여-상세 이벤트 응모 내역 보기
			document.location.replace(locationURL+"/MyPage/gsck_mypa_f007.aspx");
			break;
		case "carKeeping" :
		//빠른조회서비스-차계부-상세 차계부 관리 보기
			document.location.replace(locationURL+"/MyPage/gsck_mypa_f011.aspx");
			break;
		case "fastEventDetatil" :
		//빠른이벤트응모-문화이벤트빠른응모란?
			window.open("/event/comm/p_culturequickguide.aspx","_blank","top=100,left=100,width=600,height=394,scrolling=no");
			break;
		case "eventListAll" :
		//빠른이벤트응모-진행중인 다른 이벤트 보기 
			document.location.replace(locationURL+"/Event/Comm/IngEventList.aspx");
			break;
	}
}

function pointCall(point){
var locationURL;
	locationURL = siteLocation();
	//alert(callpara);
	switch(point){
		case "point1" :
		//로그인 전 빠른조회 서비스 누르면 나타남.
			alert("서비스 중비중입니다.");
			break;
		case "point2" :
		//로그인 전 빠른조회 서비스 누르면 나타남.
			alert("서비스 중비중입니다.");
			break;
		case "point3" :
		//로그인 전 빠른조회 서비스 누르면 나타남.
			document.location.replace("http://mobile.kixx.co.kr/main0711/bell_list.asp");
			break;
		case "point4" :
		//로그인 전 빠른조회 서비스 누르면 나타남.
			window.open("http://with.gseshop.co.kr/jsp/jseis_withLGeshop.jsp?media=My&gourl=http://with.gseshop.co.kr","_blank","top=100,left=100,width=600,height=568,scrolling=no");
			break;
	}
}

// 브라우저 종류와 버전 체크하는 객체 생성자 함수
function objDetectBrowser() {

  var strUA, s, i;

  this.isIE = false;  // 인터넷 익스플로러인지를 나타내는 속성
  this.isNS = false;  // 넷스케이프인지를 나타내는 속성
  this.version = null; // 브라우저 버전을 나타내는 속성

  // Agent 정보를 담고 있는 문자열.
  // 이 값이 궁금한 사람은 alert 문을 이용하여 strUA 값을 확인하기 바란다!
  strUA = navigator.userAgent; 
 
  s = "MSIE";
  // Agent 문자열(strUA) "MSIE"란 문자열이 들어 있는지 체크
  if ((i = strUA.indexOf(s)) >= 0) {
    this.isIE = true;
    // 변수 i에는 strUA 문자열 중 MSIE가 시작된 위치 값이 들어있고,
    // s.length는 MSIE의 길이 즉, 4가 들어 있다.
    // strUA.substr(i + s.length)를 하면 strUA 문자열 중 MSIE 다음에 
    // 나오는 문자열을 잘라온다.
    // 그 문자열을 parseFloat()로 변환하면 버전을 알아낼 수 있다.
    this.version = parseFloat(strUA.substr(i + s.length));
    return;
  }
 
  s = "Netscape6/";
  // Agent 문자열(strUA) "Netscape6/"이란 문자열이 들어 있는지 체크
  if ((i = strUA.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(strUA.substr(i + s.length));
    return;
  }
 
  // 다른 "Gecko" 브라우저는 NS 6.1로 취급.
 
  s = "Gecko";
  if ((i = strUA.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
var objDetectBrowser = new objDetectBrowser();

// 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 '';
    }


// IE6 에서 셀렉트박스와 레이어가 겹칠시 레이어가 셀렉트 박스 뒤로 숨는 현상을 해결하는 함수 
// button 숨김
function selectbox_hidden(layer_id) 
{ 
    for (i=0; i<document.forms.length; i++) { 
        for (k=0; k<document.forms[i].length; k++) { 
            el = document.forms[i].elements[k];    
            if (el.type == "select-one") 
                el.style.visibility = 'hidden'; 
        } 
    } 
} 



// 감추어진 셀렉트 박스를 모두 보이게 함 
function selectbox_visible() 
{ 
    for (i=0; i<document.forms.length; i++) { 
        for (k=0; k<document.forms[i].length; k++) { 
            el = document.forms[i].elements[k];    
            if (el.type == "select-one" && el.style.visibility == 'hidden') 
                el.style.visibility = 'visible'; 
        } 
    } 
    
    // 응모버튼 보이게 처리
//    document.getElementById("ctl00_ContentPlaceHolder1_divLoginY").style.visibility = 'visible'; 
} 
