function checkLoginByCookie() {
    var cookieId = "userID";
    var domain = "eastshu.com";
//    if (window.location.href.toLowerCase().indexOf(domain) == -1) {
//       return false;
//    }

    if (($.cookie(cookieId) != null && $.cookie(cookieId).length > 0)) {
        return true;
    }

    return false;
}

function showWelcome() {
    var msg = "欢迎您来到东方文学网！";
    if (checkLoginByCookie()) {
        var showName = decodeURI($.cookie("showName"));

        msg = showName + "您好，" + msg;
    }
    document.write(msg);
}

function LoginDialog() {
    var msg = '你的在线时长已经超过两分钟，为了方便你的阅读，请<a href="http://www.eastshu.com/Member/">登录</a>！登陆后可以方便地使用“ 书架、书签 ”功能，也可以在我的书架“最近阅读”中直接找到本作品。通过下方快速注册入口只需10秒就可完成。';
    msg += '<div align="center"><a href="http://www.eastshu.com/Member/">登录</a> <a href="http://www.eastshu.com/Member/reg.aspx">注册</a></div>';

    var title = '东方文学网提醒你！';

    messageBox(title,msg);
}

function ShowLoginDialog() {
    if (checkLoginByCookie())
    {
        return;
    }
	var spaceTime=2*60*1000;
	var d=new Date();
	var nowTime=d.getTime();
	var preTime=$.cookie("StartTime");
	if(!preTime)
	{
	    $.cookie("StartTime", nowTime, { expires: 1, path: '/',domain: '' });
	}
	else
	{
	    var spaceTime2 = (nowTime - preTime);
	    
	    if(spaceTime2>spaceTime) {
	        LoginDialog();
	    }
	}
}

function fayin(url) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="20" height="20">');
    document.write('<param name="wmode" value="transparent">');
    document.write('<param name="movie" value="/Flash/fayin.swf" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="flashVars" value="lj='+url+'" />');
    document.write('<embed flashvars="lj='+url+'" src="/Flash/fayin.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="20" height="20"></embed>');
    document.write('</object>');
}

function Setswf(width,height,url){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">');
	document.write('<param name="movie" value="'+url+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="Opaque">');
	//透明document.write('<param name="wmode" value="transparent">');
	document.write('<param name="menu" value="false">');
	document.write('<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>');
	document.write('</object>');
}