﻿// JavaScript Document
//---------滚动效果------------------
var DivScRight;
var DivScLeft;
function DivScLeftExe(num)
{  var n1 = parseInt(document.getElementById(num).scrollLeft);
   var n2 = parseInt(document.getElementById(num).clientWidth);
   var n3 = parseInt(document.getElementById(num).scrollWidth);
		document.getElementById(num).scrollLeft += 2;
    if (n1 == n3)
    {
        DivScLeftEnd()
    }
    else
    {
        DivScLeft = setTimeout(function(){DivScLeftExe(num);},0);

    }
}
function DivScLeftEnd()
{
    clearTimeout(DivScLeft);
}
function DivScRightExe(num)
{
    var n1 = parseInt(document.getElementById(num).scrollLeft);
    var n2 = parseInt(document.getElementById(num).clientWidth);
    var n3 = parseInt(document.getElementById(num).scrollWidth);
    document.getElementById(num).scrollLeft -= 2;
    if (n1 == 0)
    {
        DivScRightEnd()
    }
    else
    {
        DivScRight = setTimeout(function(){DivScRightExe(num);},0);
    }
}
function DivScRightEnd()
{
    clearTimeout(DivScRight);
}


//头部的显示层效果
function $(){return document.getElementById?document.getElementById(arguments[0]):eval(arguments[0]);}
	var pro;
	var proc;
	function show(a,b,id){/*--打开--*/
		clearInterval(pro);
		clearInterval(proc);
		var o = $(id);
		o.style.display = "block";
		o.style.width = "1px";
		o.style.height = "1px"; 
		pro = setInterval(function(){opener(o,a,b)},10);
	}	
	function opener(o,x,y){/*--打开x--*/		
		var cx = parseInt(o.style.width);
		var cy = parseInt(o.style.height);
		if(cx < x)
		{
			o.style.width = (cx + Math.ceil((x-cx)/5)) +"px";
			o.style.height = (cy + Math.ceil((y-cy)/5)) +"px";
		}
		else
		{
			clearInterval(pro);
		}
	}	
	function closeed(id){/*--关闭--*/
		clearInterval(pro);
		clearInterval(proc);
		var o = $(id);
		if(o.style.display == "block")
		{
			proc = setInterval(function(){closer(o)},10);			
		}		
	}	
	function closer(o){/*--打开x--*/
		var cx = parseInt(o.style.width);
		var cy = parseInt(o.style.height);
		if(cx > 0)
		{
			o.style.width = (cx - Math.ceil(cx/5)) +"px";
			o.style.height = (cy - Math.ceil(cy/5)) +"px";
		}
		else
		{
			clearInterval(proc);	
			o.style.display = "none";
		}
	}	
	
