﻿// JScript 文件
/*
    var arrImg = ["1.jpg","1P1150033.jpg"];
    for(var i=0;i<arrImg.length;i++)
    {
        arrImg[i] = "image/薄膜开关/" + arrImg[i];
    }
	var t=new LoadImageClass();
	
	t.CallBack = function(arr)
	{
		
		var str="";
		for(var i=0;i<arr.length;i++)
		{
			str+='<img src="'+arr[i]+'" /><br/>';
		}
		document.getElementById("bigImg").innerHTML=str;
	}
	t.LoadImages(arrImg);
*/

//图片缩放函数
function ResizeImg(ImgD,iwidth,iheight)
{
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0)
	{
		if(image.width/image.height>= iwidth/iheight)
		{
			if(image.width>iwidth)
			{
				ImgD.width=iwidth;
				ImgD.height=(image.height*iwidth)/image.width;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
		else
		{
			if(image.height>iheight)
			{
				  ImgD.height=iheight;
				  ImgD.width=(image.width*iheight)/image.height;
			}
			else
			{
			   ImgD.width=image.width;
			   ImgD.height=image.height;
			}
		}
	}
}

/* index menu*/
 function over_change(src)
    {

           
		    if (!src.contains(event.fromElement)) 
	 	    { 
    	 		
			    src.className="menu_right_over";
	 	    }
    	 		
    }
 
 function out_change(src)
    {
		    if (!src.contains(event.toElement))
			    {
			        
			          src.className="menu_right_out";
			        
        			
			    }
    }
    
    
/* product leftmenu*/
 function pro_over_change(src)
    {

           
		    if (!src.contains(event.fromElement)) 
	 	    { 
    	 		
			    src.className="pro_list pro_Grey";
	 	    }
    	 		
    }
 
 function pro_out_change(src)
    {
		    if (!src.contains(event.toElement))
			    {
			        
			          src.className="pro_list";
			        
        			
			    }
    }
    
function LoadImageClass()
{
	var me = this;
	var a = [];	//图片数组
	this.Idx = 0;	//已经被加载的图片个数
	this.Num = 0;	//图片总数

	//下载图片
	this.LoadImages = function(s)
	{
		a = s.split(",");
		this.Num = a.length;
		DownImg();
	}

	function DownImg()
	{
		var i=new Image();
		var f = true;
		i.onload= function()
		{
			if (f)
			{
				f = false
				me.Idx++;
				if (me.LoadIng) me.LoadIng();
				if (me.Idx<me.Num) DownImg();
				else if(me.callback) me.callback(a);
			}
		}
		i.src = a[me.Idx];
	}
}

var pageindex = 1;

function page_next()
{ 
/*
    var pa = 0;
    for(var i=pageindex; i<=10;i++)
    {
        var imgx = document.getElementById("img"+i);
        if(i<=arrImg.length)
        {
         imgx.src = "image/薄膜开关/" + arrImg[i];
         pa++;
        }
    }   
    pageindex = pa + pageindex;
    */
}

function page_last()
{}



