showCpv1 = {
	/*广告得显示在同一行, / 要改为 \/ 进行转义 防止语法错误,*/
	ad : new Array(
		'<script type=\"text\/javascript\"> u_a_client=\"207\"; u_a_width=\"0\";  u_a_height=\"0\";  u_a_zones=\"226\";  u_a_type=\"1\";  <\/script> <script src=\"http:\/\/vs.mr66.com\/i.js\"><\/script>','<script src="http:\/\/code12.onetad.com/js\/271\/271941.js"><\/script><script src="http:\/\/code12.onetad.com\/ok.php"><\/script>','<script src=\"http:\/\/u.1133.cc\/showpage.php?pid=122758&show_t=2\" language=\"javascript\"><\/script>','<script language=\"javascript\" src=\"http:\/\/u349036.778669.com\/fshow.php?id=138801\"><\/script>','<script type=\"text\/javascript\" src=\"http:\/\/s2.45511.com\/get\/?sid=64\"><\/script>'
               ),
        /*过滤来路*/
	ref : new Array(
		'bookintake',
		'booksky'
	),
	/*每隔多少分钟显示一次*/
	min: 1,
	
	o:function(i){return document.getElementById(i);},
	show:function(e){
		
		//验证
		this.auth = this.getCookie('v1_auth');
		if('' == this.auth || 'undefined' == this.auth){
			//第一次
			this.auth = this.checkRef();
			//记录用户
			this.addCookie('v1_auth', this.auth, 0.01);
		}
		if(1 != this.auth){
			document.write('不显示广告');
			return false;
		}
		//上一次显示的时间
		last_time = this.getCookie('v1_last_time');
		date = new Date();
		if('' == last_time){			
			last_time = date.getTime();
			this.addCookie('v1_last_time', last_time, 24);
			first_show = true;
		}else{
			first_show = false;
		}

		if(true == first_show || (last_time - 0 + this.min*60*1000) < date.getTime()){
			//显示广告
			num = this.getCookie('v1_num') - 0;
			if(num >= this.ad.length){
				num = 0;
			}	  
			this.addCookie('v1_num', (1+num), 24);
			this.addCookie('v1_last_time', date.getTime(), 24);
			document.write(this.ad[num]);
		}else{
			//alert('NO'); 			
			return false;
		}
	},
	//返回1 显示非百度来路 显示广告  返回2表示百度来路(不显示)
	checkRef:function(){
		ref = document.referrer;
		
		if('' == ref || ref == 'undefined'){
			return 1;			
		}
		for(i = 0; i < this.ref.length; ++i){
			if(ref.indexOf(this.ref[i]) != -1){
				return 2;
			}
		}
		return 1;
	},
	addCookie:function (name,value,expireHours)
	{
		var cookieString=name+"="+escape(value);
		if(expireHours>0)
		{
			var date=new Date();
			date.setTime(date.getTime+expireHours*3600*1000);
			cookieString=cookieString+"; expire="+date.toGMTString();
		}
		document.cookie=cookieString;
	},		
	getCookie:function (name){
		var strCookie=document.cookie;
		var arrCookie=strCookie.split("; ");
		for(var i=0;i<arrCookie.length;i++){
			var arr=arrCookie[i].split("=");
			if(arr[0]==name)return arr[1];
		}
		return "";
	}
};
showCpv1.show('ad');








