function Set_Cookie_for_minute( name, value, expires, path, domain, secure )
{
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime( today.getTime() );

    /*
       if the expires variable is set, make the correct
       expires time, the current script below will set
       it for x number of days, to make it for hours,
       delete * 24, for minutes, delete * 60 * 24
       */
    if ( expires )
    {
        expires = expires * 1000 * 60;
    }
    var expires_date = new Date( today.getTime() + (expires) );

    document.cookie = name + "=" +escape( value ) +
        ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
        ( ( path ) ? ";path=" + path : "" ) +
        ( ( domain ) ? ";domain=" + domain : "" ) +
        ( ( secure ) ? ";secure" : "" );
}

function Set_Cookie( name, value, expires, path, domain, secure )
{
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime( today.getTime() );

    /*
       if the expires variable is set, make the correct
       expires time, the current script below will set
       it for x number of days, to make it for hours,
       delete * 24, for minutes, delete * 60 * 24
       */
    if ( expires )
    {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );

    document.cookie = name + "=" +escape( value ) +
        ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
        ( ( path ) ? ";path=" + path : "" ) +
        ( ( domain ) ? ";domain=" + domain : "" ) +
        ( ( secure ) ? ";secure" : "" );
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) {

    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ( ( !start ) &&
            ( name != document.cookie.substring( 0, name.length ) ) )
    {
        return null;
    }
    if ( start == -1 ) return null;
    var end = document.cookie.indexOf( ";", len );
    if ( end == -1 ) end = document.cookie.length;
    return unescape( document.cookie.substring( len, end ) );
}

function rhkdtn(user_id, re_)
{
	var c_id = Cookies.get( "m_id" );
	var se_id = Cookies.get( "se_kor_id" );
	var is_f = Cookies.get( "is_f" );
	var ty_ = 1;
	var u_id = user_id;
	var p_n = document.location.pathname;
	var os = BrowserDetect.OS;
	var br = BrowserDetect.browser + BrowserDetect.version;
	var sla = window.navigator.systemLanguage;
	var bla = BrowserDetect.bla;

	if (!c_id)
	{
		c_id = guid();
		Set_Cookie( "m_id", c_id, 365*10, '/', ".musicshake.com", false);
	}

    if (!is_f)
    {   
        se_id = guid();
        Set_Cookie_for_minute( "se_kor_id", se_id, 30, '/', ".musicshake.com", false);
        Set_Cookie( "is_f", 1, '', '/', ".musicshake.com", false);
        is_f = null;
    }   
    else
    {   
        if (!se_id) 
        {   
            se_id = guid();
            Set_Cookie_for_minute( "se_kor_id", se_id, 30, '/', ".musicshake.com", false);
            Set_Cookie( "is_f", 1, '', '/', ".musicshake.com", false);
            is_f = null;
        }   
        else
        {   
            Set_Cookie_for_minute( "se_kor_id", se_id, 30, '/', ".musicshake.com", false);
            is_f = 1;
        }   
    }   

	var i2=new Image(1,1);
	i2.src= "http://stat.musicshake.com/__stat.gif?"+"c_id="+c_id+"&se_id="+se_id+"&re_="+encodeURI(re_)+"&ty_="+ty_+"&u_id="+u_id+"&p_n="+p_n+"&os="+os+"&br="+br+"&bla="+bla+"&_sid=2&is_f="+is_f;
    i2.onload=function() { _uVoid(); }

}

function _mVoid() { return; }

function S4() 
{
	   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

function guid() 
{
	   return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
