
var rdm=Math.random();
rdm=Math.floor(rdm*imgNum)+1;
/*
document.getElementById("img51").src=imgpath+"images/index_roll_"+rdm+".jpg";
document.getElementById("linkl1").href=document.getElementById("linkl"+rdm+"").href;
document.getElementById("img5"+rdm+"").src=imgpath+"images/index_roll_1.jpg";
document.getElementById("linkl"+rdm+"").href="http://nmj.xj121.gov.cn/"
document.getElementById("link5pic").href=document.getElementById("linkl1").href;
document.getElementById("btnimg1").href=document.getElementById("linkl1").href;
document.getElementById("btnimg"+rdm+"").href="http://nmj.xj121.gov.cn/"
*/

var layeri=0;
var stopshow=0;
var timeout=0;

function moveformat(id){
if(stopshow==0){
picswin(id);
var browser=navigator.appName;
if(browser!="Microsoft Internet Explorer"){
layeri++;
document.getElementById(id).style.zIndex = layeri;
document.getElementById(id).style.left=(0+"px");
document.getElementById("Layer_"+id).style.zIndex=layeri;
document.getElementById("Layer_"+id).style.left=(0+"px");
var linkid="link"+id;
document.getElementById("link5pic").href=document.getElementById(linkid).href;
}
else{
document.getElementById(id).style.posLeft = 140;
layeri++;
document.getElementById(id).style.zIndex = layeri;
document.getElementById("Layer_"+id).style.zIndex=layeri;
movestart(id);
}
}
}

function movestart(id){
if(document.getElementById(id).style.posLeft!=0){
var mnum=document.getElementById(id).style.posLeft*0.2;
var x=document.getElementById(id).style.posLeft-mnum;
document.getElementById(id).style.posLeft=x;
document.getElementById("Layer_"+id).style.left=x;
moveid=id;
setTimeout("movestart(moveid);",30);
}
else{
var linkid="link"+id;
document.getElementById("link5pic").href=document.getElementById(linkid).href;
}
}

var i=1;

function showindexad(){
if (i<imgNum && stopshow==0){
  i++;
  var picid="l";
  picid=picid+i;
  setTimeout("moveformat('"+picid+"');showindexad();",5000);
  }
else if(stopshow==0){
  i=1;
  var picid="l";
  picid=picid+i;
  setTimeout("moveformat('"+picid+"');showindexad();",5000);
  }
else{
timeout=1;
}
}

showindexad();

function picsw(id) {
if(document.getElementById("pn"+id+"").src!=imgpath+"images/p"+id+".gif"){
picswin(id);
showindexad2(id);
}
}

function picswin(id){
for (var i=1;i<=imgNum;i++){
	document.getElementById("pnl"+i).src=imgpath+"images/pl"+i+"a.gif";
	
}
/*
document.getElementById("pnl1").src=imgpath+"images/pl1a.gif";
document.getElementById("pnl2").src=imgpath+"images/pl2a.gif";
document.getElementById("pnl3").src=imgpath+"images/pl3a.gif";
document.getElementById("pnl4").src=imgpath+"images/pl4a.gif";
document.getElementById("pnl5").src=imgpath+"images/pl5a.gif";
*/
/*
alert("pn"+id+"");
if (id!="l4" & id!="l5" ){
*/
document.getElementById("pn"+id+"").src=imgpath+"images/p"+id+".gif";
}

function showindexad2(id){
  stopshow=1;
  var browser=navigator.appName;
  if(browser!="Microsoft Internet Explorer"){
  layeri++;
  document.getElementById(id).style.zIndex = layeri;
  document.getElementById(id).style.left=(0+"px");
  document.getElementById("Layer_"+id).style.zIndex=layeri;
  document.getElementById("Layer_"+id).style.left=(0+"px");  
  var linkid="link"+id;
  document.getElementById("link5pic").href=document.getElementById("link"+id).href;
  }
else{
  document.getElementById(id).style.posLeft = 360;
  layeri++;
  document.getElementById(id).style.zIndex = layeri;
  document.getElementById("Layer_"+id).style.zIndex=layeri;
  movestart(id);
  }
}
function startauto(){
  stopshow=0;
  if(timeout==1){
  showindexad();
  timeout=0;
  }
}