/**
  * PNG class
  *
  * this class applies the Microsoft Filter to the png's of your choice
  * This class is written especially for png support in IE < v7
  *
  * @Author:  Jochen Vandendriessche
  * @Version: 0.1
  * @Date:    2006-12-08 13:14:22
  * @Contact: info@joggink.be
  * @Website: http://joggink.be
  *
  **/

	// Checking if the visitor is using MSIE < 7
	var isExp = (navigator.userAgent.indexOf("MSIE") != -1 &&
	navigator.userAgent.indexOf("Opera") == -1);

	var isnotIE7 = false;
	// if so, let's check if he's not using 7, 'cause 7 has png support (it's about time)
	if(isExp)
	{
		var version = navigator.userAgent.split("MSIE ")[1];
		version = version.split(";")[0];
		version = parseInt(version);
		isnotIE7 = (version < 7);
	}

  // constructor, always come in handy when you're using Classes :) :)
  function joinkPNG(htmlDiv, png){
     // let's check if the user is using IE < 7, if not,  do nothing sowe won't use any CPU
     if (isExp && isnotIE7){
        // if so, let's see if the div exists...
        if (document.getElementById(htmlDiv)){
           this.div = document.getElementById(htmlDiv);
			  this.png = png;
			  this.makeTransparent();
        }
	  }
  }

   // the magic function that makes png's transparent in MSIE
  joinkPNG.prototype = {
     makeTransparent: function(){
        // ok, I don't approve it but hey, if you want transparent png's I have to apply these uggly M$ filters...
			this.div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src = '" + this.png + "', sizingMethod = 'scale')";
			this.div.style.backgroundImage = "url('pixel.gif')";
		         //window.alert('gelukt!');
     }
  }