﻿// JavaScript Document
//焦点图程序
var bhnr1=new Array();var bhnr2=new Array();
var bhtime=3;//变化时间间隔,单位秒，数量越大，间隔时间越长
var bhsl=0;//图文变化数量
var bhi=1;var bhtmd=100;var onmouse = false;var bhzt=bhtime*100; //声明变量

function indexjdt() {
	bhnr1[0] ="";
	bhsl=i;
	for (i=1;i<=bhsl;i++) {
		bhnr1[0]+= "<a href=\"javascript:bhdy("+i+")\" id=\"jdbut"+i+"\" class=\"jdbut\" hidefocus=\"true\">"+i+"</a>";
		if (photourl[i]=="") {
			bhnr1[i] ="<img src=\""+photoimg[i]+"\" alt=\""+phototxt[i]+"\" />";
		} else {
			if (photourl[i].indexOf("http://")>=0) {
				if (photourl[i].indexOf(".jpg")>0 || photourl[i].indexOf(".jpge")>0 || photourl[i].indexOf(".gif")>0) {
					bhnr1[i] ="<a href=\"indexjdt.html?"+photourl[i]+"\" target=\"_blank\"><img src=\""+photoimg[i]+"\" alt=\""+phototxt[i]+"\" /></a>";
				} else {
					bhnr1[i] ="<a href=\""+photourl[i]+"\" target=\"_blank\"><img src=\""+photoimg[i]+"\" alt=\""+phototxt[i]+"\" /></a>";
				}
			} else {
				bhnr1[i] ="<a href=\"indexjdt.html?"+photourl[i]+"\" target=\"_blank\"><img src=\""+photoimg[i]+"\" alt=\""+phototxt[i]+"\" /></a>";
			}
		}
		bhnr2[i] = ""+ phototxt[i];
	}
	document.getElementById("hotphoto_photo").innerHTML=bhnr1[1];
	document.getElementById("hotphoto_button").innerHTML=bhnr1[0];
	document.getElementById("hotphoto_txt").innerHTML=bhnr2[1];
	document.getElementById("jdbut1").className="jdbuton";
	bhsj=setInterval('bhtmminus()',10);
}

//焦点图动作
function bhqh() {
	bhi=bhi+1;//确定要变换的图文组
	if (bhi>bhsl) bhi=1;
	if (bhi<=0) bhi=bhsl;
	document.getElementById("hotphoto_photo").innerHTML=bhnr1[bhi];
	document.getElementById("hotphoto_txt").innerHTML=bhnr2[bhi];
	for (i=1;i<=bhsl;i++) {
		document.getElementById("jdbut"+i).className="jdbut";
	}
	document.getElementById("jdbut"+bhi).className="jdbuton";
	bhzt=bhtime*100;
}
function bhdy(tpdy) {
	bhi=tpdy-1;
	bhqh();
}
function bhdy2(tpdy) {
	if (tpdy==-1) bhi=bhi-2;
	bhqh();
}
function bhtmminus() {
	if (onmouse) {
		bhtmd=100;
		bhzt=bhtime*100-1;
		if(navigator.appName == "Microsoft Internet Explorer") {
			document.getElementById("hotphoto_photo").filters.alpha.opacity=100;
		} else {
		document.getElementById("hotphoto_photo").style.opacity=1;
		}
	} else {
		if (bhzt<=0) {
			bhtmd = bhtmd-5;
			if(navigator.appName == "Microsoft Internet Explorer") {
				document.getElementById("hotphoto_photo").filters.alpha.opacity=bhtmd;//改变目标透明度
			} else {
				document.getElementById("hotphoto_photo").style.opacity=(bhtmd/100);//ff
			}
			if (bhtmd<=10) {
				bhtmd=10;
				bhqh();
			}
		} else {
			if (bhzt>=bhtime*100) {
				bhtmd=bhtmd+5;
				if (bhtmd>100) {
					bhtmd=100;
					bhzt=bhzt-1;
					if(navigator.appName == "Microsoft Internet Explorer") {
						document.getElementById("hotphoto_photo").filters.alpha.opacity=bhtmd;//改变目标透明度
					} else {
						document.getElementById("hotphoto_photo").style.opacity=(bhtmd/100);//ff
					}
				} else {
					if(navigator.appName == "Microsoft Internet Explorer")  {
						document.getElementById("hotphoto_photo").filters.alpha.opacity=bhtmd;//改变目标透明度
					} else {
						document.getElementById("hotphoto_photo").style.opacity=(bhtmd/100);//ff
					}
				}
			} else {
				bhzt=bhzt-1;
			}
		}
	}
}
function bhout() {
	onmouse = false;
}
function bhover() {
	onmouse = true;
}
with(document.getElementById("hotphoto_photo")){
	onmouseover=new Function("bhover()");
	onmouseout=new Function("bhout()");
}
with(document.getElementById("hotphoto_txt")){
	onmouseover=new Function("bhover()");
	onmouseout=new Function("bhout()");
}
indexjdt();
