/*------------------------------------------------------------------------------*/
if (!window.getComputedStyle) {
    window.getComputedStyle = function(el, pseudo) {
        this.el = el;
        this.getPropertyValue = function(prop) {
            var re = /(\-([a-z]){1})/g;
            if (prop == 'float') prop = 'styleFloat';
            if (re.test(prop)) {
                prop = prop.replace(re, function () {
                    return arguments[2].toUpperCase();
                });
            }
            return el.currentStyle[prop] ? el.currentStyle[prop] : null;
        }
        return this;
    }
}
function ScreenSize() {
      var w, h; // Объявляем переменные, w - длина, h - высота
      w = (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
      h = (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
      return {w:w, h:h};
}

function fixPNG(element, method)
{
  if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
  {
    var src;
    
    if (element.tagName=='IMG')
    {
      if (/\.png$/.test(element.src))
      {
        src = element.src;
        element.src = path+"/images/blank.gif";
      }
    }
    else
    {
      src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
      if (src)
      {
        src = src[1];
        element.runtimeStyle.backgroundImage="none";
      }
    }
    if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='" + method + "')";
  }
}
function openw(res,title) {
   preview(res,title);
   return false;
   rand=Math.random().toString().substring(2,15);
   window.open(path + "/lib/show_pic.php?src="+res+"&title="+title, 'new_'+rand, "top=50, left=50, width=50, height=50, channelmode=no, toolbar=no, location=no, status=no, directories=no, menubar=no, resizable=yes, scrollbars=yes");
   return false;
}


function rand( min, max ) {    // Generate a random integer
    // 
    // +   original by: Leslie Hoare
 
    if( max ) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    } else {
        return Math.floor(Math.random() * (min + 1));
    }
}
/*=============================================================*/
function addHandler(object, event, handler)
{
  if (typeof object.addEventListener != 'undefined')
    object.addEventListener(event, handler, false);
  else if (typeof object.attachEvent != 'undefined')
    object.attachEvent('on' + event, handler);
  else
    throw "Incompatible browser";
}

function removeHandler(object, event, handler)
{
  if (typeof object.removeEventListener != 'undefined')
    object.removeEventListener(event, handler, false);
  else if (typeof object.detachEvent != 'undefined')
    object.detachEvent('on' + event, handler);
  else
    throw "Incompatible browser";
}
/*=============================================================*/
$(document).ready(function(){
	/******************************************************************/
	$('h1').toggle();
    $('h1').flash(
        {
            src: path + '/images/jfr.swf', 
            flashvars: { 
                css: [
                    '* { color: #ab9d4e; }',
                    'a { color: #ab9d4e; text-decoration: none; }',
                    'a:hover { text-decoration: underline; }'
                ].join(' ')
            }
        },
        { version: 7 },
        function(htmlOptions) {
            htmlOptions.flashvars.txt = this.innerHTML;
            this.innerHTML = '<div>'+this.innerHTML+'</div>';
            var $alt = $(this.firstChild);
            htmlOptions.height = $alt.height();
            //htmlOptions.width = $alt.width();
            htmlOptions.width = '100%';
            $alt.addClass('alt');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));
            $(this).find('.alt').remove().empty();
        }
    );
	/******************************************************************/
    /*$('#_h1').sifr({
    	color: '#f00'
    });*/
	/******************************************************************/
    if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
    {
    	lmi = $('.lmenu_item a.on');
    	lmi.css('background','url('+path+'/images/lmenu_marker_bg.png) 0 0 no-repeat');
    	DD_belatedPNG.fixPng( lmi[0] );
    	
	    $('.lmenu_item a:not(".on")').hover(
	    	function(){
	    		$(this).css('background','url('+path+'/images/lmenu_marker_bg.png) 0 0 no-repeat');
	    		DD_belatedPNG.fixPng(this);
	    	},
	    	function(){
	    		$(this).css('background','url('+path+'/images/lmenu_marker_bg_blank.png) 0 0 no-repeat');
	    		DD_belatedPNG.fixPng(this);
	    	}
	    );
    }
    /******************************************************************/
});

