﻿// THIS FUNCTION RETURNS THE INTERNET EXPLORER VERSION
// OR -1 IF IT IS ANOTHER BROWSER

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

// daca ieVersion == 6, rezulta ie6, 
// daca ieVersion == 7, rezulta ie7,
// ... 

var internetExplorer = getInternetExplorerVersion();

// this function only works for Internet Explorer 6 and lower versions
// and fixes the alpha of all png images on the document 

function ie6Png()
{	
	if ( internetExplorer != -1 && internetExplorer < 7 )
	{
		var images = $('img');
	
		for ( i=0; i < images.length; i++ )
		{
			var img = images[i];
			
		 	if( img.src.search('.png') )
			{	
				with(img)
				{
					style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "')";
					src = 'images/_GLOBAL/pixel.gif';
				}
			}	
			
		} // for
		
	} // if
				
} // ie6Png

// when the document is ready

$( function() { ie6Png() } );
