﻿////// IMAGE_ROLLOVER //////
function menuon(imgEl) {
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}

function menuout(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}


// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 윈도우모드)
function flashWrite(url,w,h,id,bg,win){

        // 플래시 코드 정의
        var flashStr=
        "<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='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
        "<param name='movie' value='"+url+"' />"+
        "<param name='wmode' value='"+win+"' />"+
        "<param name='menu' value='false' />"+
        "<param name='quality' value='high' />"+
        "<param name='bgcolor' value='"+bg+"' />"+
        "<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
        "</object>";

        // 플래시 코드 출력
        document.write(flashStr);
}

// 링크 점선테두리 나타나지 않게
function bluring() {if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();}
document.onfocusin=bluring;


//------------ cookie function start--------------//
function getCookie(name){
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length )
        {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                        break;
        }
        return null;
}


function setCookie(name, value, expire) {
        document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
}
 
/* 
function setCookie(name, value){
        var expires = new Date();
        var path,domain,secure;

        var argv = setCookie.arguments;
        var argc = setCookie.arguments.length;

        if(argc > 2){
                expires.setTime(expires.getTime() + (1000*60*argv[2]));
        }else{
                expires = null;
        }
        path = (argc > 3) ? arg[3] : null;
        domain = (argc > 4) ? arg[4] : null;
        secure = (argc > 5) ? arg[5] : false;
        document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : (";expires=" + expires.toGMTString())) +
        ((path == null) ? "" : (";path=" + path)) +
        ((domain == null) ? "" : (";domain=" + domain)) +
        ((secure == null) ? "secure" : "");
}
*/
//setCookie('bnbEvent', "yes", 1000, "/");
//------------ cookie function end--------------//

//use BnB function
function playNowBnB(){
        var loginchk = getCookie('munjigi');
        if (loginchk==null){
				//window.open('/pop_signup.php','pop_signup','scrollbars=no,toolbar=no,resizable=no,width=288,height=174,left=100,top=100');
				var LoginURL = document.playBnB.LoginURL.value;
				location.href=LoginURL;
        }else{
				var playUrl = document.playBnB.playUrl.value;
				window.open(playUrl,'playNowBnB','scrollbars=no,toolbar=no,resizable=no,width=912,height=730,left=0,top=0');
        }
}

function howToBnB(){
       window.open('/howToPlay.html','howToBnB','scrollbars=no,toolbar=no,resizable=no,width=800,height=600,left=100,top=100');
}

function openBakery(uid){
        var playUrl = document.playBnB.openBakery.value+uid;
        window.open(playUrl,'openBakery','scrollbars=no,toolbar=no,resizable=no,width=560,height=650,left=100,top=100');
}

////// header_layer //////

// flash callback function - sean
function btn_Event1(){
	document.obj_flash.SetVariable("js_variable", "1");
}

function btn_Event2(){
	document.obj_flash.SetVariable("js_variable", "2");
}

function btn_Event3(){
	document.obj_flash.SetVariable("js_variable", "3");
}

function btn_Event4(){
	document.obj_flash.SetVariable("js_variable", "4");
}

//document.domain = 'outspark.com';
