var Browser=new Object();
var navUa=navigator.userAgent.toLowerCase();
Browser.isMozilla=(typeof document.implementation !='undefined')&&(typeof document.implementation.createDocument !='undefined')&&(typeof HTMLDocument!='undefined');
Browser.isIE=window.ActiveXObject ? true : false;
Browser.isFirefox=(navUa.indexOf("firefox")>-1);
Browser.isOpera=(navUa.indexOf("opera")>-1);
Browser.isIE8= (Browser.isIE&&navUa.indexOf("msie 8")>-1);
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}
try {
if(top.location != self.location&&top.location.host == self.location.host)
document.write("<style>.showTop,.arkTop{display:none;}</style>");
} catch(e) {}

var arkT=new Object();
var oFc=0;
function $(){
return document.getElementById($.arguments[0])
}

function QueryString( paramName ){
    var oRegex = new RegExp('[\?&]' + paramName + '=([^&]+)','i') ;
    var oMatch = oRegex.exec(window.location.search) ;
    if (oMatch && oMatch.length>1) return oMatch[1];
    else return null;
}


var picdata;
var picNum;
var timeOutPlus=10000;
var lastIndex=0;
var tmpIndex=0;
var CurrentIndex=0;

function picAlt(){
/*轮显大图片*/
 if($("PicdataJson")){
if(typeof(picdata_json)=="undefined"){
picdata_json={"pic":[{"imgText":"红树林湿地","Bimg":"images/bar420.jpg","Simg":"images/bar420.jpg"}]};
  }
else
{
}
 picdata=picdata_json["pic"];
 picNum=Math.min(picdata.length,6);
 CurrentIndex=parseInt(Math.random()*picNum);
preImgObj(CurrentIndex);
tmpIndex=CurrentIndex;
arkPreImg[CurrentIndex]=new Image;
arkPreImg[CurrentIndex].onload=function(){artAltImg();this.onload=null;}
arkPreImg[CurrentIndex].src=picdata[CurrentIndex]["Bimg"];
 }
}


function artAltImg(){
var sflin='<ul>';
for(var i=1;i<=picNum;i++){
 sflin+='<li id="sfli'+i+'"><a href="javascript:void(setFocus1('+i+'));">'+i+'</a></li>';
}
sflin+='</ul>';
$("setfoc").innerHTML=sflin;
$("a1").onmouseover=stopchange;
$("a2").onmouseover=stopchange;
$("a1").onmouseout=loopchange;
$("a2").onmouseout=loopchange;
$('b1').style.background='#000000';
SetDiv();
}
/*轮显大图片定义------------------------------------------------------*/
var TimerBp=null;
var isFirstLoop=true;
function SetDiv(){
	try{
		$('b1').style.position="relative";
	}catch(e){}
filla();

}

if(document.images)
var arkPreImg=new Array();
var zoomImg;

function preImgObj(n){
 var loThisOBJ = document.createElement("img");   
 with(loThisOBJ){
  id="tmpI"+n;
  src = picdata[n]["Bimg"];
 // style.cssText="width:210px;height:200px;";
  style.position="absolute";
  style.top="0px";
  style.left="0px";
 }
 $('b1').appendChild(loThisOBJ);
 
}

var curpos=0;
function fadepic(a,b){
if (curpos<0){	
try{
  b.filters[0].opacity=curpos;
}catch(e){
  try{
    b.style.opacity=curpos/100;}
  catch(e){}
 }
curpos+=10;
arkT[fadepic]=setTimeout("fadepic($('tmpI'+tmpIndex),$('tmpI'+CurrentIndex));",60);
}
else{
	if(tmpIndex!=CurrentIndex)
	 a.style.display = 'none';
	 curpos=0;
     tmpIndex=CurrentIndex;
     (CurrentIndex+1)>=picNum?CurrentIndex=0:CurrentIndex++;
	}
}

function filla(){
var tcI=(CurrentIndex<picNum-1)?CurrentIndex+1:0;
if(!$('tmpI'+CurrentIndex))preImgObj(CurrentIndex);
if(!$('tmpI'+tcI)){
arkPreImg[tcI]=new Image;
arkPreImg[tcI].src=picdata[tcI]["Bimg"];
preImgObj(tcI);
}
if(picdata[CurrentIndex]["imgUrl"])
	$('a1').href = picdata[CurrentIndex]["imgUrl"];
else
	$('a1').href = picdata[CurrentIndex]["Bimg"];
	$('a1').innerHTML = picdata[CurrentIndex]["imgText"];
//	$('focusTitle').innerHTML = picdata[CurrentIndex]["imgText"];
//	$('focusDescription').innerHTML = picdata[CurrentIndex]["imgUrl"];
	$('tmpI'+CurrentIndex).style.display = 'block';
	$('tmpI'+tmpIndex).style.zIndex=10;
    fadepic($('tmpI'+tmpIndex),$('tmpI'+CurrentIndex));
	var k = CurrentIndex+1;
	for(var i=1; i<=picNum; i++)
		$('sfli'+i).className=i==k?"focus":"";
	if(Browser.isIE8)
	$("setfoc").innerHTML=$("setfoc").innerHTML;
loopchange();
}
function setFocus1(set){
  clearTimeout(arkT[fadepic]);
  curpos=110;
  fadepic($('tmpI'+tmpIndex),$('tmpI'+CurrentIndex));
	stopchange();
	CurrentIndex = set-1;
	SetDiv();
}
function stopchange(){
  clearTimeout(TimerBp);
}
function loopchange(){
clearTimeout(TimerBp);
TimerBp=setTimeout("SetDiv();",5000);
}
