function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (2 < argc) ? argv[2] : null;
    var path = (3 < argc) ? argv[3] : null;
    var domain = (4 < argc) ? argv[4] : null;
    var secure = (5 < argc) ? argv[5] : false;
    deleteCookie(name)
    document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : 
            ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
} 

function deleteCookie( cookieName )
{
    var expireDate = new Date();
    expireDate.setDate( expireDate.getDate() - 1 );
    document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
}

function BannerDisplay(file,ext,idx) { 
    if(ext == 'gif') {
        document.write('<img src='+file+'>');
    } else {
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width=580 height=105><param name="movie" value="'+file+'"><param name="quality" value="high"><param name="loop" value="true"><param name="play" value="true"><embed src="'+file+'" width=580 height=105 wmode="opaque" quality="high" play="true" loop="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/object>');    
    }    

    setBannerView(file, idx);
}

function banner_display_roll(val, idx) {
    document.getElementById("bannerDisplay").innerHTML  = val;

    setBannerView("HTML", idx);
}

function banner_display_roll2(val, idx) {
    document.write(val);

    setBannerView("HTML", idx);
}

function BannerDisplay2(file,ext,width,height,idx) { 
    if(ext == 'gif') {
        document.getElementById("bannerDisplay").innerHTML = '<img src='+file+' width='+width+' height='+height+' border=0>';
    } else {
        document.getElementById("bannerDisplay").innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+width+' height='+height+'><param name="movie" value="'+file+'"><PARAM value="transparent" name="wmode"><param name="quality" value="high"><param name="loop" value="true"><param name="play" value="true"><embed src="'+file+'" width='+width+' height='+height+' wmode="opaque" quality="high" play="true" loop="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/object>';    
    }

    setBannerView(file, idx);
} 


function BannerDisplay1(file,ext,width,height,idx) { 
    if(ext == 'gif') {
        document.write('<img src='+file+' width='+width+' height='+height+' border=0>');
    } else {
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+width+' height='+height+'><param name="movie" value="'+file+'"><PARAM value="transparent" name="wmode"><param name="quality" value="high"><param name="loop" value="true"><param name="play" value="true"><embed src="'+file+'" width='+width+' height='+height+' wmode="opaque" quality="high" play="true" loop="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/object>');    
    }    

    setBannerView(file, idx);
}

function setBannerView(file, idx)
{
    // ¹è³Ê ³ëÃâ¼ö¸¦ ±âÀçÇÕ´Ï´Ù.
    var url = "/addBannerView.html";
    var para = "idx="+idx;
    var myAjax = new Ajax.Request(
        url, 
        {
            method: 'get', 
            parameters: para
        }
    );

    /*
    // ¹è³Ê ³ëÃâ¼ö¸¦ ±âÀçÇÕ´Ï´Ù.
    if (addBannerView)
    {
        addBannerView.src = "/addBannerView.html?idx=" + idx;
        //alert(addBannerView.src);
        //addBannerView.src = "/addBannerDisplay.html?banner=" + file + "&idx=" + idx;
    }

    return false;
    */
}
