﻿function imgResize()
{


var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);

if ((version >= 5.5) && (document.body.filters)) 
{
	
	
   for(var i=0; i<document.images.length; i++)
   {
	   
	   
      var img = document.images[i];
	  var imgName = img.src.toUpperCase();
	  var tempwidth;
	  var tempheight;
	 
	 // 
	//alert(imgName+" "+imgName.substring(imgName.length-3, imgName.length));
	//imgName.substring(imgName.length-3, imgName.length) == "PNG"
    
	 if (imgName.search (/.PNG.+/) != -1 || imgName.search (/.png.+/) != -1 || imgName.search (/.PNG/) != -1 || imgName.search (/.png/) != -1 )
      {
			// alert(imgName   + "                 '"   + imgName.substring(imgName.length-3, imgName.length) +"'" +   "  " + (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 ;
       
		 
         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='scale');\"></span>"; 
         	img.outerHTML = strNewHTML;
		
          i = i-1;
		 //alert("aufgerufen!");
      }
   }
}
}


  //if (img.align == "left") imgStyle = "float:left;" + imgStyle;
         //if (img.align == "right") imgStyle = "float:right;" + imgStyle;
         //if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
		 
		 /*
		  if (img.name == "prod") {
			resizeImage (img,175);
			//alert("Funktion prod aufgerufen!")
		 }
		 else if (img.name == "rezueber")
		 {
			resizeImage (img,100);
			//alert("Funktion rezueber aufgerufen!")
		 }
		 else{
		 //alert ("else ");
			tempwidth = img.width;
			tempheight = img.height;
		 } */
/*
function resizeImage(img, maxWidth) {
	 //trace ("  xxx script.as => resizeImages");
	 //var aspect_ratio = img.width/img.height;
	 //trace("aspect_ratio: "+aspect_ratio);
	 
	 var factor;
	// alert (img.width + "   >  " + maxWidth );
	 if(img.width > maxWidth) {
		  // querformat
		  
		factor = maxWidth/img.width;
		tempwidth = maxWidth;
		tempheight = img.height * factor;
		  
		  //alert ("tempwidth" + tempwidth + "    tempheight" +  tempheight );
		  //alert(tempheight);
	 } else {
	 alert ("else 2");
		  tempheight = img.height;
		  tempwidth = img.width;
	 }
}*/