﻿
      
/*******************************************************************************************************************
Copyright © 2006 - 2011 XCINO Inc. All rights reserved.
http://www.xcino.com
Technical support: http://helpdesk@xcino.com
Info: info@xcino.com

Permission to use this code or any part of this code herein is not granted. You are not allowed to use or copy the code of this file, except as expressly authorized by XCINO Inc.
YOU MAY NOT
(1) Remove or modify this copyright notice.
(2) Re-distribute this code or any part of it.

YOU MAY
(1) Use this code on your website.
(2) Use this code as part of another product.

NO WARRANTY
This code is provided "as is" without warranty of any kind.
You expressly acknowledge and agree that use of this code is at your own risk.
*******************************************************************************************************************/


// JScript File
/*
*****************************************************************************
    Company   :         XCINO Inc.  
    File Name :         PNGTransparency.js   
    Purpose   :         This Class implements the javascript functionality related to Transparency problem in PNG images                           
    -----------------------------------------------------------------------
    Created By  :       Kunal mittal             Created On:     01-May-2009     

    Approved By:        Prasoon Abhinaw          Approved On:    01-May-2009   

    -----------------------------------------------------------------------
    Change History
      
    Last Updated By:Rajveer Rathore              Last Updated On:01-July-2011
                        
    Note:

    *****************************************************************************
*/




// JScript File for Transparency problem in PNG images
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   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()
         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='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
         else if (img.alt.toUpperCase().indexOf("PNG")>1)
         {
            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='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }          
      }
   }    
}
        
        function getIEVersionNumber() {
            var ua = navigator.userAgent;
            var MSIEOffset = ua.indexOf("MSIE ");
            //alert(MSIEOffset);
            if (MSIEOffset == -1) {
                return 0;
            } else {
                return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
            }
        }

        
