var updateTime;
/*加载版本文件*/
document.writeln('<script type="text/javascript" charset="utf-8" src="../static/indexVersion.js?'+Math.random()+'"></script>');
/*调用jquery*/
document.writeln('<script type="text/javascript" src="../js/jquery.js"></script>');
/*调用全局模板*/
//document.writeln('<script type="text/javascript" charset="utf-8" src="../js/template.js?v3"></script>');
var h = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.setAttribute('type','text/javascript');
s.setAttribute('charset','utf-8');
s.setAttribute('src','../js/template.js?v3');
h.appendChild(s);

/*调用网站配置文件  移到indexVersion.js中*/
/*document.writeln('<script type="text/javascript" charset="utf-8" src="../static/config.js?'+updateTime+'"></script>');*/
/*声明lenovo对象，添加是否为ie6属性*/
var lenovo = {ie6:/msie 6/.test(window.navigator.userAgent.toLowerCase())};
/*如果是ie6 加载ie6png fix脚本*/
if(lenovo.ie6)
	document.writeln('<script type="text/javascript" src="../js/ie6.js"></script>');
/*给对象添加select方法*/
Array.prototype.select=function(a,b){
	if(this==null)
		return null;
	var c=[],d=0;
	if(b==null)
		b=this.length;
	for(var e=0;e<this.length&&d<b;e++)
		with(this[e]){
				if(eval(a))
					c[d++]=this[e];
		}
		if(d==0)
			return null;
		return c;
};
/*增加rad函数，使之支持最大，小值，返回int*/
Math.ran=function(min,max){
	if(min==null||max==null)
		return Math.random();
	if(max<min)
		return min;
	return min+Math.round(Math.random()*max*100)%(max-min);
};
(function(s){
	/*实现001格式*/
	s.Len=function(l){
		var t=this.toString(),n='';
		if(t.length==l)
			return t;
		if(t.length>l)
			return t.substring(0,l);
		if(l<=10)
			n="0000000000".substring(0,l-t.length);
		else{
			for(var i=t.length;i<l;i++)
				n+="0";
		}
		return n+t;
	}
	/*转化为RMB格式*/
	s.toM=function(){
		var a=this.toString();
		return'￥'+(a.indexOf('.')>0?a:a+'.00');
	}
	/*转化为int*/
	s.toInt=function(){
		return Math.round(this);
	}
	/*浮点数，小数位数*/
	s.FLen=function(){
		var r=0;
		try{
			r=this.toString().split(".")[1].length;
		}
		catch(e)
		{
			r=0;
		}
		return r;
	}
	/*转化为本地化日期*/
	s.toDate=function(){
		with(new Date(this))
			return getFullYear()+'-'+(getMonth()+1)+'-'+getDate();
	}
	/*浮点数，指定长度，l:指定长度，z,如果不够是否用0填充*/
	s.FI=function(l,z){
		var r=(this.toString()+'.').split('.'),f='';
		if(r[1].length>=l)
			f=r[1].substr(0,l);
		else{
			if(z)f=r[1]+'00000000000000'.substr(0,l-r[1].length);
			else{
				return this;
			}
		}
		return r[0]+'.'+f;
	}	
})(Number.prototype);
(function(s){
	/*清除空格，-1：开始位置，0：全部，1：结束，null：首尾*/
	s.trim=function(p){
		switch(p)
		{
			case-1:return this.replace(/(^\s*)/g,"");
			case 0:return this.replace(/(\s*)/g,"");
			case 1:return this.replace(/(\s*$)/g,"");
			default:return this.replace(/(^\s*)|(\s*$)/g,"");
		}
	};
	/*返回字节长度*/
	s.Len=function(){
		var l=0;
		for(var i=0;i<this.length;i++){
			if(this.charCodeAt(i)>255)
			l+=2;
			else 
				l++;
			}
			return l;
	}
	/*按字节长度切取 l:切取长度，m：是否加省略点*/
	s.cut=function(l,m){
		var r="",n=0;
		for(var i=0;i<this.length&&n<l;i++){
			r+=this.charAt(i);
			if(this.charCodeAt(i)>255)
				n+=2;
			else 
				n++;
			}
			if(m&&r.length<this.length)
				r+='..';
			return r;
	}
	/*TO rmb 同int*/
	s.toM=function(){
		return'￥'+(this.indexOf('.')>0?this:this+'.00');
	}
	/*url 编码*/
	s.toUri=function(){
		return encodeURIComponent(this.replace(/\-/g,''));
	}
	/*url 解码*/
	s.deUri=function(){
		return decodeURIComponent(this);
	}
	/*转化为int min:最小值，max:最大值，d:失败时默认值*/
	s.toNumber=function(min,max,d){
		if(this.exp(/^\d+$/)){
			var a=Number(this);
			if(min!=null&&a<min)
				a=d==null?min:d;
			if(max!=null&&a>max)
				a=d==null?max:d;
			return a;
		}
		return d==null?0:d;
	}
	/*转化为日期，如果失败，返回null,如果为空，使用当前系统时间*/
	s.toDate=function(){
		if(this=="")
			return new Date();
		var d=new Date(this.toString().replace(/-/g,"/"));
		if(isNaN(d))
			return null;
		else 
			return d;
	}
	/*是否是有效的日期串*/
	s.isDate=function(){return this.toDate()!=null;}
	/*是否相对为空,参照：mi：最小长度，ma:最大长度*/
	s.isEmpty=function(mi,ma){
		var t=this.trim();
		if(ma==null&&mi==null)
			return t=="";
		if(ma==null)
			return t.length>mi;
		if(mi==null)
			return t.length<ma;
		return t.length>mi&&t.length<ma;
	}
	/*执行自身的test*/
	s.exp=function(p){
		return p.test(this);
	}
	/*replace a请使用带全局的正则表达式,b:目标表达式*/
	s.r=function(a,b){
		return this.replace(a,b);
	}
	/*在串前面+#，为jqueryID引用*/
	s.q=function(){
		return '#'+this;
	}
})(String.prototype);
/*e:当格式为json的时候，返回空数据是否直接结束，即：不在回调callback*/
function Lq(a,b,c,d){
	this.a=a;this.b=b;this.c=c;this.d=d;
	this.ok=function(m){
	if(d.toLocaleString()==='json'){
			if(m==null){
				lenovo.window.alert('服务器返回null');
			}
			else if(typeof(m.code)=='undefined'){
				lenovo.window.alert('服务器未知错误');
				m=null;
			}
			else if(m.code){
				if(m.code=='10003'){
					G_S_userout(1);
					lenovo.window.login();
				}
				else
					lenovo.window.alert(m.detail);
				m=null;
			}		
		}
		c(m);
	}
}
Lq.prototype.get=function(){
	jQuery.get(this.a,this.b,this.ok,this.d)
}
Lq.prototype.post=function(){
	jQuery.post(this.a,this.b,this.ok,this.d)
}
/*分页控件*/
var G_page={
	/*控件引用样式*/
	i:'g_but',
	/*计数*/
	gm:'-1',
	/*
	================================
	=======控件入口，其它函数为内调====
	================================
	d={count:应用总数,pd:Paged defautl=10,f:分页后调用事件,e:生成完成后所执行的函数}；f:class=g_but的分页容器id*/
	ini:function(d,f,p,m){
		var o=lenovo.g(f),cof;
		if(o==null)return;
		if(this.gm=='-1')
			this.gm=m==null?'-0':'<p>'+m+'</p>';
		if(this.isstart(o)){
			p=1;
			cof={ct:d.count,pd:d.pd?d.pd:10,ps:0,p:p,f:d.f,e:d.e?d.e:''};
			cof.ps=Math.ceil(cof.ct/cof.pd);
		}
		else{
			cof=G_page.getA(o);
			if(p){
				cof.p=p;
			}
			else{
				p=cof.p;
			}			
			if(d){
				cof.ct=d.count;
				cof.ps=Math.ceil(cof.ct/cof.pd);
			}
		}
		G_page.setA(o,cof);
		var s='';
		if(cof.ct>0){
			s=(this.gm=='-0'?'<p><font>共'+cof.ct+'个应用</font></p>':this.gm)+'<span>'+this.ft(cof.ps,p)+this.a(p+1,p,4,'下一页&nbsp;＞',(p==cof.ps?'df4':null));
			s+='<font>共'+cof.ps+'页</font><font>到第</font><input class="inp" maxlength="3" />\
				<font>页</font><a '+lenovo.a+' onclick="G_page.se(\''+f+'\')" class="f2">确定</a></span><div class="clear"></div>';
		}
		else{
			s='<p><font>0个记录</font></p>';
		}
		o.innerHTML=s;
		if(cof.e)
			eval(cof.e+'('+cof.p+','+cof.ps+')');
		setTimeout(G_page.key,100);
	},
	/*获取顶级对象，o:引用对象*/
	mf:function(o){
		return lenovo.q(o).parents('.'+this.i)[0];
	},
	/*注册回车事件*/
	key:function(){
		lenovo.q(".g_but input").mouseover(function(event){
			event.target.focus();
		});
		lenovo.q(".g_but input").keypress(function(event){
			if((event.which >= 48) && (event.which <= 57)){
				return true;
			}
			else{
				if(event.which==8)
					return ture;
				if(event.which==13){
					G_page.g(event.target,event.target.value);
				}
				event.preventDefault();
				return false;
			}
		});
	},
	/*强制重新调整颁布*/
	go:function(o,p){
		this.g(o,p,1);
	},
	/*去某某页,o:引用对象，p:页面，w是否外调*/
	g:function(o,p,w){
		o=w?o:G_page.mf(o);	
		var cof=G_page.getA(o);
		if(cof==null){
			lenovo.alert.show('参数错误',1);
			return;
		}
		if(G_page.islock(o)){
			lenovo.alert.lock();
			return;
		}
		p=Number(p);
		if(p>cof.ps)
			p=cof.ps;
		if(p<1)
			p=1;
		cof.p=p;
		this.setA(o,cof);
		G_page.lock(o,1,1);
		eval(cof.f+'('+p+')');
	},
	/*快速定位*/
	se:function(f){
		var o= lenovo.q(f.q()+' input')[0];
		if(o.value.trim()!='')
			G_page.g(o,o.value.trim());
	},
	/*下一页，f:该实例唯一标识*/
	Next:function(f){
		f=lenovo.g(f);
		var cof=G_page.getA(f);
		if(cof&&cof.p<cof.ps)
			G_page.g(f,cof.p+1,1)
	},
	/*上一页，f:同上*/
	Pre:function(f){
		f=lenovo.g(f);
		var cof=G_page.getA(f);
		if(cof&&cof.p>1)
			G_page.g(f,cof.p-1,1)
	},
	/*外调，为实例初始化对象，对象重置时需要重新调用，f:同上*/
	start:function(f){
		f=lenovo.g(f);
		if(f){
			f.setAttribute('start',1);
			G_page.lock(f,1,1);
		}
	},
	/*是否已实例化*/
	isstart:function(o){
		if(o.getAttribute('start')=='1'){
			o.setAttribute('start',0);
			return true;
		}
		return false;
	},
	/*锁定,s:是否self调*/
	lock:function(o,v,s){
		if(s==null){
			o=lenovo.g(o);
		}
		if(o)
			o.setAttribute('lock',v);
	},
	/*对象是否加锁*/
	islock:function(o,s){
		if(o){
			if(s)
				o=lenovo.g(o);
			return o.getAttribute('lock')=='1';
		}
		return true;
	},
	/*将缓存数据写入容器*/

	setA:function(o,b){
		with(o){
			setAttribute('ct',b.ct);
			setAttribute('pd',b.pd);
			setAttribute('ps',b.ps);
			setAttribute('p',b.p);
			setAttribute('f',b.f);
			setAttribute('e',b.e);
		}
	},
	/*读取缓存*/
	getA:function (o){
		with(o)
			var a={
				ct:getAttribute('ct'),
				pd:getAttribute('pd'),
				ps:getAttribute('ps'),
				p:getAttribute('p'),
				f:getAttribute('f'),
				e:getAttribute('e')
			};
		if(a.ct)
			with(a)
				return {
					ct:Number(ct),
					pd:Number(pd),
					ps:Number(ps),
					p:Number(p),
					f:f,
					e:e
				};
			return null;
	},
	/*获取当前实例，当前页，总分页属性*/
	get:function(a){
		a=lenovo.g(a);
		var b;
		if(a){
				b={
					p:a.getAttribute('p'),
					ps:a.getAttribute('ps')
					}
				}
		if(b==null||b.p==null)
			b={p:1,ps:0};
		return b;
	},
	/*生成按钮对象*/
	a:function(p,cp,fn,k,ds){
		fn=fn?fn:'1';
		k=k?k:p;
		var ol='onclick="G_page.g(this,'+p+')"',cs='f'+fn;
		if(cp==p){
			ol='';
			cs='cur'+fn;
		}
		//不可用
		if(ds){
			cs=ds;
			ol='';
		}
		return '<a '+lenovo.a+' " '+ol+' class="'+cs+'">'+k+'</a>';
	},
	/*生成省略页*/
	ft:function (ps,p){
		var m=9,st=p-3,en=p+3,s='';
		if(st>ps-m)
			st=ps-m;
		if(st==2)
			st=1;
		if(en<m)
			en=m;
		if(en==ps-1)
			en=ps;
		st=st<1?1:st;
		en=en>ps?ps:en;
		if(st>1)
			s+=this.a(1,p)+'<i>...</i>';
		s+=this.fti(st,en,p);
		if(en<ps)
			s+='<i>...</i>'+this.a(ps,p);
		return s;
	},
	/*省略模板*/
	fti:function (x,y,z){
		var w='';
		for(;x<=y;x++)
			w+=this.a(x,z);
		return w;
	}
};
/*
图片列表控件
*/
var G_view={
	/*当前页*/
	p:1,
	/*总分布*/
	ps:0,
	/*容器*/
	f:'',
	/*锁定状态*/
	l:0,
	/*p=0是状态重置：未实现*/
	rt:null,
	/*p=ps+1是重置状态*/
	re:null,
	/*处理上一个*/
	sp:null,
	/*处理下一个*/
	sn:null,
	/*是否自动重绘*/
	af:0,
	/*上一个*/
	Pre:function(){
		if(this.l)
			return;
		if(this.sp){
			if(this.p==1){
				return;
			}
			else{
				this.p--;
				this.l=1;
				eval(this.sp);
				if(this.af)
					this.fill();
			}
		}
	},
	/*下一个*/
	Nex:function(){
		if(this.l)
			return;
		if(this.sn){
			var t=this.p+1;
			if(t<=this.ps){
				this.p++;
				this.l=1;
				eval(this.sn);
				if(this.af)
					this.fill();
			}
			else{
				this.Re();
			}
		}
	},
	/*重置，当前只实现了，最后一页*/
	Re:function(){
		if(this.re){
			this.p=1;
			this.l=1;
			eval(this.re);
			if(this.af)
				this.fill();
		}
	},
	/*注册键盘事件*/
	key:function(){
		lenovo.q(document).keyup(
			function(event){
				switch(event.which){
					case 37:G_view.Pre(); break;/*left*/
					case 39:G_view.Nex();break;/*right*/
				}
			});
	},
	/*
	控件入口
	//c:分布数量，fa：容器，pre:上一页，nex:下一页,rn:页面跑完重置事件，k:是否支持键盘，a:是否自动流动，以as(秒)为单位执行，如果为空或0不执行,f:是否自动重绘
	*/
	ini:function(c,fa,pre,nex,rn,k,a,f){
		this.ps=c;
		this.p=1;
		this.f=fa;
		this.sp=pre;
		this.af=f?1:0;
		this.sn=nex;
		this.re=rn;
		this.fill();
		if(k)
			this.key();
		if(a){
			this.run(a);
		}
	},
	/*自动运行*/
	run:function(a){
		this.rt=setInterval(G_view.Pre,a*1000);
	},
	/*绘制*/
	fill:function()
	{
		var s='<div class="g_page"><table align="center"><tr><td><em class="se" onclick="G_view.Pre()"><div class="icon pagel'+(this.p==1?0:1)+'"></div></em></td>';
		for(var i=1;i<=this.ps;i++)
			s+='<td><em class="icon page'+(this.p==i?1:0)+'"></em></td>';
		s+='<td><em onclick="G_view.Nex()" class="icon se"><div class="icon pager'+(this.p==this.ps?0:1)+'"></div></em></td></tr></table></div>';
		lenovo.q(this.f.q()).html(s);
		//解锁,禁止连续点击
		setTimeout('G_view.l=0',80);
	}
};
/*生成应用图标*/
var G_app={
	/*图标路径*/
	imgpath:function(){
		return globalData.body.fileServer+'/';
	},
	/*模板*/
	get:function(a,ov){
		ov=ov==null?'':'&ov=1';
		if(a)
		with(a){
			var im;
			if(APPIMGPATH){
				im=(APPIMGPATH.search("http")!==-1?APPIMGPATH:this.imgpath()+APPIMGPATH);
			}
			
			var gu=' onclick="lenovo.go(\'app.html?'+LCAID+(ov==''?'':'-1')+'\')"';
			var mp=(APPPRICE==null?0:APPPRICE);
			im=lenovo.ie6?'<div class="hand"'+gu+' style=\'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'
				+im+'", sizingMethod="scale");\'/>':'<img class="hand"'+gu+' src='+im+' onerror="G_app.err(this)">';
			var gdown = 'G_down.toPC(\''+LCAID+ov+'\',\''+APPNAME+'\')';	
			var ps=ISPAY=='0'?'<span class="free">免费</span><em class="icon" onclick="'+gdown+'"></em>':'<span class="pay">'
				+mp.toM()+'</span><b class="icon" onclick="G_pay.ini('+LCAID+',null,null,1)"></b>';
			im='<div class="appitem"'+(APPNAME.Len()>12?' title="'+APPNAME+'"':'')+'>'+((typeof(ADDV)!="undefined"&&ADDV=="2")?'<i></i>':'')+'<ul><li class="imgbox"'+gu+'>'+im+'</li>\
				<li class="name"'+gu+'>'+APPNAME.cut(12,1)+'</li><li class="appstar">\
				<div class="icon star'+lenovo.score(STARLEVEL)+'"></div>\
				</li><li class="price"><a '+lenovo.a+'>'+ps+'</a></li></ul></div>';return im;
		}
		return '';
	},
	/*控件入口，a:对app对象数组*/
	ini:function(a,ov){
		var b='';
		if(a==null||a.length==0)
			return '';
		for(var i in a)
			if(i<a.length)
				b+=this.get(a[i],ov);
		return b+'<div class="cls"></div>';
	},
	/*图片加载失败:o:this*/
	err:function(o,url){
		o.onerror=null;
		if(url){
		  o.src=url;
		}else{
		  //o.src='../images/app/'+Math.ran(0,9)+'.png';
			o.src='../images/app/le.png';
		}
	},
	/*删除操作*/
	/*todo 解决作用域问题*/
	del_par:"",
	del:function(p){
		this.del_par = p;
		lenovo.window.confirm("您确定要删除该记录？",function(){
			lenovo.window.load();
		  lenovo.q.get(G_app.del_par,null,function(data){
				if(data){
				  del_rs();
				  getData(G_page.get(_wcf.p0).p);
				}
		  });
		},function(){
			lenovo.window.close();
		},"操作确认",1);
	}
};
/*筛选器*/
var G_filter={
	/*是否显示付费筛选*/
	ip:null,
	/*是否显示排序筛选*/
	od:null,
	/*对象容器*/
	f:'',
	/*筛选器，与分布控件接口*/
	cpgn:'g_filter_pg',
	/*所绑定的分页对象的标识*/
	pgn:null,
	/*调回*/
	callback:null,
	/*锁定*/
	l:null,
	/*
	控件入口
	box:选择器容器;vod:是否显示排序方式；vip:是否显示收费方式,pbox:分页容器，如果不显示，则为空,cb:callback:回调函数，如果为空则无回调;lock:是否锁定*/
	ini:function(box,vod,vip,pbox,cb,lock){
		this.f=box;
		if(vod)this.od=-1;
		if(lenovo.iswdj()){
			vip = "";
			this.ip = 0;
		}
		if(vip)this.ip=-1;
		this.pgn=pbox;
		if(cb)this.callback=cb;
		if(lock)this.l=lock;
		this.show();
	},
	/*通知重绘*/
	show:function(){
		lenovo.g(this.f).innerHTML=(this.od==null?'':this.sod())
			+(this.ip==null||lenovo.iswdj()?'':this.sip())
			+(this.pgn==null?'':this.spg());
		if(this.callback)
			this.callback();
	},
	/*显示分页信息*/
	page:function(p,ps){
		if(this.pgn){
			var a=lenovo.g('g_filter_0'),b=lenovo.g('g_filter_1');
			if(p>ps){
				p=ps=0;
			}
			var c=p<2?'df4':'f4';
			if(a.className!=c)
				a.className=c;
			c=p==0||p==ps?'df4':'f4';
			if(b.className!=c)
				b.className=c;
			lenovo.g(this.cpgn).innerHTML=p+'/'+ps;
		}
	},	
	/*外调显示分页信息*/
	gpage:function(p,ps,pr,ne,pn){
		var a=lenovo.g(pr),b=lenovo.g(ne);
		if(a&&b){
			if(p>ps){
				p=ps=0;
			}
			var c=p<2?'df4':'f4';
			if(a.className!=c)
				a.className=c;
			c=p==0||p==ps?'df4':'f4';
			if(b.className!=c)
				b.className=c;
			lenovo.g(pn).innerHTML=p+'/'+ps;
		}
	},
	/*分布绑定信息*/
	Gpage:function(){
		if(this.pgn)
			return 'G_filter.page';
		return null
	},
	/*状态*/
	setcur:function(a,b){
		return a==b?'cur':'f';
	},
	/*排序模板*/
	sod:function(){
		return '<p><font>排序：</font><a href="javascript:;" onclick="G_filter.set(0,-1)" class="'+this.setcur(this.od,-1)+'4">默认排序</a>\
		<a href="javascript:;" onclick="G_filter.set(0,0)" class="'+this.setcur(this.od,0)+'4">下载量</a>\
		<a href="javascript:;" onclick="G_filter.set(0,1)" class="'+this.setcur(this.od,1)+'2"">评分</a>\
		<a href="javascript:;" onclick="G_filter.set(0,2)" class="'+this.setcur(this.od,2)+'4">上架时间</a></p>';
	},
	/*付费模板*/
	sip:function(){
		return '<p><font>&nbsp;</font><font>筛选：</font><a href="javascript:;" onclick="G_filter.set(1,-1)" class="'+this.setcur(this.ip,-1)+'2">全部</a>\
		<a href="javascript:;" onclick="G_filter.set(1,0)" class="'+this.setcur(this.ip,0)+'2">免费</a>\
		<a href="javascript:;" onclick="G_filter.set(1,1)" class="'+this.setcur(this.ip,1)+'2">收费</a></p>';
	},
	/*分布模板*/
	spg:function(){
		return '<span><a href="javascript:;" id="g_filter_0" onclick="G_page.Pre(G_filter.pgn)" class="df4">＜ 上一页</a>\
                    <a href="javascript:;" id="g_filter_1" onclick="G_page.Next(G_filter.pgn)" class="df4">下一页 ＞</a><font id="'+this.cpgn+'">loading</font></span>';
	},
	/*设置属性*/
	//象形 a=0:od ,a=1:ip，b:value
	set:function(a,b){
		if(this.l&&this.l()){
			lenovo.alert.lock();
			return;
		}
		if(a)
			this.ip=b;
		else{
			this.od=b;
		}
		this.show();
	}
};
/*下载支持*/
var G_down={
	lepad_u1:"http://www.lenovomm.com/appstore/ideastore_v3.0_U1.apk?lcaId=28089",
	lepad_k1:"http://www.lenovomm.com/appstore/ideastore_v3.0_K1.apk?lcaId=28087",
	lephone:"http://www.lenovomm.com/appstore/ideastore_v3.0_phone.apk?lcaId=29654",
	ids:'',li:'g_down_li_',
	//下载到设备
	ini:function(i){
		this.ids=i;
		lenovo.window.load();
		lenovo.l.get('../getLoginDevice.do?'+lenovo.timespan('h',1),null,function(a){G_down.show(a);},'json');	
	},
	show:function(a){
		var lcaid = window.location.toString().split("?")[1];
		if(a&&a.body.pidCarriers&&a.body.pidCarriers.length>0){
			var b=a.body.pidCarriers;
			var s='<div class="g_down"><ul>',auch=(b.length==1?1:0);
			s+='<li style="border-bottom:1px dashed #aaaaaa"><input '+(auch?' checked="checked"':'')+' onclick="G_down.chAll(this)" type="checkbox" id="_null">\
				<label for="_null" style="color:#888888">全选</label></li>';
			for(var i=0;i<b.length;i++)with(b[i]){
				var t='g_down_li_'+i;
				s+='<li style="float:left;width:50%;line-height:20px;"><input type="checkbox" value="'+id+'" id="'+t+'"><label for="'+t+'">'+name+'</label></li>';
			}
			s+='</ul><p style="clear:left;">在手机上直接访问下载地址：<br/>'+'<a href="'+globalData.body.shortLink+lcaid+'" target="_blank">'+globalData.body.shortLink+lcaid+'</a></p><a '+lenovo.a+' class="button right" onclick="G_down.getTDS()">确认下载</a>'+lenovo.clear+'</div>';
			//s+='</ul><a '+lenovo.a+' class="button right" onclick="G_down.getTDS()">确认下载</a>'+lenovo.clear+'</div>';
			lenovo.window.set(s,'下载到设备');
		}
		else
			lenovo.window.alert('您可以直接在浏览器中输入以下地址进行下载：<br/>'+'<a href="'+globalData.body.shortLink+lcaid+'" target="_blank">'+globalData.body.shortLink+lcaid+'</a><br/>提示：您还可以在登录后，直接将下载链接push到设备上进行应用的下载');
	},
	chAll:function(o){
		var r=o.checked,a=G_down.getAll();
		for(var i=0;i<a.length;i++){
			a[i].checked=r;
		}
	},
	getAll:function(){
		return 	lenovo.q('.g_down input');
	},
	getTDS:function(){
		var a=this.getAll(),t='';
		for(var i=0;i<a.length;i++)if(a[i].id!='_null'&&a[i].checked)
			t+='&chks='+a[i].value;
		if(t=='')
			lenovo.alert.show('请选择设备',1);
		else{
			this.ok(t);
		}
	},
	ok:function(tds){
		var a='../downloadToDevice.do?lId='+G_down.ids+tds+'&it=0'+lenovo.timespan();
		(new Image()).src=a;
		lenovo.window.alert("应用已发送到您的设备");
	},
	//下载到电脑
	toPC:function(ids,_name){
		//if(lenovo.isLogin()){
		
			lenovo.window.load();
			lenovo.l.get('../downloadToComputer.do?lIds='+ids+lenovo.timespan()+(lenovo.iswdj()?'&fId=14021':''),null,function(a){
				if(a){
					if(!lenovo.iswdj()){
				    lenovo.open(a.body.downloadUrl);
					}else{//豌豆夹一键安装下载
						parent.appDownload({name:_name,downloadUrl:a.body.downloadUrl});
					}
				}
			lenovo.window.close();
			},"json");
		
		//}
		//else{
			//lenovo.window.login();
		//}
	},
	//todo 目前商店首页快捷下载依然是死链接形式，考虑到参数，暂保留该方法
	wdjInst:function(_name,_url){
		if(!_url){
			parent.appDownload({name:_name,downloadUrl:lenovo.q(".downDialog a[class$='instal']").attr("go")});
			return;
		}
		parent.appDownload({name:_name,downloadUrl:_url});
	},
	wdjPadInst:function(_name){
		lenovo.window.set('<div class="downDialog"><p id="pad_radio">Pad机型选择：<br /><input type="radio" name="pads" value="k1" />Lenovo K1（仅适用于K1平板电脑）<br /><input type="radio" name="pads" value="u1" checked="checked"/>其他通用版（适用于1280*800、1024*600平板电脑）<br /></p><a class="icon instal" go="'+G_down.lepad_u1+'" name="'+_name+'" title="通过豌豆荚下载" onclick="G_down.wdjInst(\'乐商店 for Pad\')"></a></div>','乐商店客户端下载');
		lenovo.q(".downDialog input").click(function(){
			lenovo.q(this).val() == "u1" ? lenovo.q(".downDialog a[class$='instal']").attr("go",G_down.lepad_u1) : lenovo.q(".downDialog a[class$='instal']").attr("go",G_down.lepad_k1);
		});
	},
	onekey:function(ids){
		var onekey = lenovo.q("#onekey_down");
		onekey.attr({"href":globalData.body.shortLink+ids,"name":lenovo.g("__appname").innerHTML});
	},
	setAPKDown:function(_url,_type){
		if(_type === "pad"){
			lenovo.q(".downDialog input").click(function(){
				lenovo.q(this).val() == "u1" ? _url=G_down.lepad_u1 : _url=G_down.lepad_k1;
				lenovo.q(".downDialog a[class$='instal']").attr("href",_url);
			});
		}
		lenovo.q(".downDialog a[class$='download']").click(function(){
			window.location = _url;
		});
		lenovo.q(".downDialog a[class$='instal']").attr("href",_url);
	},
	/*商店快捷下载安装*/
	buildAppdown:function(){
		var that = this;
		lenovo.q("#apk_phone_btn").click(function(){
			lenovo.window.set('<div class="downDialog"><p>您可以无需登录，直接将乐商店应用下载到电脑</p><a class="icon download" href="#">下载到电脑</a><p>也可以通过豌豆荚直接安装到设备</p><a class="icon instal" name="乐商店" title="通过豌豆荚下载" onclick="return wdapi_apkdl_m(this,\'lestore\');"></a></div>','乐商店客户端下载');
			that.setAPKDown(G_down.lephone,"phone");
		});
	
		lenovo.q("#apk_pad_btn").click(function(){
			lenovo.window.set('<div class="downDialog"><p id="pad_radio">Pad机型选择：<br /><input type="radio" name="pads" value="k1" />Lenovo K1（仅适用于K1平板电脑）<br /><input type="radio" name="pads" value="u1" checked="checked"/>其他通用版（适用于1280*800、1024*600平板电脑）<br /><!--input type="radio" name="pads" value="other" disabled="disabled" /><span style="color:#CCC">1024*600分辨率的安卓平板电脑&nbsp;</span><span style="color:#F90">即将上市，敬请期待！</span--></p>\
			<p>您可以无需登录，直接将乐商店应用下载到电脑</p><a class="icon download" href="#">下载到电脑</a><p>也可以通过豌豆荚直接安装到设备</p><a class="icon instal" name="乐商店" title="通过豌豆荚下载" onclick="return wdapi_apkdl_m(this,\'lestore\');"></a>\
			</div>','乐商店客户端下载');
			that.setAPKDown(G_down.lepad_u1,"pad");
		});
	}
};
/*lenovo对象，将所有常用方法，或全局串封装到该对象中*/
(function (s) {
	/*重写*/
	s.w=function(v){
		document.write(v);
	}
	/*重写*/
	s.g=function (o){
		return document.getElementById(o);
	}
	/*全局串，清除浮动*/
	s.clear='<div class="cls"></div>';
	/*全局串，loading*/
	s.load='&nbsp;<div class="gload">加载中请稍后...</div>&nbsp;';
	s.loadExtSrc = function(){
		var script = document.createElement('script');
		script.type = 'text/javascript';
    script.src = arguments[0];
    document.getElementsByTagName('head')[0].appendChild(script); 
	},
	/*全局串，列表尾，清除分隔线 v:表达式，是否end*/
	s.b=function(v){
		if(v)
			return ' style="border-bottom:0px"';
		else{
			return '';
		}
	};
	/*计算评分样式，v int 给定评分*/	
	s.score=function(v){
		return Math.floor(Math.round(v*20)/10)*5;
	};
	/*全局串，a href属性*/
	s.a=' href="javascript:void 0"';
	/*搜索查询字符串,v:name*/
	s.qu=function(v){
		var a=self.location.href.toString();
		if (v==null){
			return self.location.search.replace('?','')
		}
		else{
			var b=new RegExp("(\\?|&)"+v+"=([^&|#]*)");
			var c=a.match(b);
			if(c){
					var d=c[2];
					try{
						d=decodeURIComponent(d);
					}
					catch(e){
						d=unescape(d);
					}
					return d;
				}; 
			return '';
		}	
	};
	//添加时间戳 v｛null:随机数，即无缓存，d:以天缓存，h:以小时缓存，其它数字表示以分钟缓存｝,d:缓存的小时或天数或分钟数,不填默认1
	s.timespan=function(v,d){
		var c='&timespan=';
		var a=(new Date()).getTime();
		if(v==null)
			return c+a;
		if(d==null)d=1;
		a=Math.round(a/60000);
		switch(v){
			case 'd':return c+Math.round(a/(1440*d));
			case 'h':return c+Math.round(a/(60*d));
			default:{v=Number(v);if(isNaN(v))v=10;return c+ Math.round(a/v);}
		}
	};
	/*操作cookie*/
	s.cookie={
		/*设置 name:value*/
		set:function(n,v){
			var a  = new Date();
			a.setTime(a.getTime() + 360*24*60*60*1000);
			document.cookie = n + '='+ escape (v) + ';expires=' + a.toGMTString()+';path=/';
		},
		/*获取 name*/
		get:function(n){
			var a = document.cookie.match(new RegExp('(^| )'+n+'=([^;]*)(;|$)'));
			if(a != null) 
				return unescape(a[2]); 
			return null;
		},
		/*删除，name*/
		del:function(n){
			var b=this.get(n);
			if(b!=null){ 
				var a=new Date();a.setTime(a.getTime()-100);
				document.cookie = n + '=;expires='+a.toGMTString()+';path=/';
			}
		}
	};
	/*应用大小 v:int ,字节数*/
	s.size=function(v){
		var a=1024,b;
		v/=a;b=a*a;
		if(v>b){
			v/=b;
			if(v<10)
				return v.FI(2)+'G';
			return 
				Math.round(v)+'G';
		}
		if(v>a){
			v/=a;
			if(v<10)
				return v.FI(2)+'M';
			return Math.round(v)+'M';
		}
		return v.toInt()+'K';
	};
	/*检测用户是否登录*/
	s.isLogin=function(){
		var a=this.cookie.get(lenovo.user.userId);if(a!=null&&a=='')a=null;
		return a!=null;
	};
	/*顶部提示框 tip*/
	s.alert={
		/*绑定样式*/
		i:'g_alert',
		/*时间控制器*/
		t:0,
		/*
		控件入口，m:message,
		b
			null:提示消息，
			1：警告消息
		*/
		show:function(m,b)
		{
			if(lenovo.q(lenovo.alert.i.q()).length==0){
				lenovo.q('body').append('<div id="'+lenovo.alert.i+'"></div>');
			}
			b=b?'i':'b';
			lenovo.g(lenovo.alert.i).innerHTML='<'+b+'>'+m+'</'+b+'>';
			lenovo.q(lenovo.alert.i.q()).fadeIn(500);
			if(lenovo.alert.t)
				clearTimeout(lenovo.alert.t);
			lenovo.alert.t=setTimeout(lenovo.alert.hide,3000);
		},
		/*当某对象锁定时的提示消息，直接调用*/
		lock:function(){
			this.show('上一个操作尚未完成，请稍候...',1);
		},
		/*隐藏*/
		hide:function(){
			lenovo.q('#g_alert').fadeOut('slow');
		}
	};
	s.go=function(u){self.location=u;if(lenovo.ie6)window.event.returnValue=false;};
	//通过脚本弹出新网页
	s.open=function(url){
		//if(document.all){
			var a='g_down_link_a';
			if(lenovo.g(a)==null)
				lenovo.q('body').append('<iframe id="'+a+'"></iframe>');
			var b=lenovo.g(a);
			if(b){
				b.setAttribute('src',url);
			}
	//		}
		//}
	////	else
	//		window.open(url);
	};
	/*接管jquery get,post*/
	s.l={
		get:function(a,b,c,d,e){
			var f=new Lq(a,b,c,d,e);
			f.get();
		},
		post:function(a,b,c,d,e){
			var f=new Lq(a,b,c,d,e);
			f.post();
		}	
	};
	s.user={userId:'user_id',userNick:'user_nick',userIcon:'user_face'};
	s.window={
		/*对象ID*/
		i:'g_window',
		/*背景ID*/
		b:'g_window_b',
		/*默认标题*/
		dt:'网页对话框',
		/*confirm 是否自动关闭*/
		cau:1,
		/*检查对象是否已存在,如果不存在则添加*/
		ch:function(){
			if(lenovo.g(lenovo.window.i)==null){
				lenovo.q('body').append('<div id="'+lenovo.window.i+'"></div><div id="'+lenovo.window.b+'"></div>');lenovo.window.ini();
			}
			if(lenovo.q.browser.msie){
				if(lenovo.q.browser.version == "6.0"){
					lenovo.q("#"+lenovo.window.i).css("position","absolute");
					lenovo.q(window).scroll(function(){
						lenovo.q("#"+lenovo.window.i).css("top",document.documentElement.clientHeight-lenovo.q("#"+lenovo.window.i).height()+document.documentElement.scrollTop+"px");
					});
				}
			}
		},
		/*模板*/
		ini:function(){
			var s='<table style="width:auto" border="0" align="center"><tr><td class="tts tts0">&nbsp;</td><td valign="top">\
			<div class="linetb tts10"></div><div class="tts11"><span id="g_window_tit"></span><a id="g_window_cls" '+lenovo.a+' onclick="lenovo.window.close()" class="close"></a></div>\
			</td><td class="tts tts2">&nbsp;</td></tr><tr><td class="cl">&nbsp;</td><td class="cc" valign="top" id="g_window_con"></div></td>\
			<td class="cr">&nbsp;</td></tr><tr><td class="linetb bt bt0" style="">&nbsp;</td><td class="linetb bt bt1" style="">&nbsp;</td>\
			<td class="linetb bt bt2" style="">&nbsp;</td></tr></table>';
			lenovo.g(lenovo.window.i).innerHTML=s;
		},
		/*设置属性，a:内容，b:标题，c：关闭按钮*/
		set:function(a,b,c,url){
			lenovo.window.ch();
			lenovo.g('g_window_con').innerHTML=a;
			if(lenovo.g("G_ifr")){lenovo.g("G_ifr").src = url;}
			lenovo.g('g_window_tit').innerHTML=b==null?lenovo.window.dt:b;
			lenovo.g('g_window_cls').className='close '+(c==null?'show':'hide');
			lenovo.window.show();
		},
		/*关闭*/
		close:function(){
				if(lenovo.g(lenovo.window.i)){
				lenovo.g(lenovo.window.i).style.top='145px';
				lenovo.q(lenovo.window.i.q()).hide();
				lenovo.q(lenovo.window.b.q()).hide();
				lenovo.g('g_window_con').innerHTML='';
			}
		},
		/*显示*/
		show:function(){
			if(lenovo.q.browser.msie){
				if(lenovo.q.browser.version == "6.0"){
				lenovo.q("#"+lenovo.window.i).css("top",document.documentElement.clientHeight-lenovo.q("#"+lenovo.window.i).height()+document.documentElement.scrollTop+"px");
				}
			}
			lenovo.q(lenovo.window.b.q()).height(lenovo.q(document).height());
			lenovo.q(lenovo.window.b.q()).show();
			lenovo.q(lenovo.window.i.q()).show();
		},
		/*alert a:message,t:title*/
		alert:function(a,t){
			var s='<div class="alert"><div class="c">'+a+'</div><div class="b"><a class="button right gsp" '+lenovo.a
			+' onclick="lenovo.window.close()">确定</a></div></div>';
			lenovo.window.set(s,t==null?lenovo.window.dt:t);
		},
		/*confirm a:message,ok function,ca fucntion t:title auc:是否自动关闭*/
		confirm:function(a,ok,ca,t,noclose){
			lenovo.window.cau=noclose?0:1;
			var s='<div class="alert"><div class="c">'+a+'</div><div class="b"><a class="button gsp right" '+lenovo.a
			+' onclick="lenovo.window.ec('+ca+')">取消</a><a href="###" class="button gsp right" onclick="lenovo.window.ec('+ok+')">确定</a></div></div>';
			lenovo.window.set(s,t==null?lenovo.window.dt:t);
		},
		/*嵌入框架 url, title,width,height*/
		ifr:function(url,t,w,h,c){
			w=w?w:500;
			h=h?h:400;
			var s='<iframe id="G_ifr" name="G_ifr" src="'+url+'" style="width:'+w+'px;height:'
			+h+'px" marginwidth="1" marginheight="0" scrolling="no" border="0" frameborder="0"></iframe>';
			lenovo.window.set(s,t==null?lenovo.window.dt:t,c,url);
		},
		/*loading窗口*/
		load:function(){
			lenovo.window.set('<div style="width:180px">'+lenovo.load+'</div>',null,1);	
		},
		/*login*/
		login:function(){
			lenovo.window.ch();
			lenovo.g(lenovo.window.i).style.top='20px';
			lenovo.window.ifr('../html/action.html?action=login','登录',(lenovo.iswdj()?750:820),460);
		},
		/*pay*/
		pay:function(v){
			lenovo.window.ch();
			lenovo.g(lenovo.window.i).style.top='0px';
			if(v==null)v='';else{v='?'+v;}
			lenovo.window.ifr('pay.html'+v,'支付'+(v==''?'':'成功'),970,520);
		},
		/*logout*/
		logout:function(){			
			lenovo.window.confirm('您确定要退出此次登录？',function(){
				G_S_userout(0);
			},null,'用户退出');
		},
		/*内调，执行函数,然后关闭窗口*/

		ec:function(fn){
			if(fn)
				fn();
			if(lenovo.window.cau)
				lenovo.window.close();
		}
	};
	s.getApptype=function(){
		var arr = globalData.body.appTypes.select('PARENTID==null||PARENTID==""');
		var arrCopy = new Array();
		if(typeof(arr)!='undefined' && arr!=null) {
			for (var i=0; i< arr.length; i++) {
				if(arr[i].APPTYPENAME!='教育') {
					arrCopy[i]=arr[i];
				}
			}
		}
		return arrCopy;
	};
	s.iswdj = function(){
		return (window.location.toString().search("wdj") !== -1?true:false);
	};
})(lenovo);
/*商店安装*/
var LE_INST = {
	show:function(){
		lenovo.q("#le_inst").css("display","none");
		lenovo.q("#le_inst_show").css("display","block");
		lenovo.g("le_inst_show").focus();
	},
	hide:function(){
		setTimeout(function(){
			lenovo.q("#le_inst").css("display","block");
			lenovo.q("#le_inst_show").css("display","none")
		},100);
	}
};
/*head 顶部*/
var G_head={
	/*设备id*/
	id:['head_phone','head_pad'],
	/*当前配置*/
	now:'',
	/*时间控制器*/
	h:0,
	/*主设备*/
	fv:0,
	/*子设备*/
	cv:0,
	/*子设备名称*/
	cvn:'Phone',
	/*cookie 主设备类型*/
	f:'dev_type',
	/*cookie 设备id*/
	c:'dev_v',
	/*cookie 设备名称*/
	cn:'dev_n',
	/*显示子列表*/
	fd:1,
	/*选择设备 v:id*/
	chdev:function(v)
	{
		if(G_head.h)clearTimeout(G_head.h);
		if(lenovo.iswdj()){
			lenovo.g(this.id[0]).className='wdj';
		  lenovo.g(this.id[1]).className='wdj';
		  lenovo.g(this.id[v]).className='curwdj';
		}else{
		  lenovo.g(this.id[0]).className='';
		  lenovo.g(this.id[1]).className='';
		  lenovo.g(this.id[v]).className='cur';
		}
		var s='',a=globalData.body.deviceKindAndInfo[v].DIVECEINFOS;
		var pad_filter = [],phone_filter = [];
		//pad_filter.push('S2005A-H','S2007A-D','S2010A-D','IdeaTabV2007A-W','IdeaTabV2010A-W');
		phone_filter.push('A520');
		outloop:
		for (var i in a)if(i<a.length)with(a[i]){
			if(v === 1){//pad filter
				for(var j=0;j<pad_filter.length;j+=1){
					if(pad_filter[j].toLowerCase() === MODEL.toLowerCase()){
						continue outloop;
					}
				}
			}else if(v === 0){
				for(var k=0;k<phone_filter.length;k+=1){
					if(phone_filter[k].toLowerCase() === MODEL.toLowerCase()){
						continue outloop;
					}
				}
			}
			
			//s+='<div class="li" onclick="G_head.set('+DEVICEINFOID+",'"+MODEL+"',"+v
				//+')" onmouseover="this.style.backgroundColor=\'#154B77\'" onmouseout="this.style.backgroundColor=\'\'">'+MODELNAME.cut(28,1)+'</div>';

			//春节版本修改 #154B77 ->  #870303
			s+='<div class="li" onclick="G_head.set('+DEVICEINFOID+",'"+MODEL+"',"+v
				+')" onmouseover="this.style.backgroundColor=\'#870303\'" onmouseout="this.style.backgroundColor=\'\'">'+MODELNAME.cut(28,1)+'</div>';
		}
		with(lenovo.g('head_list_c')){
			className='d'+this.fv;innerHTML=s;
		}
		G_head.show(null,v);
	},
	/*菜单效果,o,caller,f:是否是主列表*/
	m_ott:0,
	//otf:是否已显示父层，otc:是否已显示子层
	m_otf:0,m_otc:0,
	m_showf:function(){
		lenovo.q('#top_appftype li').each(function(i,o){o.className='';});
		lenovo.g('top_appftype').style.display='block';
		G_head.m_otf=1;	
	},
	m_ov:function(o,f){	
		if(G_head.m_ott)
			clearTimeout(G_head.m_ott);	
		if(o==null){
			if(G_head.m_otf==0){
				G_head.m_showf();
			}
			return;
		}			
		var b=lenovo.q((f?'top_appftype':'top_appctype').q()+' li');		
		o.className=f?'mb':'cb';
		for(var i=0;i<b.length;i++){
			if(b[i]!=o)
				b[i].className='';
		}		
		if(f){
			var s='<div class="parent"><ul>';
			var a=globalData.body.appTypes.select('PARENTID=='+f);
			if(a)for(var i=0;i<a.length;i++)with(a[i])
				s+='<li onmouseover="G_head.m_ov(this)" onclick="G_head.m_go('+f+','+APPTYPEID+')">'+APPTYPENAME+'</li>';
			s+='</ul></div>';
			this.m_oset(1,s);
		}
	},
	m_ot:function(){
		G_head.m_ott=setTimeout('G_head.m_oset(0,"",1)',80);
	},
	m_oset:function(sh,s,f){
		if(f){
			lenovo.g('top_appftype').style.display='none';
			G_head.m_otf=0;
		}
		var a=lenovo.g('top_appctype');
		a.innerHTML=s;
		if(sh&&G_head.m_otc==0){
			a.style.display='block';
			G_head.m_otc=1;	
			return;
		}
		if(sh==null&&G_head.m_otc==1){
			a.style.display='none';
			G_head.m_otc=0;	
		}
	},
	m_go:function(f,c){
		var a='storese.html?'+f;
		if(c)a='sort.html?'+f+'-'+c;
		lenovo.go(a);	
	},
	/*显示 v:是否可见，w 设备类型*/
	show:function(v,w){
		v=v?'none':'block';
		with(lenovo.g('head_list')){
			style.display=v;
			if(v=='block'){
				lenovo.g('head_list').style.left=((w==null?this.fv:w)?'4px':'-91px');
				focus();
			}else{
				lenovo.g('head_list_c').innerHTML='';
				this.fill();
			}
		}
	},
	/*隐藏*/
	hide:function(){
		if(G_head.h)
			clearTimeout(G_head.h);
		G_head.h=setTimeout('G_head.show(1)',200);
	},
	/*设置 设备类型，设备id,设备名称*/
	set:function(_a,_b,_c){
		if(_a==null&&_b==null){
			_a=0;
			_b=_c==0?'Phone':'Pad';
		}
		if(this.fv!=_c||this.cv!=_a)//如果导航改变，重新刷新数据
		{
			this.fv=_c;
			this.cv=_a;
			this.cvn=_b;
			this.fd=1;
			lenovo.cookie.set(this.f,this.fv);
			lenovo.cookie.set(this.c,this.cv);
			lenovo.cookie.set(this.cn,this.cvn);
		}	
		else
			return;
		this.show(1);
		var t=this.getComm();
		if(this.now==t)
			return;
		this.now=t;
		if(typeof(_getdata)!='undefined')
			_getdata();
		G_S_commdata();
	},
	/*显示文本数据*/
	disp:function(){
		with(lenovo.g(this.id[this.fv])){
			title=this.cvn;
			innerHTML=this.disps(this.fv?'pad':'phone',this.cvn.cut(5,1),this.fv);
		}
		var a=Math.abs(1-this.fv);
		with(lenovo.g(this.id[a])){
			title='';
			innerHTML=this.disps(this.fv?'phone':'pad',this.fv?'Phone':'Pad',a);
		}
	},
	/*模板 参数同set*/
	disps:function(a,b,c){
		var icon = "";
		if(!lenovo.iswdj()){
		  icon = '<i class="icon '+a+' i0"></i>';
		}
		return icon+'<i class="i1" onclick="G_head.set(null,null,'+c+')">'+b+'</i>'+(lenovo.iswdj()?"":'<i onclick="G_head.chdev('+c+')" class="i0 hand"></i>');
		;
	},
	/*读取cookie*/
	get:function()
	{
		var w=lenovo.cookie.get(this.f);
		if(w==null)
			this.fv=0;
		else{
			this.fv=w.toNumber(0,1,0);
		}
		w=lenovo.cookie.get(this.c);
		if(w==null)
			this.cv=0;
			else{
				this.cv=w.toNumber();
		}
		w=lenovo.cookie.get(this.cn);
		if(w==null)
			this.cvn=(this.fv?'Pad':'Phone');
		else{
			this.cvn=w;
		}
		//lenovo.alert.show('get:fv:'+this.fv+',cv:'+this.cv+',cvn:'+this.cvn);
	},
	/*绘制*/
	fill:function(v)
	{
		if(v==null)
			this.get();
		if(this.fd){this.fd=0;}
		if(lenovo.iswdj()){
		  lenovo.g(this.id[this.fv]).className="curwdj";
		  lenovo.g(this.id[Math.abs(1-this.fv)]).className="wdj";
		}else{
			lenovo.g(this.id[this.fv]).className="cur";
		  lenovo.g(this.id[Math.abs(1-this.fv)]).className="";
		}
		this.disp();
	},
	/*获取静态数据路径*/
	getComm:function(v){
		v=v==null?'=':'';
		return G_head.cv?'diId'+v+G_head.cv:'dkId'+v+(G_head.fv+1);
	},
	info:function(o,out){
		o.className=out?'':'c';
	}
};
var G_pay={
	ids:null,list:null,aok:null,afa:null,aud:null,
	/*请求的ids,aud:是否自动下载*/
	ini:function(_ids,_ok,_fa,_aud){
		if(lenovo.isLogin()){
			lenovo.window.load();
			this.aok=_ok;this.afa=_fa;this.ids=_ids;this.aud=false;if(_aud!=null&&_aud==1)this.aud=true;
			lenovo.l.get('../orderView.do?ptId=1&lIds='+_ids+lenovo.timespan(),null,function(a){G_pay.show(a)},'json');
		}
		else
			lenovo.window.login();
	},
	show:function(a){
		if(a){
			if(typeof(a.body.data)!='undefined'&&a.body.data!=null&&a.body.data.length>0){
				this.list=a;			
				lenovo.window.pay();
			}
			else{
				lenovo.window.alert('该应用无需购买');
				if(this.aud)
					G_down.toPC(this.ids);
			}
		}
	},
	fail:function(){
		lenovo.window.close();
		lenovo.window.alert('支付失败');
		G_pay.clear();
		if(G_pay.afa)
			G_pay.afa();
	},
	success:function(v){
		lenovo.window.close();
		if(G_pay.list.body.data.length==1){
			if(G_pay.aok)
				G_pay.aok();
			if(G_pay.aud)
				G_down.toPC(G_pay.ids);
		}
		else{
			if(v==null||v=='')
				G_pay.fial();
			else{			
				if(G_pay.aok)
					G_pay.aok();
				lenovo.window.pay(v);
				if(G_pay.aud)
					G_down.toPC(G_pay.ids);	
			}
		}
	},
	//清除缓存
	clear:function(){
		G_pay.list=G_pay.ids=G_pay.aok=G_pay.afa=G_pay.aud=null;
	}
};

/*page*/
window.onload=function(){
	/*将jquery 指定给lenovo对象*/
	lenovo.q = jQuery.noConflict();
	/*填充左侧栏*/
	if(typeof(G_S_fillHand)!='undefined')
		G_S_fillHand();
	else {
		var gsFillInterval = setInterval(function(){
			if(typeof(G_S_fillHand)!='undefined') {
				G_S_fillHand();
				clearInterval(gsFillInterval);
			}
		},2000);
	}
	/*填充head*/
	if(lenovo.g("head"))
		G_head.fill(1);
	else {
		/*填充head*/
		var gheadInterval = setInterval(function(){
			if(lenovo.g("head")) {
				G_head.fill(1);
				clearInterval(gheadInterval);
			}
		},2000);
	}
	/*执行子页面，pageload事件*/
	if(typeof(_pageini)!='undefined')
		_pageini();
	else {
		var pageinitInterval = setInterval(function(){
			if(typeof(_pageini)!='undefined') {
				_pageini();
				clearInterval(pageinitInterval);
			}
		},2000);
	}	
	//load google analytics
	lenovo.loadExtSrc(('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js');	
}
//window.onerror=function(e){
//	alert("脚本错误:"+e);
//}
/*子页命名规则：双下划线：__name，为页面对象名；单下划线：_name，为脚本函数名*/
/*google-analytics.com*/
var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-15794150-1']);_gaq.push(['_trackPageview']);

