﻿// JavaScript Document
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; 
                } 
               //ImgD.alt=image.width+"×"+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; 
                     } 
                //ImgD.alt=image.width+"×"+image.height; 
            } 
　　　　　//ImgD.style.cursor= "pointer"; //改变鼠标指针 
　　　　　//ImgD.onclick = function() { window.open(this.src);} //点击打开大图片 
　　　　//if (navigator.userAgent.toLowerCase().indexOf("ie") > -1) { //判断浏览器，如果是IE 
　　　　　　//ImgD.title = "点击图片可在新窗口打开"; 
　　　　　　//ImgD.onmousewheel = function img_zoom() //滚轮缩放 
　　　　　// { 
　　　　　　　　　//　var zoom = parseInt(this.style.zoom, 10) || 100; 
　　　　　　　　　//　zoom += event.wheelDelta / 12; 
　　　　　　　　　　//if (zoom> 0)　this.style.zoom = zoom + "%"; 
　　　　　　　　　　//return false; 
　　　　//　 } 
　　　 // } else { //如果不是IE 
　　　　　　　    // ImgD.title = "点击图片可在新窗口打开"; 
　　　　　//　   } 
    } 
}

function resizeimg_1(ImgD,iwidth,iheight) 
{ 
     var image=new Image(); 
	 var TempWidth;
     image.src=ImgD.src; 
     if(image.width>0 && image.height>0)
	 { 
	 	if(image.width<=iwidth)
		{
			ImgD.width=image.width;
			ImgD.height=iheight;
		}
		else
		{
			var k;
			k=image.width-iwidth;
			var k1;
			k1=k/image.width;
			ImgD.width=iwidth;
			ImgD.height=image.height-image.height*k1;
		}
		
	 }
}


/*********************************************************************************************
/                                                   时间比较    
/    格式必须为 yyyy-MM-dd HH:mm:SS ，或 yyyy-MM-dd ，或 MM-dd，
/    或 HH:mm:SS ，或 HH:mm 。    且beginTime和endTime必须格式相同。
**********************************************************************************************/

function timeRather(beginTime, endTime){
    var beginTemp = beginTime.split(" ");
    var endTemp = endTime.split(" ");
    // 格式判断
    if(beginTemp[1] == null){
        return judgement(beginTime, endTime);    
    }else{
        if(beginTemp[0] == endTemp[0]){
            return judgement(beginTemp[1], endTemp[1]);
        }
        return judgement(beginTemp[0], endTemp[0]);
    }
}

// 分解TempDate或TempTime
function resolution(r){
    var splitTemp = r.split("-");
    if(splitTemp[1] == null){
        splitTemp = r.split(":");
    }
    return splitTemp;
}

// 判断方法
function judgement(beginTime, endTime){
    var i=0, d1, d2;
    d1 = resolution(beginTime);
    d2 = resolution(endTime);
    for(i in d1){
        if(d1[i] <d2[i]){
            return true;
        }
        if(d1[i] >d2[i]){
            return false;
        }
    }
    return false;
} 
