www.gusucode.com > QQ空间互踩联盟源码程序asp编程 > qqtool/js/cp.js

    if('undefined'==typeof(cpro_client)){var cpro_client='';}
if('undefined'==typeof(cpro_template)){var cpro_template='';}
if('undefined'==typeof(cpro_h)){var cpro_h='';}
if('undefined'==typeof(cpro_w)){var cpro_w='';}
if('undefined'==typeof(cpro_rad)){var cpro_rad='';}
if('undefined'==typeof(cpro_cbd)){var cpro_cbd='';}
if('undefined'==typeof(cpro_cbg)){var cpro_cbg='';}
if('undefined'==typeof(cpro_ctitle)){var cpro_ctitle='';}
if('undefined'==typeof(cpro_cdesc)){var cpro_cdesc='';}
if('undefined'==typeof(cpro_curl)){var cpro_curl='';}
if('undefined'==typeof(cpro_clink)){var cpro_clink='';}
if('undefined'==typeof(cpro_flush)){var cpro_flush=4;}
if('undefined'==typeof(cpro_ts)){var cpro_ts=1;}
if('undefined'==typeof(cpro_at)){var cpro_at='';}
if('undefined'==typeof(cpro_cn)){var cpro_cn=1;}else{cpro_cn++;}
var cpro_word='';

function fv()
{
	var i,v='0',n=navigator,s='Shockwave Flash';
	if(n.plugins&&n.plugins.length)
	{
		for(i=0;i<n.plugins.length;i++)
		{
			if(n.plugins[i].name.indexOf(s)!=-1){v=n.plugins[i].description.split(s)[1];break;}
		}
	}
	else if(window.ActiveXObject)
	{
		for(i=10;i>=2;i--)
		{
			try {if(eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+i+"');")){v=i;break;}}catch(e){}
		}
	}
	return v;
}
function geturl(cpro_refer)
{
	if(('undefined'==typeof(cpro_template))||(cpro_template==null)||(cpro_template==''))
	{
		cpro_template='text_default_125_125';
	}
	if(('undefined'==typeof(cpro_flush))||(cpro_flush==null)||(cpro_flush=='')||(cpro_flush<1)||(cpro_flush>4))
	{
		cpro_flush=4;
	}
	cprourl='http://cpro.baidu.com/cpro/ui/uijs.php?n='+cpro_client;
	cprourl+='&rsi5='+cpro_flush;
	cprourl+='&tn='+cpro_template;
	cprourl+='&rsi0='+cpro_w;
	cprourl+='&rsi1='+cpro_h;
	cprourl+='&rss0='+escape(cpro_cbd);
	cprourl+='&rss1='+escape(cpro_cbg);
	cprourl+='&rss2='+escape(cpro_ctitle);
	cprourl+='&rss3='+escape(cpro_cdesc);
	cprourl+='&rss4='+escape(cpro_curl);
	cprourl+='&rss5='+escape(cpro_clink);
	cprourl+='&rad='+cpro_rad;
	var a=window,b=document,c=top.location,d=b.location,e=b.documentElement,f=b.body;
	cpro_word=document.referrer;
	if (c===d){cpro_word=c;}	
	else
	{
		var cif=1,h=0,w=0;
		try{c.toString();}catch(e){cif+=2;}
		if(a.innerHeight)
		{
			h=a.innerHeight;
			w=a.innerWidth;
		}
		else if(e&&e.clientHeight)
		{
			h=e.clientHeight;
			w=e.clientWidth;
		}
		else if(f)
		{
			h=f.clientHeight;
			w=f.clientWidth;
		}
		if(h<10||w<40)
		{
			cif+=4;
		}
		else if(h<cpro_h||w<cpro_w)
		{
			cif+=8;
		}
		cprourl+='&if='+cif;
	}
	cpro_word=typeof(encodeURIComponent)=='function'?encodeURIComponent(cpro_word):escape(cpro_word);
	cprourl+='&word='+cpro_word;
	if(cpro_at!='')
	{
		var at=0,aat=cpro_at.split('_');
		for(var i=0;i<aat.length;i++)
		{
			if(aat[i]=="text"){at|=1;}
			else if(aat[i]=="image"){at|=2;}
			else if(aat[i]=="flash"){at|=4;}
			else if(aat[i]=="video"){at|=8;}
		}
		cprourl+='&at='+at;
	}
	cprourl+='&ts='+cpro_ts;
	cprourl+='&cn='+cpro_cn;
	cprourl+='&fv='+fv();
	if(cpro_refer!='')
	{
		cprourl+='&refer='+cpro_refer;
	}
	return cprourl;
}
function showad()
{
	if(('undefined'==typeof(cpro_w))||(cpro_w==null)||(cpro_w==''))
	{
		cpro_w='125';
	}
	if(('undefined'==typeof(cpro_h))||(cpro_h==null)||(cpro_h==''))
	{
		cpro_h='125';
	}
	//document.write('<img style=display:none />');
	var cpro_refer=typeof(encodeURIComponent)=='function'?encodeURIComponent(document.referrer):escape(document.referrer);
	var cpro_ad='<iframe align="center,center" marginWidth=0 marginHeight=0 scrolling=no frameBorder=0 width='+cpro_w+' height='+cpro_h+' allowTransparency src="'+geturl(cpro_refer)+'"></iframe>';
	return cpro_ad;
}
document.write(showad());