﻿// JavaScript Document
<!-- 
var flag=false; 
function DrawImage(ImgD,PicWidth,PicHeight){ 
 var image=new Image(); 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= PicWidth/PicHeight){ 
   if(image.width>PicWidth){
    ImgD.width=PicWidth; 
    ImgD.height=(image.height*PicWidth)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   ImgD.alt=""; 
  } 
  else{ 
   if(image.height>PicHeight){
    ImgD.height=PicHeight; 
    ImgD.width=(image.width*PicHeight)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   ImgD.alt=""; 
  } 
 }
  //window.alert("宽度："+PicWidth+"高度："+PicHeight);
  //window.alert("宽度："+ImgD.width+"高度："+ImgD.height);
}
//-->



//修正IE PNG透明
function loadPng(o){

	if(document.all){
	    try{
		    var img = o;
		    var imgName = o.src.toUpperCase();
		    if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
			    var imgID = (img.id) ? "id='" + img.id + "' " : "";
			    var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			    var imgStyle = "display:inline-block;" + img.style.cssText;
			    if (img.align == "left") 
				    imgStyle = "float:left;" + imgStyle;
			    if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle ;   
			    var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>"; 
			    img.outerHTML = strNewHTML;
		    }
	    }catch (e){}
	}
}

//
function iconHandler(){
    var obj=new Array;
    var status = $("hidLayOutTag").value;
    switch (status){
        case "1":
            var col=cleanWhitespaces($("page1"));
            for (var c=0;c<col.length;c++){
                var temp_obj=cleanWhitespaces(col[c]);
                for(var t=0;t<temp_obj.length;t++){
                    obj.push(temp_obj[t]);
                }
            }
            
        break;
        case "2":
            obj=cleanWhitespaces($("father"));
        break
    }
    //console.log(obj);
    for(var i=0;i<obj.length;i++){
 
        obj[i].onmouseover=function(){
            var _obj=this.id+"_icon";
            if ($(_obj)!=undefined)
                $(_obj).style.display="inline-block";
        };
        obj[i].onmouseout=function(){
            var _obj=this.id+"_icon";
            if ($(_obj)!=undefined)
                $(_obj).style.display="none";
        }
    }
}




var isOpera = (navigator.userAgent.indexOf('opera') != -1);
var isIE = /msie/i.test(navigator.userAgent) && !isOpera;

if (isIE) {
    var version = parseFloat(navigator.appVersion.split("MSIE")[1]);
      if(version == 6){
        document.execCommand('BackgroundImageCache', false, true);
      }
}