var fixed_ad_num = 0;
var ns = navigator.appName == "Netscape";

//图象尺寸80*80
function ad_fixed(img_position,img_src,img_width,img_height,img_url,img_title,img_target,is_swf) {
	this.position = img_position;	//图象位置 1:左上 2:右上 3:左下 4:右下
	switch (this.position) {
		case 1:
			this.left = 0;
			this.top = 80;
			break;
		case 2:
			this.left = ns ? pageXOffset + window.innerWidth - 95:document.body.scrollLeft + document.body.offsetWidth - 10;
			this.top = 55;
			break;
		case 3:
			this.left = 0;
			this.top = ns ? pageYOffset + window.innerHeight - 90:document.body.scrollTop + document.body.offsetHeight - 90;
			break;
		case 4:
			this.left =0;
			this.top = ns ? pageYOffset + window.innerHeight - 90:document.body.scrollTop + document.body.offsetHeight - 90;
			break;
	}
	this.src = img_src;												//图片文件SRC
	this.url = img_url;												//图片链接URL
	this.width = img_width;											//图片宽度
	this.height = img_height;										//图片高度
	this.title = img_title;											//图片标题TITLE
	this.index = ++fixed_ad_num;									//图片序号INDEX
	this.target = img_target;
	this.is_swf = this.src.substr(this.src.lastIndexOf(".") + 1) == "swf";	//是否swf格式

	document.writeln('<div id="fixed_' + this.index + '" name="fixed_' + this.index + '" style="position: absolute;width:80;top:' + this.top + ';left:' + this.left + ';visibility: visible;z-index: 1">');
	if (this.is_swf) {
		document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH="' + this.width + '" HEIGHT="' + this.height + '">');
		document.writeln('<PARAM NAME=movie VALUE="' + this.src + '">');
		document.writeln('<PARAM NAME=quality VALUE=high>');
                document.writeln('<PARAM NAME=wmode VALUE=transparent>');
		document.writeln('<EMBED src="' + this.src + '" quality=high WIDTH="' + this.width + '" HEIGHT="' + this.height + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>');
		document.writeln('</OBJECT>');
	} else {
		document.writeln('<a href="' + this.url + '" target="' + this.target + '" title="' + this.title + '"><img src="' + this.src + '" border="0" width="' + this.width + '" height="' + this.height + '"></a>');
	}
	document.writeln('</div>');
}

ad_fixed.prototype.move = fixed_ad_move;

function fixed_ad_move() {
	var x = document.getElementsByName("fixed_" + this.index)
	switch(this.position) {
		case 1:
			if (ns) {
				x[0].left = pageXOffset + window.innerWidth - 130;
				x[0].top = pageYOffset + 300;
			} else {
				x[0].style.left = document.body.scrollLeft + document.body.offsetWidth - 130;
				x[0].style.top = document.body.scrollTop + 5;
			}
			break;
		case 2:
			if (ns) {
				x[0].left = pageXOffset + window.innerWidth - 130;;
				x[0].top = pageYOffset + 203;
			} else {
				x[0].style.left = document.body.scrollLeft + document.body.offsetWidth - 140;
				x[0].style.top = document.body.scrollTop + 214;
			}
			break;
		case 3:
			if (ns) {
				x[0].left = pageXOffset +10;
				x[0].top = pageYOffset + 84;
			} else {
				x[0].style.left = document.body.scrollLeft + 10;
				x[0].style.top = document.body.scrollTop +84;
			}
			break;
		case 4:
			if (ns) {
				x[0].left = pageXOffset + 10;
				x[0].top = pageYOffset + 300;
			} else {
				x[0].style.left = document.body.scrollLeft + 10;
				x[0].style.top = document.body.scrollTop + 300;
			}
			break;
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
		}
	} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) {
		location.reload();
	}
}
MM_reloadPage(true);

//var img_1 = new ad_fixed(1,"movie_s.swf",150,120,"","","",true);
//setInterval("img_1.move()",50);
