﻿function $(v){return document.getElementById(v);}
function PicOver1(count,linkstr,imgstr,ArrLink,ArrImg)
{
	var picCount = count;
	var oi =  $(imgstr);
	var divlink = $(linkstr);
	var links = ArrLink;
	var imgs = ArrImg;
	
	var pause = false;
	var curid = 1;
	var lastid = 1;
	var sw = 1;
	var opacity = 100;
	var speed = 15;
	var delay = (document.all)? 400:700;
	var PicOpration = new Object();
	PicOpration.SetAlpha = function()
	{
		if(document.all){
			if(oi.filters && oi.filters.Alpha) oi.filters.Alpha.opacity = opacity;
		}else{
			oi.style.MozOpacity = ((opacity >= 100)? 99:opacity) / 100;
		}
	};
	
	PicOpration.ImgSwitch = function(id, p){
		if(p){
			pause = true;
			opacity = 100;
			this.SetAlpha();
		}
		oi.src = imgs[id].src;
		divlink.href = links[id];
		curid = lastid = id;
	};
	this.Pause = function (s){
		pause = s;
	};
	this.ScrollImg = function(){
		
		if(pause && opacity >= 100) return;
		if(sw == 0){
			opacity += 2;
			if(opacity > delay){ opacity = 100; sw = 1; }
		}
		if(sw == 1){
			opacity -= 3;
			if(opacity < 10){ opacity = 10; sw = 3; }
		}
		
		PicOpration.SetAlpha();
		
		if(sw != 3) return;
		sw = 0;
		curid++;
		//修改点2：这里的4也是个数
		if(curid > picCount) curid = 1;
		PicOpration.ImgSwitch(curid, false);
	};
	this.StartScroll = function(){
		setInterval(this.ScrollImg, speed);
	};
	this.CheckLoad = function(){
		if (imgs[1].complete == true && imgs[2].complete == true) {
			clearInterval(checkid);
			setTimeout(this.StartScroll, 1500);
		}
	};
}

/*var FloatLeft = new Object();
FloatLeft.lastScrollY=0;
FloatLeft.Flaot_Div = new Array();
FloatLeft.Flaot_Div[1] = "pic_div";
FloatLeft.heartBeat= function()
{
        var diffY;
      
        if (document.documentElement && document.documentElement.scrollTop)
            diffY = document.documentElement.scrollTop;
        else if (document.body)
            diffY = document.body.scrollTop;
        if(diffY ==0)
        {
                        document.getElementById(FloatLeft.Flaot_Div[1]).style.top= "350px";  
        }
        else
        {
            percent=.1*(diffY-FloatLeft.lastScrollY); 
            if(percent>0)
                percent=Math.ceil(percent); 
            else 
                percent=Math.floor(percent);
                
            document.getElementById(FloatLeft.Flaot_Div[1]).style.top= parseInt(document.getElementById(FloatLeft.Flaot_Div[1]).style.top)+percent+"px";  
                        
            FloatLeft.lastScrollY = FloatLeft.lastScrollY+percent; 
        }
 
};
定义function时不需要var声明,这和c#有点出入

var hhah = {
heh: function(){eew},};

*/