// PNG IE6 Fix (#include suilib_lite.js)
// Created in Shogo.Ru
var msie6 = !!(suilib.client.msie && navigator.appVersion && !navigator.appVersion.match(/MSIE 7/));
function fixBgPNG(el,param) {
  var tmp = el.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
  if(tmp && msie6) {
    tmp = tmp[1];
    if(!param) param = 'scale';
    el.runtimeStyle.backgroundImage = 'none';
    el.runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + tmp + '",sizingMethod="' + param + '")';
    $(el).filter('a',null,null,true).walkwith(function(lnk) {
      lnk.style.position = 'relative'; });
  }
}

var gbi = function(el) { !!document.getElementById(el); }
/*suilib.ready(function() {
  if(msie6) {
    $(suilib.body).filter('img',null,null,true).walkwith(function(el) {
      var tmp = el.getAttribute('src');
      if(tmp.search && tmp.search(/\.png$/i)>=0) {
        el.src = 'i/sp.gif';
        el.runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + tmp + '",sizingMethod="crop")'; }
    });
  }
});*/

//-----------------------------------------------------------------------------
// objTools
//-----------------------------------------------------------------------------
var objTools = {
  print: function(hash) {
    if(!hash || typeof(hash)!=='object') return null;
    return 'var data = ' + this.parse(hash) + ';';
  },
  $specialChars: {
    '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'
  },
  $replaceChars: function(chr) {
    return this.$specialChars[chr] || '\\u00' + Math.floor(chr.charCodeAt() / 16).toString(16) + (chr.charCodeAt() % 16).toString(16);
  },
  parse: function(hash) {
    switch(typeof(hash)) {
      case 'string':
        return "'" + hash.replace(/[\x00-\x1f\\"]/g, this.$replaceChars) + "'";
      case 'number':
        return isFinite(hash) ? String(hash) : 'null';
      case 'object':
        var string = [];
        if(hash.length) {
          for(var i=0,l=hash.length; i<l; i++) {
            if(typeof hash[i]=='undefined') continue;
            string.push(this.parse(hash[i]));
          }
          return '[' + String(string) + ']';
          break;
        }
        for(var i in hash) {
          var json = this.parse(hash[i]);
          if(json) string.push(this.parse(i) + ':' + json);
        }
        return '{' + string + '}';
      default: return String(hash);
    }
    return null;
  }
}
//-----------------------------------------------------------------------------