﻿
var floater_id = 'zjllc';
var floater_top = 98;
var floater_op = {'signup':0/*0：表示未登录；1：表示已经登录*/,'signupurl':'#','loginurl':'#','msglisturl':'#'/*短信列表页面链接*/,'msgcount':0/*短信息数量*/,'sound':1/*0：当前页无提示音；1：当前页有提示音*/,'visited':[/*{'title':'4魔兽世界', 'title_a':'#', 'type':'金币', 'type_a':'#', 'price':'200.00', 'price_til':'4', 'price_a':'#'}*/]/*曾经浏览过的记录*/};
var page_width = 962;
var doc_scroll = 0;
var wind_width = 0;

function Floater(_id,_data)
{
	floater_id = _id;
	for(var key in _data)
	{
		floater_op[key] = _data[key];
	}
	
	jQuery(function(){
		FloaterInit(_id,_data);
	});
}

function FloaterInit(_id,_data)
{
	if(typeof _id=='string')
	{
		var html=new Array(),s=0;

		if(window.screen.width>1024)
		{
			jQuery(function(){
				jQuery('#ADs5_dv_AD_Board').hide();
			});
		}
		
		html[s++]='<div class="note" id="'+_id+'" '+(window.screen.width>1024?'':'style="display:none;"')+'>';
		html[s++]='<div class="note_frame">';
		
		switch(floater_op.signup)
		{
			case 0:
				if(floater_op.signupurl&&floater_op.loginurl)
				{
					html[s++]='<div class="login_frame">';
					html[s++]='<a href="'+floater_op.signupurl+'">登录</a>&nbsp; ';
					html[s++]='<a href="'+floater_op.loginurl+'" target="_blank">注册</a>';
					html[s++]='</div>';
				}
			break;
			
			case 1:
				html[s++]='<div class="login_frame">';
				if(typeof(floater_op.msgcount)=='string'||floater_op.msgcount>0)
				{
//					if(floater_op.sound==1)
//					{
//						var mp3file = 'http://images.5173cdn.com/5173/images/pm/pm_sound.mp3';
//						html[s++]='<object id=\"play_pm_sonud\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"0\" height=\"0\">';
//						html[s++]='<param name=\"movie\" value=\"http://images.5173cdn.com/5173/images/pm/mp3.swf\" />';
//						html[s++]='<param name=\"quality\" value=\"high\" />';
//						html[s++]='<param name=\"FlashVars\" value=\"file='+ mp3file +'\" />';
//						html[s++]='<embed src=\"http://images.5173cdn.com/5173/images/pm/mp3.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"0\" height=\"0\" FlashVars=\"file='+ mp3file +'\"></embed>';
//						html[s++]='</object>';
//					}
					html[s++]='<a href="http://message.5173.com/MyInfo/SiteMessageList.aspx?TagType=0" target="_blank">未读短信';
					html[s++]='<span class="num">'+floater_op.msgcount+'</span></a>';
				}
				else
				{
					html[s++]='未读短信';
					html[s++]='<span class="no">0</span>';
				}
				html[s++]='</div>';
			break;
		}
		
		if(floater_op.visited.length>0)
		{
			html[s++]='<div class="noteTop">最近浏览</div>';
			html[s++]='<div class="noteBox">';
			html[s++]='<div class="noteBg history" style="overflow:hidden;">';
			if(window.screen.height<=800) floater_op.visited.pop();
			for(var i = 0; i<floater_op.visited.length; i++)
			{
				var n = floater_op.visited[i];
				if(i==floater_op.visited.length-1) html[s++]='<ul class="noborder">';
				else html[s++]='<ul>';
				html[s++]='<li class="history_title"><a href="'+n.title_a+'" target="_blank" title="'+n.title+'">'+n.title+'</a></li>';
				html[s++]='<li><a href="'+n.type_a+'" target="_blank" title="'+n.type+'">'+n.type+'</a></li>';
				html[s++]='<li><a href="'+n.price_a+'" class="price" target="_blank"  title="'+unescape(n.price_til)+'">'+n.price+'</a></li>';
				html[s++]='</ul>';
			}
			html[s++]='</div>';
			
			html[s++]='</div>';
			html[s++]='<div class="noteBottom"></div>';
			html[s++]='</div>';
		}
		html[s++]='<div class="note_frame">';
		html[s++]='<div class="noteTop">快速购买</div>';
		html[s++]='<div class="noteBox quick_buy">';
		html[s++]='<div class="noteBg">';
		html[s++]='<ul>';
		
		var kj_url = {
	
			"www" : {
				"dianka" : "http://gg.5173.com/adpolestar/wayl/;ad=A81029D9_489B_5211_7A89_06A89AE1A33C;ap=0;pu=5173;/?http://dkjy.5173.com/BuyIndex.aspx",
				"shouji" : "http://gg.5173.com/adpolestar/wayl/;ad=184AE573_56A7_08E9_798A_8C6D91756282;ap=0;pu=5173;/?http://dkjy.5173.com/BizOffer/CCCard/ViewList.aspx?gameid=319522a68d3c40958094df8482a26d98",
				"qq" : "http://gg.5173.com/adpolestar/wayl/;ad=17AAE5EF_1961_C509_D4E6_4BDD81523768;ap=0;pu=5173;/?http://dkjy.5173.com/BizOffer/CCCard/ViewList.aspx?gameid=0725c34d0d424b8898465c86a28f6bac&mianzhi=&tradetype=",
				"caipiao" : "http://gg.5173.com/adpolestar/wayl/;ad=DF42564A_E521_FAA1_231F_8550A77413C9;ap=0;pu=5173;/?http://www.658.com/?proid=448880"/*,
				"dailian" : "http://gg.5173.com/adpolestar/wayl/;ad=D7E24934_45BB_7EF7_378C_7BA90223D730;ap=0;pu=5173;/?http://dlc2c.5173.com/main/index.aspx?type=sale"*/
			},
			
			"user" : {
				"dianka" : "http://gg.5173.com/adpolestar/wayl/;ad=86F6B3DD_5D3F_D18C_9F76_008B2C019280;ap=0;pu=5173;/?http://dkjy.5173.com/BuyIndex.aspx",
				"shouji" : "http://gg.5173.com/adpolestar/wayl/;ad=B43D416D_A55A_E6C4_CB51_D23E0A96B81A;ap=0;pu=5173;/?http://dkjy.5173.com/BizOffer/CCCard/ViewList.aspx?gameid=319522a68d3c40958094df8482a26d98",
				"qq" : "http://gg.5173.com/adpolestar/wayl/;ad=9F4751E6_BE55_3BD2_B5F1_A5C3911E3DB3;ap=0;pu=5173;/?http://dkjy.5173.com/BizOffer/CCCard/ViewList.aspx?gameid=0725c34d0d424b8898465c86a28f6bac&mianzhi=&tradetype=",
				"caipiao" : "http://gg.5173.com/adpolestar/wayl/;ad=BEDD5895_4A87_D19B_4348_A2D7929A6405;ap=0;pu=5173;/?http://www.658.com/ProIndex.aspx?proid=620582"/*,
				"dailian" : "http://gg.5173.com/adpolestar/wayl/;ad=D7E24934_45BB_7EF7_378C_7BA90223D730;ap=0;pu=5173;/?http://dlc2c.5173.com/main/index.aspx?type=sale"*/
			},
			
			"trading" : {
				"dianka" : "http://gg.5173.com/adpolestar/wayl/;ad=D6B380C4_CF2A_EC63_EF16_80F60141281A;ap=0;pu=5173;/?http://dkjy.5173.com/BuyIndex.aspx",
				"shouji" : "http://gg.5173.com/adpolestar/wayl/;ad=F93E1A07_70D3_662E_000D_5D5EEFC0F8B0;ap=0;pu=5173;/?http://dkjy.5173.com/BizOffer/CCCard/ViewList.aspx?gameid=319522a68d3c40958094df8482a26d98",
				"qq" : "http://gg.5173.com/adpolestar/wayl/;ad=B53BE072_26A1_D1FB_4CC7_5880C3C853B0;ap=0;pu=5173;/?http://dkjy.5173.com/BizOffer/CCCard/ViewList.aspx?gameid=0725c34d0d424b8898465c86a28f6bac&mianzhi=&tradetype=",
				"caipiao" : "http://gg.5173.com/adpolestar/wayl/;ad=B827FF6B_00CB_97CE_C6CE_DEDACD4D413F;ap=0;pu=5173;/?http://www.658.com/ProIndex.aspx?proid=620587"/*,
				"dailian" : "http://gg.5173.com/adpolestar/wayl/;ad=D7E24934_45BB_7EF7_378C_7BA90223D730;ap=0;pu=5173;/?http://dlc2c.5173.com/main/index.aspx?type=sale"*/
			},
			
			"images001" : {
				"dianka" : "dianka",
				"shouji" : "shouji",
				"qq" : "qq",
				"caipiao" : "caipiao"/*,
				"dailian" : "dailian"*/
			}
		}
		var domain = window.location.href.substring(7,window.location.href.indexOf('.5173.com'));
		if(kj_url[domain])
		{
			html[s++]='<li><a href="'+kj_url[domain]['dianka']+'" target="_blank" class="card">点卡</a></li>';
			html[s++]='<li><a href="'+kj_url[domain]['shouji']+'" target="_blank" class="phone">手机</a></li>';
			html[s++]='<li><a href="'+kj_url[domain]['qq']+'" target="_blank" class="qq">QQ</a></li>';
			html[s++]='<li><a href="'+kj_url[domain]['caipiao']+'" target="_blank" class="lottery">彩票</a></li>';
			/*html[s++]='<li><a href="'+kj_url[domain]['dailian']+'" target="_blank" class="dailian">代练</a></li>';*/
		}
		html[s++]='</ul>';
		html[s++]='</div>';
		html[s++]='</div>';
		html[s++]='<div class="noteBottom"></div>';
		html[s++]='</div>	';
		html[s++]='<div class="noteSubTop" onclick="jQuery(window).scrollTop(0);" style="cursor:pointer; display:none;"></div>';
		html[s++]='</div>';
		jQuery('#'+_id).remove();
		jQuery('body').prepend(html.join(''));
		FloaterSetPos(jQuery(document).scrollTop(),jQuery(window).width());
	}
	if(doc_scroll!=jQuery(document).scrollTop()||wind_width!=jQuery(window).width()){
		FloaterSetPos(jQuery(document).scrollTop(),jQuery(window).width());
	}
	setTimeout(FloaterInit,500);
}

function FloaterSetPos(_s,_w)
{
	doc_scroll = _s;
	wind_width = _w;
	
	if(doc_scroll>0) jQuery('.noteSubTop').show();
	else jQuery('.noteSubTop').hide();
	this.elm = jQuery('#'+floater_id);
	var css = {top:((jQuery('.mainnav').offset().top?jQuery('.mainnav').offset().top-21:floater_top)+doc_scroll)+'px',left:(((wind_width>page_width?wind_width:page_width)-page_width)/2+page_width+(typeof(FloaterDiff)!='undefined'?FloaterDiff:0))+'px'};
	this.elm.css(css);
}

function FloaterSigned(_op)
{
	Floater(floater_id,_op);
	FloaterSetPos(jQuery(document).scrollTop(),jQuery(window).width());
}
