
var moz;
var initTop;
function initMvLayer() {
    mLayer = document.getElementById('top_button');
    initTop = mLayer.offsetTop;
    mLayer.style.top = document.body.scrollTop + initTop;// + 100;
    mLayer.style.visibility = "visible";
    lPos = document.body.clientWidth-22;
    if( lPos < 980 ) lPos = 980;
    CheckUIElements();
    mLayer.style.display = 'block';
}
function CheckUIElements(){
    var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
    mLayer = document.getElementById('top_button');

    yMenuFrom  = parseInt (mLayer.style.top, 10);
    yMenuTo    = document.body.scrollTop + initTop;   // ½½¶óÀÌµù ·¹ÀÌ¾î °ª¼³Á¤ 188

    timeoutNextCheck = 25;
    if( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ){
        setTimeout ("CheckUIElements()", timeoutNextCheck);
        return;
    }

    if ( yButtonFrom != yButtonTo ) {
        yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
        if ( yButtonTo < yButtonFrom ){
            yOffset = -yOffset;
        }
        divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;
        timeoutNextCheck = 10;
    }
    if ( yMenuFrom != yMenuTo ) {
        yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
        if ( yMenuTo < yMenuFrom ){
            yOffset = -yOffset;
        }
        mLayer.style.top = parseInt (mLayer.style.top, 10) + yOffset;

        timeoutNextCheck = 10;
    }
    setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function yjNumberFormat(price) {
    var nfPrice = "";
    price = price + '';
    j = 0;
    for( i=price.length; i>0; i-- ) {
        if( j % 3 == 0 && j!=0 ) {
            nfPrice = price.substring(i,i-1) + "," + nfPrice;
        } else {
            nfPrice = price.substring(i,i-1) + nfPrice;
        }
        j++;
    }
    return nfPrice;
}

function yjGotoDemo(str) {
    var str = str || '';
    demoWin = window.open('http://www.dubuweb.com/web/find_demo.php?tp='+str, 'mainPages', 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=481,height=420');
    demoWin.focus();
}
function yjOpenSample() {
    no = rand(4);
    sampleWin = window.open('http://sample'+no+'.dubuweb.com', 'sample');
    sampleWin.focus();
}
function rand ( n ) {
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}

function yjFlash(file, bg, ww, hh) {
    html  = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
    html += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
    html += ' width="'+ww+'" height="'+hh+'" align="middle">';
    html += '<param name="movie" value="'+file+'" '+'\/>';
    html += '<param name="quality" value="high" '+'\/>';
    html += '<param name="wmode" value="transparent" '+'\/>';
    html += '<param name="bgcolor" value="'+bg+'" '+'\/>';
    html += '<embed src="'+file+'" ';
    html += ' quality="high" wmode="transparent" ';
    html += ' bgcolor="'+bg+'" width="'+ww+'" height="'+hh+'" ';
    html += ' align="middle" type="application/x-shockwave-flash" ';
    html += ' pluginspage="http://www.macromedia.com/go/getflashplayer" '+'\/>';
    html += '<'+'\/object>';
    document.write(html);
}

function yjMovie(file, ww, hh) {
    html  = '<embed src="'+file+'" width="'+ww+'" height="'+hh+'" autostart="1" loop=1 showcontrols="1" id="mplayer" name="mplayer" enablecontextmenu="0">';
    html += '</embed>';
    document.write(html);
}

function yjMovie2(file, ww, hh) {
    toolbar = 1;
    html  = '<embed src="'+file+'" width="'+ww+'" height="'+hh+'" autostart="1" loop=1 showcontrols="'+toolbar+'" id="mplayer" name="mplayer" enablecontextmenu="0" >';
    html += '</embed>';
    document.write(html);
}

var scriptObj=null;
function yjJScriptRequest(fullUrl) {
    var noCacheIE ="&noCacheIE="+(new Date()).getTime();
    var headLoc = document.getElementsByTagName("head").item(0);
    if(scriptObj!=null) headLoc.removeChild(scriptObj);
    scriptObj = document.createElement("script");
    scriptObj.setAttribute("type", "text/javascript");
    scriptObj.setAttribute("src", fullUrl + noCacheIE);
    scriptObj.setAttribute("id", "jscriptid_100");
    headLoc.appendChild(scriptObj);
}
