// ########## 이미지 마우스 롤오버
function btnOn(imgEl){ 
	imgEl.src = imgEl.src.replace("Off.gif", "On.gif");
}
function btnOff(imgEl){
	imgEl.src = imgEl.src.replace("On.gif", "Off.gif");
}

function naviConOpen(div_name){
	document.getElementById(div_name).style.top = "-1px";
}
function naviConClose(div_name){
	document.getElementById(div_name).style.top = "-513px";
}
// ########## 레이어 보기 , 닫기
function show_div_on(div_name){
	document.getElementById(div_name).style.display = "block";
}
function show_div_off(div_name){
	document.getElementById(div_name).style.display = "none";
}

// ########## 플래시 호출
function flash(url, width, height){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" hspace="0" vspace="0">');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="movie" value="'+url+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="'+width+'" height="'+height+'" hspace="0" vspace="0" allowScriptAccess="sameDomain"></embed></object>');
}

// 단순링크(테스트용)
function gourl(goURL){
    location.href = goURL;
}

// ########## 팝업창 띄우기
function popup_load(url,int_width,int_height,type) {
	window.open(url ,  "openWin", "width="+int_width+",height="+int_height+",top=30,left=100,resizable=no,scrollbars="+type) ;
}

// ########## 플래쉬 메뉴 연동 링크 호출
function flash_menu(url){
var goURL = "";
	switch(url){
		// 메인 GNB 플래쉬 메뉴 링크
		case '101': location.href = "../best100/best100.php"; break;
		case '102': location.href = "../event/event_list.php"; break;
		case '103': location.href = "../plan/plan_list.php"; break;
		case '104': location.href = "../best100/best100.php"; break;

		// 메인 인기 태그 순서 대로 링크 값 정의
		case '201': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=020200010010&ckcomp=&view=1&gview=1&itemv=11300&sitem=d5_11300&cate_qry=&cate_qry_not="; break;
		case '202': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=020380056010"; break;
		case '203': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=020380010"; break;
		case '204': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=070570080"; break;
		case '205': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=070120"; break;
		case '206': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=020230020&ckcomp=%C4%DA%BF%F8%BD%C3%BD%BA%C5%DB&view=1&gview=1&ckcomp_id=1156&sitem=d1_1156&cate_qry=&cate_qry_not="; break;
		case '207': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=060030040&ckcomp=&view=1&gview=2&itemv=31&sitem=d5_31&cate_qry=&cate_qry_not="; break;
		case '208': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=120200245&ckcomp=&view=1&gview=2&itemv=1073&sitem=d5_1073&cate_qry="; break;
		case '209': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=020300&view=1&gview=1&cate_qry=%B7%D1%B8%AE&cate_qry_not="; break;
		case '210': location.href = "http://www.bb.co.kr/main/pd/pd_list.php?cid=060050020"; break;

		// 메인 하단 비비 이용가이드 플래시 순서대로 링크
		case '301': location.href = "../information/bb_use.php"; break;
		case '302': location.href = "../information/bb_attention.php"; break;
		case '303': location.href = "../information/bb_shop.php"; break;
	}
}

// ########## 팝업 창 닫기
function pop_close(){
	self.close();
}

// ########## 탭버튼 스왑
function view_tab(val){
	for(i=1;i<3;i++){
		document.getElementById("pdtab_0"+i).style.display = 'none';
	}
	document.getElementById("pdtab_0"+val).style.display = '';
}

function goMapData(val){
	for(i=1;i<35;i++){
		document.getElementById("mapData"+i).style.top = '300px';
	}
	document.getElementById("mapData"+val).style.top = 0;
}

// ########## div 열기/닫기
function view_div(val){
	if(document.getElementById(val).style.display == 'none'){
		document.getElementById(val).style.display = '';
	}else{
		document.getElementById(val).style.display = 'none';
	}
}


// ########## quick 메뉴
function getPosition(){
	var start, end, scale, term;
	start = parseInt (document.getElementById('quicktop').style.top, 0);
	end = document.documentElement.scrollTop + 0;
	term = 5;

	if ( start != end ) {
	scale = Math.ceil( Math.abs( end - start ) / 7 );
		if ( end < start )	scale = -scale;
		document.getElementById('quicktop').style.top = parseInt (document.getElementById('quicktop').style.top, 0)+ scale + "px";
		term = 1;
	}
	setTimeout ("getPosition()", term);
}
function moveBanner() {
	document.getElementById('quicktop').style.top = document.documentElement.scrollTop + 0 + "px"; //숫자가 같으면 슬라이드 없다.
	getPosition();
	return true;
}

//이하 김민태 작성
function printContents(){
	window.open("/front/common/print_page.html", "print_open","width=800,height=700,top=0,left=0,noresizable,toolbar=no,status=no,scrollbars=yes,directory=no");
}

function print_set(){
	
	var str = "";

//	str += opener.document.getElementById("titleDepth2").innerHTML + "<br><br>";
//	str += opener.document.getElementById("titleDepth3").alt + "<br><br>";
//	str += opener.document.getElementById("titleDepth4").alt + "<br><br>";
	str += opener.document.getElementById("contents").innerHTML;

	document.getElementById("contents").innerHTML = str;

	window.print();
}

function zoomUtil(state){

	var	size = document.body.style.fontSize;

	if(state == "plus"){

		if(size == "")
			size = "12";

		if(size == "22px"){
			alert("더이상 늘릴 수 없습니다.");
			return;
		}
		
		size = Number(size.substring(0, 2)) + 2;

	}else if(state == "minus"){

		if(size == "")
			size = "12";

		if(size == "12px"){
			alert("더이상 줄일 수 없습니다.");
			return;
		}

		size = Number(size.substring(0, 2)) - 2;

	}else
		size = 12;

	document.body.style.fontSize = size;
}

//SWFLoader
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 title = 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 = a; 
		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='best'/>\n";
		parameter += "<param name='base' value='.'>\n";
		parameter += "<param name='scale' value='noscale'/>\n";
		parameter += "<param name='expressinstall' value='Scripts/expressInstall.swf' />\n";
	}
	
	this.parameter = function ( param, value ) {
		 parameter += "<param name='"+param +"' value='"+ value + "'>\n";
	}

	this.wmode = function ( value ) {
		wmode = value;
	}

	this.id = function ( value ) {
		id = value;
	}
	this.title = function ( value ) {
		title = value;
	}

	this.shocknone = 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+'" title="'+title+'" 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 + '2">' + 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;
		}
	}
}

