﻿/*firefox*/ 
function __firefox(){ 
HTMLElement.prototype.__defineGetter__("runtimeStyle", __element_style); 
window.constructor.prototype.__defineGetter__("event", __window_event); 
Event.prototype.__defineGetter__("srcElement", __event_srcElement); 
} 
function __element_style(){ 
return this.style; 
} 
function __window_event(){ 
return __window_event_constructor(); 
} 
function __event_srcElement(){ 
return this.target; 
} 
function __window_event_constructor(){ 
if(document.all){ 
return window.event; 
} 
var _caller = __window_event_constructor.caller; 
while(_caller!=null){ 
var _argument = _caller.arguments[0]; 
if(_argument){ 
var _temp = _argument.constructor; 
if(_temp.toString().indexOf("Event")!=-1){ 
return _argument; 
} 
} 
_caller = _caller.caller; 
} 
return null; 
} 
if(window.addEventListener){ 
__firefox(); 
} 
/*end firefox*/

//在鼠标显示一个层，该层的内容为div2的内容
function showTip(flag) {
    $("#ifrShowHere").css("position", "absolute");
    $("#ifrShowHere").css("display", "block");
    $("#ifrShowHere").css("left", $(flag).offset().left + 40);
    $("#ifrShowHere").css("top", $(flag).offset().top - 250);
    $("#ShowHere").css("position", "absolute");
    $("#ShowHere").css("display", "block");
    $("#ShowHere").css("left", $(flag).offset().left + 30);
    $("#ShowHere").css("top", $(flag).offset().top - 250);
    $("#ShowHere").css("zIndex", "100");

}
//关闭层div3的显示 
function closeTip(flag) {
    $("#ifrShowHere").css("display", "none");
    $("#ShowHere").css("display", "none");
}

//控制层div2显示的开关 
function switchDIV() {
    if (div2.style.display == 'block') {
        div2.style.display = 'none';
    }
    else {
        div2.style.display = 'block';
    }
} 

var flag=false; 
function DrawImage(ImgD,width,height){ 

    var image=new Image(); 
    image.src=ImgD.src; 
    if(image.width>0 && image.height>0){ 
     flag=true; 
     if(image.width/image.height>= width/height){ 
     
      if(image.width>width){   
      ImgD.width=width; 
      ImgD.height=(image.height*width)/image.width; 
      }else{ 
      ImgD.width=image.width;   
      ImgD.height=image.height; 
      } 
      } 
     else{ 
      if(image.height>height){   
      ImgD.height=height; 
      ImgD.width=(image.width*height)/image.height;      
      }else{ 
      ImgD.width=image.width;   
      ImgD.height=image.height; 
      
      } 
      } 
      }
     }