/**
 * @author bob
 */
var ad_box = new Class({
	Implements: Options,
	options: {
		id: null,
		top: 'auto',  
		left: 'auto', 
		right: 'auto', 
		bottom: 'auto', 
		width: 100, //宽度
		height: 480, //高度
		title: '', //窗口的标题
		content: null
	},
	initialize: function(options) {
		this.setOptions(options);

		var adbox = this.adbox = new Element('div', {'id':this.options.id}).setStyles({
			'top': this.options.top,
			'right': this.options.right,
			'left': this.options.left,
			'bottom':this.options.bottom,
			'position':'fixed',
			'z-index': '10000'
		}).inject(document.body);
		var adhead, adbody;
		adbox.store(
			'adhead', adhead = new Element('div', {'class': 'ad_head'}).inject(adbox)
		).store(
			'adbody', adbody = new Element('div', {'class': 'ad_body'}).inject(adbox)
		);
		new Element('div', {'text': '关闭','id': 'close_ad'+this.options.id}).setStyles({
			'text-align': 'right'
		}).addEvent('click', function(){
			this.hide();
		}.bind(this)).inject(adhead);		
		adbody.adopt(
			this.options.content
		);	
		if(Browser.Engine.trident4) {
			adbox.setStyles({
				'position': 'absolute'
			})
			this.automove();
		}	
	},
	automove: function(){
		var top = window.getScroll().y + this.options.top;
		this.adbox.setStyle('top',top);
		this.automove.delay(200,this);
	},
	
	hide: function(){
		this.adbox.setStyle('display','none');
	}
});
window.addEvent('domready',function(){	
	/*ad_content_r = new Element('div').adopt(
		new Element('a', {'href': 'http://www.xixun.cn/campaign-photo/dameiren/' ,'target':'_blank'}).adopt(
			new Element('img', {'src':'http://we.xixun.cn/we_img/07233.jpg','width':'100'})
		)
		
	);	
	var adbox_r = new ad_box({
		'id' :'adr',
		'top':300,
		'right':0,
		'height':300,
		'content': ad_content_r
	});*/
	
	/*ad_content_r_2 = new Element('div').adopt(
		new Element('a', {'href': 'http://survey.xixun.cn/q.php?qname=diaocha_22&qlang=cn' ,'target':'_blank'}).adopt(
			new Element('img', {'src':'/we_img/07232.jpg','width':'100'})
		)
	);	
	var adbox_r_2 = new ad_box({
		'id' :'adr2',
		'top':500,
		'right':0,
		'height':180,
		'content': ad_content_r_2
	});
*/
	ad_content_l = new Element(
		'div',{
			'style':'padding:108px 0 0 10px;background:url("/js/zx_l.jpg");width:90px; height:92px;'
		}
	);
	
	var qq_div = new Element('div');
	
	if(online[0]==0 ) {
		qq_div.adopt(
			new Element('a', {
				'href': 'http://sighttp.qq.com/cgi-bin/check?sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4',
				'target':'_blank',
				'style':'display:block;margin-bottom:6px;',
				'onclick':"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"
				
			}).adopt(
				new Element('img', {'src':'/new_img/zx_ico1_off.gif','width':'81','alt':"点我咨询"})
			)
		)
	} else {
		qq_div.adopt(
			new Element('a', {
				'href': 'http://sighttp.qq.com/cgi-bin/check?sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4',
				'target':'_blank',
				'style':'display:block;margin-bottom:6px;',
				'onclick':"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"
				
			}).adopt(
				new Element('img', {'src':'/new_img/zx_ico1.gif','width':'81','alt':"点我咨询"})
			)
		)
	}
	if(online[1]==0 ) {
		qq_div.adopt(
			new Element('a', {
				'href': 'http://sighttp.qq.com/cgi-bin/check?sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4',
				'target':'_blank',
				'style':'display:block;margin-bottom:6px;',
				'onclick':"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"
				
			}).adopt(
				new Element('img', {'src':'/new_img/zx_ico2_off.gif','width':'81','alt':"点我咨询"})
			)
		)
	} else {
		qq_div.adopt(
			new Element('a', {
				'href': 'http://sighttp.qq.com/cgi-bin/check?sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4',
				'target':'_blank',
				'style':'display:block;margin-bottom:6px;',
				'onclick':"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"
				
			}).adopt(
				new Element('img', {'src':'/new_img/zx_ico2.gif','width':'81','alt':"点我咨询"})
			)
		)
	}
	if(online[2]==0 ) {
		qq_div.adopt(
			new Element('a', {
				'href': 'http://sighttp.qq.com/cgi-bin/check?sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4',
				'target':'_blank',
				'style':'display:block;margin-bottom:6px;',
				'onclick':"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"
				
			}).adopt(
				new Element('img', {'src':'/new_img/zx_ico3_off.gif','width':'81','alt':"点我咨询"})
			)
		)
	} else {
		qq_div.adopt(
			new Element('a', {
				'href': 'http://sighttp.qq.com/cgi-bin/check?sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4',
				'target':'_blank',
				'style':'display:block;margin-bottom:6px;',
				'onclick':"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=64d43efd6ebd3c392df326d3f3121993e83684976fb59a4d2626ef7c3fe5bdb4';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"
				
			}).adopt(
				new Element('img', {'src':'/new_img/zx_ico3.gif','width':'81','alt':"点我咨询"})
			)
		)
	}
	
	ad_content_l.adopt(qq_div);
	var adbox_l = new ad_box({
		'id' :'adr_qq',
		'top':90,
		'left':0,
		'content': ad_content_l
	});	
	
	var qq_2 = $('qq_2');
	
	if (qq_2) {
		var qq_div2 = qq_div.clone();
		qq_2.adopt(qq_div2);
	}

})

