function NewsInfo(title,link)
{
	this.title=new String(title);
	this.link=link;
	String.prototype.cutstring=function(len)
	{
		var tmp=new String();
		var str=this;
		var counter=0;
		for(var i=0;i<str.length;i++)
		{
			if(len-counter>2)
			{
				tmp+=str.charAt(i);
				if(str.charCodeAt(i)>200)
				{
					counter+=2
				}
				else
				{
					counter++;
				}
			}
			else if(len-counter==2)
			{
				if(str.charCodeAt(i)>200)
				{
					tmp+="..";
					counter+=2;
				}
				else
				{
					tmp+=str.charAt(i);
					counter++;
				}
			}
			else if(len-counter==1)
			{
				tmp+=".";
				counter++;
			}
		}
		return tmp;
	}
}
/*==================================COOKIES控制代码========================================*/

function saveCookie(name,value,days){
	if(days){
		var date=new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000))
		var expires=";expires="+date.toGMTString()
	}
	else expires=""
	document.cookie=name+"="+value+expires+";path=/;domain=chinacqsb.com;"
}
function readCookie(name){
	var nameEQ=name+"=";
	var ca=document.cookie.split(';');
	for(var i=0;i<ca.length;i++){
		var c=ca[i];
		while(c.charAt(0)==' ')c=c.substring(1,c.length)
		if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)
	}
	return "";
}
function readCookies(key,name){
	key=readCookie(key);
	var nameEQ=name+"=";
	var ca=key.split('&');
	for(var i=0;i<ca.length;i++){
		var c=ca[i];
		while(c.charAt(0)==' ')c=c.substring(1,c.length)
		if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)
	}
	return "";
}
function deleteCookie(name){saveCookie(name,"",-1)}



/*==================================广告控制代码========================================*/


var Advs	=new Array();
var AdvPos	=new Array();

function A_Adv(Id,PosId,PosName,Page,Style,Title,Link,Img,Type,Rank,bDate,eDate,Target)
{
	this.getId=function()
	{
		return this.Id;
	}
	this.getPosId=function()
	{
		return this.Postion.Id;
	}
	this.getPosName=function()
	{
		return this.Postion.Name;
	}
	this.getPage=function()
	{
		return this.Page;
	}
	this.getStyle=function()
	{
		return this.Style;
	}
	this.getTitle=function()
	{
		return this.Title;
	}
	this.getLink=function()
	{
		return this.Link;
	}
	this.getImg=function()
	{
		return this.Img;
	}
	this.getType=function()
	{
		return this.Type.getName();
	}
	this.getRank=function()
	{
		return parseInt(this.Rank);
	}
	this.setRank=function( para )
	{
		this.Rank=para;
	}
	this.getbDate=function()
	{
		return this.bDate;
	}
	this.geteDate=function()
	{
		return this.eDate;
	}
	this.getTarget=function()
	{
		return this.Target;
	}
	this.createAdvType=function( type , objstyle )
	{
		switch( type )
		{
			case "Image":
				return new C_AdvType_Image( objstyle )
				break;
			case "Flash":
				return new C_AdvType_Flash( objstyle )
				break;
			case "Movie":
				return new C_AdvType_Movie( objstyle )
				break;
			case "Music":
				return new C_AdvType_Music( objstyle )
				break;
			default:
				return new C_AdvType_Text( objstyle )
				break;
		}
	}

	this.show	= function()
	{
		var str=this.Type.getHtml();
		str=str.replace("$Link$",this.Link);
		str=str.replace("$Src$",this.Img);
		str=str.replace("$Title$",this.Title);
		str=str.replace("$Target$",this.Target);
		return str;
	}
	this.Id		= Id;
	this.Postion= new C_AdvPostion( PosId, new String(PosName).toString() );
	this.Page	= new String(Page).toString();
	this.Style	= createAdvStyle( new String(Style).toString() );
	this.Title	= new String(Title).toString();
	this.Link	= new String(Link).toString();
	this.Img	= new String(Img).toString();
	this.Type	= this.createAdvType( new String(Type).toString() , this.Style );
	this.Rank	= Rank;
	this.bDate	= bDate;
	this.eDate	= eDate;
	this.Target	= Target;
}

function C_Adv_Null(Style)
{
	this.Super=A_Adv;
	this.Super(0,0,"","",Style,"","","","Text",0,"","","");
	this.show	= function()
	{
		var str="";
		return str;
	}
}

/*==================================广告类型类========================================*/

function A_AdvType(name , objstyle )
{
	this.Name		= name;
	this.Style		= objstyle;
	this.Template	= "";
	this.getHtml=function()
	{
		var str=this.Template;
		if(parseInt(this.Style.getWidth())==-1)
			str=str.replace("width=\"$Width$\"","");
		else
			str=str.replace("$Width$",this.Style.getWidth());

		if(parseInt(this.Style.getHeight())==-1)
			str=str.replace("height=\"$Height$\"","");
		else
			str=str.replace("$Height$",this.Style.getHeight());
		return str;
	}
}

function C_AdvType_Text( objstyle )
{
	this.Super=A_AdvType;
	this.Super("Text" , objstyle );
	this.Template	= "<a href=\"$Link$\" title=\"$Title$\" target=\"$Target$\">$Src$</a>";
}

function C_AdvType_Image( objstyle )
{
	this.Super=A_AdvType;
	this.Super("Image" , objstyle );
	this.Template	= "<a href=\"$Link$\" title=\"$Title$\" target=\"$Target$\"><img src=\"$Src$\" width=\"$Width$\" height=\"$Height$\" border=\"0\"></a>";
}


function C_AdvType_Flash( objstyle )
{
	this.Super=A_AdvType;
	this.Super("Flash" , objstyle );
	this.Template	= "<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$\" ><param name=\"movie\" value=\"$Src$\"><param name=\"quality\" value=\"high\"><embed src=\"$Src$\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"$Width$\" height=\"$Height$\"></embed></object>";
}

/*==================================广告管理类========================================*/
function A_AdvMgr()
{
	this.Postion= null
	this.Adv	= new C_Adv_Null();
	this.create=function( Page , PosId )
	{
		this.Postion	= this.getAdvPosById( PosId );
		this.Postion.init( Page );						//创建广告显示策略对象
	}
	this.show	= function()
	{
		if(this.Postion!=null)
		{
			document.write("<a name=\"A" + this.Postion.getId() + "\"></a>");
			document.write(this.Postion.getAdvString());
		}
	}
	this.info	= function()
	{
		if(this.Postion!=null)
			document.write(this.Postion.getAdvInfo());
	}
	this.getAdvPosById=function( PosId )
	{
		var obj=new C_AdvPostion( 0, "" , "" );
		for(var i=0;i<AdvPos.length;i++)
		{
			if(AdvPos[i].getId()==PosId)
			{
				obj=AdvPos[i];
			}
		}
		return obj;
	}
}

/*==================================广告位类========================================*/
function C_AdvPostion( id, name , style , url)
{
	this.Id		= id;
	this.Name	= name;
	this.Style	= createAdvStyle( new String(style).toString() );
	this.Url	= url;
	this.Rule	= new A_AdvRule( "" , this );
	this.Adv	= null;
	this.getId=function()
	{
		return this.Id;
	}
	this.getName=function()
	{
		return this.Name;
	}
	this.getStyle=function()
	{
		return this.Style;
	}
	this.getUrl=function()
	{
		return this.Url + "#A" + this.Id;
	}
	this.init=function( Page )
	{
		switch( parseInt(this.Id) )
		{
			case 1000:
				this.Rule = new C_AdvRule_Home( Page , this );
				break;
			default:
				this.Rule = new A_AdvRule( Page , this );
				break;
		}
		this.Adv		= this.Rule.getCurrentAdv();
	}
	this.getAdvInfo=function()
	{
		return "广告类型：" + this.Style.getDesc().fontcolor("red") + " 尺寸：" + this.Style.getWidth().toString().fontcolor("red") + "px X " + this.Style.getHeight().toString().fontcolor("red") + "px"
	}
	this.getAdvString=function()
	{
		var strAdv		= this.Adv.show();
		if(strAdv=="")
		{
			strAdv="" //"<table width=\"" + this.Style.getWidth() + "\" height=\"" + this.Style.getHeight() + "\" border=\"0\" cellspacing=\"0\"><tr><td align=\"center\" valign=\"center\" bgcolor=\"#FFFFFF\"><img src=\"http://www.cqreview.com/gg/" + this.Style.getName() + ".jpg\" title=\"" + this.Name + "位招商\"></td></tr></table>"; 
		}
		return strAdv;
	}
}

/*==================================广告位策略类========================================*/

function A_AdvRule(Page,objPostion)
{
	this.Page		= new String(Page);
	this.Postion	= objPostion;
	this.AdvList	= new Array();
	this.getCurrentAdv=function()
	{
		this.getAdvList();
		//循环判断广告对象属性，返回最适合的广告对象
		return this.getRealAdv();

	}
	this.getAdvList=function()
	{
		for(var i=0;i<Advs.length;i++)
		{
			if(Advs[i].getPosId()==this.Postion.getId())
			{
				if( Advs[i].getPage().toLowerCase()==this.Page.toLowerCase() || Advs[i].getPage().toLowerCase()=="--" )
				{
					this.AdvList[this.AdvList.length]= Advs[i];
				}
			}
		}
	}
	this.orderByRank=function( list )
	{
		for(var i=0;i<list.length-1;i++)
		{
			for(var j=i+1;j<list.length;j++)
			{
				if(list[i].getRank()<list[j].getRank())
				{
					var obj=list[i];
					list[i]=list[j];
					list[j]=obj;
				}
			}
		}
	}
	this.getRndNum=function( list )
	{
		var num=0;
		for(var i=0;i<list.length;i++)
		{
			num+=list[i].getRank();
			list[i].setRank(num);
		}
		return num;
	}
	this.getRndAdv=function( list , num )
	{
		var index=0;
		for(var i=0;i<list.length;i++)
		{
			if(num<=parseInt(list[i].getRank()))
			{
				index=i;
			}
		}
		return index;
	}
	this.getRealAdv=function()
	{
		if(this.AdvList.length>0)
		{
			var RndNum=this.getRndNum( this.AdvList );
			var rnd=parseInt( Math.round(Math.random()*(RndNum+1)) );
			this.orderByRank(this.AdvList);
			var index=this.getRndAdv( this.AdvList , rnd );
			return this.AdvList[index];
		}
		else
		{
			return new C_Adv_Null(this.Postion.getStyle().toString());
		}
	}
}

function C_AdvRule_Home(Page,objPostion)
{
	this.Super=A_AdvRule;
	this.Super(Page,objPostion);
	this.getAdvList=function()
	{
		for(var i=0;i<Advs.length;i++)
		{
			if(Advs[i].getPosId()==this.Postion.getId())
			{
				if( this.Page.toLowerCase().indexOf( Advs[i].getPage().toLowerCase() )!=-1 || Advs[i].getPage().toLowerCase()=="--" )
				{
					this.AdvList[this.AdvList.length]= Advs[i];
				}
			}
		}
	}
}


/*==================================广告规格类========================================*/
function createAdvStyle( style )
{
	switch(style)
	{
		case "Banner":
			return new C_AdvStyle_Banner();
			break;
		case "Button":
			return new C_AdvStyle_Button();
			break;
		case "ActiveButtonHeight":
			return new C_AdvStyle_ActiveButtonHeight();
			break;
		case "ActiveButton":
			return new C_AdvStyle_ActiveButton();
			break;
		case "ButtonLink":
			return new C_AdvStyle_ButtonLink();
			break;
		case "TopFace":
			return new C_AdvStyle_TopFace();
			break;
		case "BannerLong":
			return new C_AdvStyle_BannerLong();
			break;
		case "BannerLong14":
			return new C_AdvStyle_BannerLong14();
			break;
		case "BannerLong12":
			return new C_AdvStyle_BannerLong12();
			break;
		case "BannerLong34":
			return new C_AdvStyle_BannerLong34();
			break;
		default:
			return new C_AdvStyle_Button();
			break;
	}
}


function A_AdvStyle(name,desc,width,height)
{
	this.Name	= new String(name).toString();
	this.Desc	= new String(desc).toString();
	this.Width	= new Number(width);
	this.Height	= new Number(height);
	this.getName=function()
	{
		return this.Name;
	}
	this.getDesc=function()
	{
		return this.Desc;
	}
	this.getWidth=function()
	{
		return this.Width;
	}
	this.getHeight=function()
	{
		return this.Height;
	}
	this.toString=function()
	{
		return this.Name;
	}

}

function C_AdvStyle_Banner()
{
	this.Super=A_AdvStyle;
	this.Super("Banner","页眉旗帜广告",718,84);
}

function C_AdvStyle_ActiveButton()
{
	this.Super=A_AdvStyle;
	this.Super("ActiveButton","活动按钮广告",198,64);
}

function C_AdvStyle_ActiveButtonHeight()
{
	this.Super=A_AdvStyle;
	this.Super("ActiveButtonHeight","方形活动按钮广告",198,198);
}

function C_AdvStyle_Button()
{
	this.Super=A_AdvStyle;
	this.Super("Button","按钮广告（标准）",120,60);
}

function C_AdvStyle_ButtonLink()
{
	this.Super=A_AdvStyle;
	this.Super("ButtonLink","链接按钮广告（标准）",88,31);
}

function C_AdvStyle_TopFace()
{
	this.Super=A_AdvStyle;
	this.Super("TopFace","高压通栏广告",1000,-1);
}

function C_AdvStyle_BannerLong()
{
	this.Super=A_AdvStyle;
	this.Super("BannerLong","横幅通栏广告",1000,88);
}

function C_AdvStyle_BannerLong14()
{
	this.Super=A_AdvStyle;
	this.Super("BannerLong14","横幅1/4通栏广告",248,88);
}

function C_AdvStyle_BannerLong12()
{
	this.Super=A_AdvStyle;
	this.Super("BannerLong12","横幅1/2通栏广告",576,-1);
}

function C_AdvStyle_BannerLong34()
{
	this.Super=A_AdvStyle;
	this.Super("BannerLong34","横幅3/4通栏广告",763,88);
}


AdvPos[AdvPos.length]= new C_AdvPostion( 1000, "[页眉]旗帜广告" , "Banner" , "http://www.chinacqsb.com" );

AdvPos[AdvPos.length]= new C_AdvPostion( 1100, "[首页]顶部高压通栏广告" , "TopFace" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1101, "[首页]首屏横幅3/4通栏广告" , "BannerLong34" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1102, "[首页]二屏横幅3/4通栏广告" , "BannerLong34" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1103, "[首页]叁屏横幅3/4通栏广告" , "BannerLong34" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1104, "[首页]首屏活动按钮广告（1）" , "ActiveButton" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1105, "[首页]首屏活动按钮广告（2）" , "ActiveButton" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1106, "[首页]首屏活动按钮广告（3）" , "ActiveButton" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1107, "[首页]首屏活动按钮广告（4）" , "ActiveButton" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1108, "[首页]三屏方形活动按钮广告（1）" , "ActiveButtonHeight" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 1109, "[首页]三屏方形活动按钮广告（2）" , "ActiveButtonHeight" , "http://www.chinacqsb.com" );

AdvPos[AdvPos.length]= new C_AdvPostion( 2101, "[内容页]首屏活动按钮广告（1）" , "ActiveButton" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 2102, "[内容页]首屏活动按钮广告（2）" , "ActiveButton" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 2103, "[内容页]首屏活动按钮广告（3）" , "ActiveButton" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 2104, "[内容页]二屏方形活动按钮广告（1）" , "ActiveButtonHeight" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 2105, "[内容页]二屏方形活动按钮广告（2）" , "ActiveButtonHeight" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 2106, "[内容页]底部横幅1/2通栏广告" , "BannerLong12" , "http://www.chinacqsb.com" );

AdvPos[AdvPos.length]= new C_AdvPostion( 3001, "[专刊首页]首屏右侧活动按钮广告（1）" , "ActiveButton" , "http://www.chinacqsb.com/Get/Zhuankan/Cars/" );
AdvPos[AdvPos.length]= new C_AdvPostion( 3002, "[专刊首页]首屏右侧活动按钮广告（2）" , "ActiveButton" , "http://www.chinacqsb.com/Get/Zhuankan/Cars/" );
AdvPos[AdvPos.length]= new C_AdvPostion( 3003, "[专刊首页]首屏右侧活动按钮广告（3）" , "ActiveButton" , "http://www.chinacqsb.com/Get/Zhuankan/Cars/" );
AdvPos[AdvPos.length]= new C_AdvPostion( 3004, "[专刊首页]二屏右侧方形活动广告（1）" , "ActiveButtonHeight" , "http://www.chinacqsb.com/Get/Zhuankan/Cars/" );
AdvPos[AdvPos.length]= new C_AdvPostion( 3005, "[专刊首页]首屏横幅1/2通栏广告" , "BannerLong12" , "http://www.chinacqsb.com/Get/Zhuankan/Cars/" );


AdvPos[AdvPos.length]= new C_AdvPostion( 9000, "[广告刊例]广告" , "TopFace" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9001, "[广告刊例]广告" , "BannerLong" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9002, "[广告刊例]广告" , "BannerLong34" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9003, "[广告刊例]广告" , "BannerLong12" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9004, "[广告刊例]广告" , "BannerLong14" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9005, "[广告刊例]广告" , "Banner" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9006, "[广告刊例]广告" , "ActiveButtonHeight" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9007, "[广告刊例]广告" , "ActiveButton" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9008, "[广告刊例]广告" , "Button" , "http://www.chinacqsb.com" );
AdvPos[AdvPos.length]= new C_AdvPostion( 9009, "[广告刊例]广告" , "ButtonLink" , "http://www.chinacqsb.com" );

function showHideLayer( id )
{
	try
	{
		document.getElementById(id).style.display = "block";
		setTimeout("hideNormalLayer('" + id + "')",15000);
	}
	catch(e)
	{}
}
function hideNormalLayer( id )
{
	try
	{
		document.getElementById(id).style.display="none";
	}
	catch(e)
	{}
}

/*
<SCRIPT LANGUAGE="JavaScript">
<!--
var a=new A_AdvMgr();
a.create(window.location,  );
a.show();
//-->
</SCRIPT>
*/