function setCookie (name, value) {
  document.cookie = name + "=" + value + "; path=/; domain=163.com";
}

function getCookie(name) {
  var search;
  search = name + "="
  offset = document.cookie.indexOf(search) 
  if (offset != -1) 
	  {
    offset += search.length ;
    end = document.cookie.indexOf(";", offset) ;
    if (end == -1)
      end = document.cookie.length;
    return unescape(document.cookie.substring(offset, end));
	}
  else
    return "";
}

 function autoview()  {
  	frmauto.btnauto.value="Í£Ö¹²¥·Å";
	sTimer = setTimeout("shownext()",frmauto.time.value*1000);
	setCookie("imgautoplay","1");
	setCookie("imgautotime",frmauto.time.value);

  }
  
function clickauto()  {
          if (frmauto.btnauto.value=="Í£Ö¹²¥·Å")
          {
          	frmauto.btnauto.value="×Ô¶¯²¥·Å";
          	clearTimeout(sTimer);
          	setCookie("imgautoplay","0");
          }
          else
          {
          	frmauto.btnauto.value="Í£Ö¹²¥·Å";
          	sTimer = setTimeout("shownext()",frmauto.time.value*1000);
          	setCookie("imgautoplay","1");
          	setCookie("imgautotime",frmauto.time.value);
          	
          }
  }
  
 
 function changetime()  {

    if (frmauto.time.value<1) return;
    if (sOldTime==frmauto.time.value) return;
    
    sOldTime=frmauto.time.value;
    if (frmauto.btnauto.value=="Í£Ö¹²¥·Å")
    {
    	clearTimeout(sTimer);
    	sTimer = setTimeout("shownext()",frmauto.time.value*1000);
    }
    setCookie("imgautotime",frmauto.time.value);
  }
  


function startview(){

		var str=getCookie("imgautoplay");
		frmauto.time.value=getCookie("imgautotime");
		if (frmauto.time.value<1) 
			{
				frmauto.time.value=5;
				autoview();
			}
		else if (str=="1")
			{
				autoview();
			}
		setInterval("changetime()",100);
	
	}





