/**
 * js - ican - hack.js
 * 
 * 各ブラウザのバグをハックする。
 */
/********************
  IE
********************/
    /**
     * hover時に背景画像を再読込してしまう件を修正。
     */
    try {
        document.execCommand('BackgroundImageCache', false, true);
    }
    catch(e){
    }
    
    
/********************
  FireFox
********************/
    /**
     * removeNodeのサポート
     */
    if(!navigator.appName.match(/Explorer/) && HTMLElement.prototype.removeNode == undefined){
        HTMLElement.prototype.removeNode = function(with_child)
        {
            if(with_child){
                for(var i = 0; i < this.childNodes.length; i++){
                    var ele = this.childNodes.item(i);
                    ele.removeNode(with_child);
                }
            }
            this.parentNode.removeChild(this);
        };
    }
    /**
     * word-break対応
     */
    if(window.opera || navigator.userAgent.indexOf('Firefox') != -1){
        new function(){
            var wordBreak = function(){
                var recursive = function(ele){
                    for(var i = 0; i < ele.childNodes.length; i++){
                        var child = ele.childNodes.item(i);
                        if(child.nodeType == 1){
                            recursive(child);
                        } else if(child.nodeType == 3){
                            if(child.nodeValue.match("[^\s]")){
                                //var node_values = child.nodeValue.replace(/[ ]+/, ' ').split('');
                                var node_values = child.nodeValue.split('');
                                node_values = node_values.join(String.fromCharCode(8203));
                                //node_values = node_values.join('<wbr />');
                                child.parentNode.replaceChild(document.createTextNode(node_values), child);
                            }
                        }
                    }
                }
                document.getElementsByClassName('wickey').each(recursive);
                //$A(document.getElementsByTagName('TD')).each(recursive);
                //recursive(document.getElementById('ican'));
            }
            YAHOO.util.Event.addListener(window, 'load', wordBreak);
        }
    }
