var _isIE=(navigator.userAgent.match(/Gecko/))?false:true; 
var _isIE7=(navigator.userAgent.match(/MSIE\s+7/i))?true:false; 
var _isXp=(navigator.userAgent.indexOf('Windows NT 5.1') > 0)?true:false; 

function win_resize() 
{ 
    var bw  = document.body.clientWidth; 
    var bh  = document.body.clientHeight; 

    if (!_isIE)
    {
        window.resizeTo(bw+10, bh+49);
    } 
    else if (_isIE7)
    {
        window.resizeTo(bw+10, bh+80);
    } 
    else if (_isXp && !_isIE7)
    {
        window.resizeTo(bw+10, bh+60);
    } 
    else
    {
        window.resizeTo(bw+10, bh+29);
    } 
} 

function goLogin()
{
    document.location.replace("https://login.korea.yahoo.com/config/login?.intl=kr&.src=yahooligans&.done="+document.URL);
}

function goLogout()
{
    document.location.replace("https://login.korea.yahoo.com/config/login?logout=l&.intl=kr&.src=yahooligans&.direct=1&.direct=1&.done="+document.URL);
}

function move_login()
{
	alert('로그인을 해주세요');
}

function move_sugarcast(user)
{
    if(user != '')
    {
        try
        {
            window.sugar_win.focus();
        }
        catch(error)
        {
            var width = 800;
            var height = 620;
                                
            var top  = (screen.height - height) / 2; 
            var left = (screen.width - width) / 2; 
         
            sugar_win = window.open('/sugarcast.html', 'GAME_WIN', 'width='+width+', height='+height+', top='+top+', left='+left+', menubar=0, toolbar=0, directories=0, status=0, location=0, resizable=0, scrollbars=0');
        }
    }
    else
    {
        alert('로그인을 해주세요');
    }
}

function move_hompy()  
{
    var width = 990;
    var height = 675;
    
    var top  = (screen.height - height) / 2; 
    var left = (screen.width - width) / 2;     

    window.open('http://kr.blog.yahoo.com/sugarchange', 'HOMPY_WIN', 'width='+width+', height='+height+', top='+top+', left='+left+', menubar=0, toolbar=0, directories=0, status=0, location=0, resizable=1, scrollbars=1');    
}

function price_change(sell_price)
{
    var user_price = document.getElementById('user_price').innerHTML;
    
    document.getElementById('sell_price').innerHTML = sell_price;
    document.getElementById('save_price').innerHTML = user_price - sell_price;
}

function item_buy()
{
    var frm = document.frmBill_Info;

    var chkRadio = false;
    var chkNo = '';
    
    for(i=0; i<frm.sell_info.length; i++) 
    {
        chkRadio = frm.sell_info[i].checked; 
        if(chkRadio == true) break; 
    } 
    
    chkNo = i + 1;    
    frm.numCHECK.value = chkNo;
    
    if(frm.numCHECK.value > 0 && frm.numCHECK.value < 4) frm.submit();
}

function SwfEmbeded(get_swf, get_width, get_height, get_id)
{
    if(navigator.appVersion.indexOf("MSIE") != -1) 
    {
        var object_str = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,12,36' width='"+get_width+"' height='"+get_height+"' id='"+get_id+"' name='"+get_id+"'><param name='allowScriptAccess' value='never' /><param name='movie' value='"+get_swf+"'><param name='quality' value='high'></object>";
    }
    else
    {
        var object_str = "<embed id='"+get_id+"' name='"+get_id+"' src='"+get_swf+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer'type='application/x-shockwave-flash' width='"+get_width+"' height='"+get_height+"' allowScriptAccess='never'></embed>";
    }

    document.write(object_str);
}

function SwfEmbeded_wmode(get_swf, get_width, get_height, get_id)
{
    if(navigator.appVersion.indexOf("MSIE") != -1) 
    {
        var object_str = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,12,36' width='"+get_width+"' height='"+get_height+"' id='"+get_id+"' name='"+get_id+"'><param name='allowScriptAccess' value='never' /><param name='movie' value='"+get_swf+"'><param name='wmode' value='transparent'><param name='quality' value='high'></object>";
    }
    else
    {
        var object_str = "<embed id='"+get_id+"' name='"+get_id+"' src='"+get_swf+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer'type='application/x-shockwave-flash' width='"+get_width+"' height='"+get_height+"' allowScriptAccess='never' wmode='transparent'></embed>";
    }

    document.write(object_str);
}
