//------------------- SWF 공통 제어함수 시작
/**
 *	version 1.5
 *	최종수정일 : 2008. 11. 10
 *
 *	-- 플래시로더 객체생성 기본사용방법 ---
 *	<script language="javascript" type="Text/JavaScript">
 *		var setFlash = new SWFLoader();
 *		setFlash.init( '넓이', '높이', '파일경로', 총 매개변수값);
 *		setFlash.parameter('파람이름','값'); //이미 기본옵션 사용중
 *		setFlash.wmode('window'); //이미 기본옵션('transparent') 사용중
 *		setFlash.id('아이디이름'); //예) ID_SWF파일이름
 *		setFlash.alt('값');	// 플래시 대체 텍스트 값 입력
 *		setFlash.layer('div 아이디 이름')  //예) <div id='SWF파일명Layer'></div> 
 *		setFlash.show( );
 *	</script>
 *
 *	SWF파일 아이디 표준화 사용방법 : ID_파일명(대소문자구분) 예제 : 파일명이 navi.swf 인경우 --> 'ID_navi'
 *
 *	-- setFlash.layer() 사용시 방법 - 기본사용방법을 showSWFLayer() 함수로
 *     객체를 감싸주고 메서드호출 시 인자로 Div 아이디 값을 넘겨준다.
 *	
 *	<script language="javascript" type="Text/JavaScript">
 *		function showSWFLayer( layername) {
 *			var setFlash = new SWFLoader();
 *			setFlash.init( '넓이', '높이', '파일경로', 총 매개변수값);
 *			setFlash.parameter('파람이름','값'); //이미 기본옵션 사용중
 *			setFlash.id('아이디이름'); //예) ID_SWF파일이름
 *			setFlash.layer(layername)  //예) <div id='SWF파일명Layer'></div>
 *			setFlash.show();
 *		}
 *  </script>
 *
 *	<a href="javascript:showSWFLayer('siteMapLayer')">열기</a>
 *
 *	-- 최종 추가수정 내용
 *	url 입력시 "&" 엠퍼센드 기호 --> "&amp;" 자동치환기능 추가 
 *
 */

function SWFLoader() {
	var obj = new String;
	var parameter = new String;
	var embed = new String;
	
	var classId = new String;
    var codeBase = new String;
	var pluginSpage = new String;
	var embedType = new String;	
	var allParameter = new String;	
	
	var src = new String;
	var width = new String;
	var height = new String;
	var id = new String;
	var layer = new String;
	var arg = new String;
	var altText = new String;
	var wmode = new String;

	this.init = function ( w, h, s, a ) {
		width = w; //넓이
		height = h; //높이
		src = s; //파일경로
		arg = String(a).replace(/\&/gi, '%26'); // 매개변수

		wmode = 'transparent'; //모드설정

		classId = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
		codeBase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
		pluginSpage = 'http://www.macromedia.com/go/getflashplayer';
		embedType = 'application/x-shockwave-flash';

		parameter += "<param name='allowScriptAccess' value='always'>\n";
		parameter += "<param name='allowFullScreen' value='false'\n>";
		parameter += "<param name='movie' value='"+ s + "'>\n";
		parameter += "<param name='quality' value='high'>\n";
		parameter += "<param name='base' value='.'>\n";
		parameter += "<param name=FlashVars value='arg="+arg+"'>\n";
	}
	
	//플래시 오브젝트 옵션설정
	this.parameter = function ( param, value ) {
		 parameter += "<param name='"+param +"' value='"+ value + "'>\n";
	}

	// 플래시 wmode 설정 setFlash.wmode('window')
	this.wmode = function ( value ) {
		wmode = value;
	}

	// 플래시 아이디 설정
	this.id = function ( value ) {
		id = value;
	}
	
	// 플래시 대체텍스트 설정
	this.alt = function ( value ) {
		altText = value;
	}

	// 플래시 삽입 레이어 설정
	this.layer = function ( value ) {
		if(value == undefined) {
			layer = "";
		} else {
			layer = value;
		}
	}

	this.show = function () {
		obj = '<object id="'+id+'" width="'+width+'" height="'+height+'" classid="'+classId+'" codebase="'+codeBase+'">\n'+
			parameter +
			'<param name="wmode" value="'+wmode+'">\n'+
			'<!--[if !IE]>-->\n' +
			'<object type="application/x-shockwave-flash" data="' + src + '" width="' + width + '" height="' + height + '" name="' + id + '">\n' +
				parameter +
				'<param name="wmode" value="'+wmode+'">\n'+
			'<!--<![endif]-->\n' +
				'<div class="alt-content alt-' + id + '">' + altText + '</div>\n' +
			'<!--[if !IE]>-->\n' +
			'</object>\n' +
			'<!--<![endif]-->\n' +
		'</object>';

		if(layer == "") {
			document.write(obj);
		}else{
			var div = document.getElementById( layer);
			div.style.display = "";
			div.innerHTML = obj;
		}
	}
}

function hideSWFLayer( div) {
	var div = document.getElementById( div);
	div.style.display = "";
	div.innerHTML = "";
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}
	else {
		return document[movieName];
	}
 }

function resizeSWF( id, height){
	document.getElementById( id ).height = height;
}
//------------------- SWF 공통 제어함수 끝


//============================== 매장안내 관련 함수
//기존 콜백함수를 변경
function callExternalInterface(movieId, param1, param2) {
    thisMovie(movieId).moveMc( param1, param2 );	
}

