﻿$(function(){
    $('div.flash').each(function(){
        var style = this.currentStyle;
        if( style == null) style = this.style;
        //
        //alert( document.defaultView.getComputedStyle(this,null)["background-image"]);
        if( style.backgroundImage.toLowerCase().indexOf(".swf") >=0)
        {
            var url = this.currentStyle.backgroundImage.replace( 'url','').replace( '(','').replace( ')','').replace( '"','').replace( '"','').replace( "'","").replace( "'","");
            if(document.parentWindow.parent != null &&  document.parentWindow.parent.iframeLoad != null  )
            {
                $(this).css( "background-color","#d0d0d0");
                $(this).empty().append( $(this).width() + "×" + $(this).height() + "<br/>");
                $(this).append('<a href="#" onclick="' + "$(this.parentElement).empty().flash( { src: '" + url + "',width: " + $(this).width() + ",height: " + $(this).height() + " },{ version: 8 });" + '">显示Flash</a><br/>');
            }
            else
            {
                $(this).empty().flash( { src: url,width:  $(this).width(),height:  $(this).height() },{ version: 8 });
            }
        }
    });
 });

function getStyle(elem, property)
{  
  
        if (property=='class') property='className';    
        else property=this.camelize(property);    
        if (elem.currentStyle)// IE5+    
            return elem.currentStyle[property];  
  
        if(elem.style[property])    
            return elem.style[property];  
  
        if (document.defaultView.getComputedStyle)// FF/Mozilla    
            var currentStyle = document.defaultView.getComputedStyle(elem, null);  
  
        else if (window.getComputedStyle)// NS6+    
            var currentStyle = window.getComputedStyle(elem, null);  
  
        return currentStyle[property] || currentStyle.getPropertyValue(this.uncamelize(property));  
  
}  
