/*
* hoverFlow - A Solution to Animation Queue Buildup in jQuery
* Version 1.00
*
* Copyright (c) 2009 Ralf Stoltze, http://www.2meter3.de/code/hoverFlow/
* Dual-licensed under the MIT and GPL licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($){$.fn.hoverFlow=function(c,d,e,f,g){if($.inArray(c,['mouseover','mouseenter','mouseout','mouseleave'])==-1){return this}var h=typeof e==='object'?e:{complete:g||!g&&f||$.isFunction(e)&&e,duration:e,easing:g&&f||f&&!$.isFunction(f)&&f};h.queue=false;var i=h.complete;h.complete=function(){$(this).dequeue();if($.isFunction(i)){i.call(this)}};return this.each(function(){var b=$(this);if(c=='mouseover'||c=='mouseenter'){b.data('jQuery.hoverFlow',true)}else{b.removeData('jQuery.hoverFlow')}b.queue(function(){var a=(c=='mouseover'||c=='mouseenter')?b.data('jQuery.hoverFlow')!==undefined:b.data('jQuery.hoverFlow')===undefined;if(a){b.animate(d,h)}else{b.queue([])}})})}})(jQuery);

// 
$(function (){ 
    leftMenu();
    resizer();

    $(window).resize(function(){
        resizer();
        resizer2();     
      });


// Левое меню   
function leftMenu(){  

    if($.browser.msie && $.browser.version < 9) return false;
    $('menu li').hover(function(e) {
					$(this).hoverFlow(e.type, { marginLeft: 15 }, 'fast');
				}, function(e) {
					$(this).hoverFlow(e.type, { marginLeft: 0 }, 'fast');
				});
}

// Руселлер-Бокс
// 
function rusellerBox(action, settings){
    if(action == 'open'){
        $('#rusellerOverlay').show();
        if(settings) cssRusellerBox(settings);
 
        $('#rusellerBox').fadeIn(500);
    }
    else{
        $('#rusellerOverlay, #rusellerBox').hide();
       // $('#rusellerBox').css({'width';'700px', 'height':'400', 'margin-left':'-200px', 'margin-top':'-350px'}).children('#rusellerBoxContent').height(320); // сборос параметров
        cssRusellerBox({'width':'700px', 'height':'400px'});
        $('.removed').remove();
        $('#rusellerBoxContent').removeAttr('class').text('');
        $('.removed').remove(); 
    }
}

function cssRusellerBox(settings){
            for (var s in settings){
                    $('#rusellerBox').css(s, settings[s]);
                    switch (s){ 
                            	case 'width':
                                            var mLeft = settings[s].replace(/\D+/g, '');
                                            mLeft = -1*mLeft/2;
                                            $('#rusellerBox').css('margin-left', mLeft);  
                            	break;
                            
                            	case 'height':
                                            var mTop = settings[s].replace(/\D+/g, '');
                                            var innerBox = mTop - 80;    
                                                mLTop = -1*mTop/2;
                                            //$('#rusellerBox').css('margin-top', mTop);
                                            $('#rusellerBoxContent').height(innerBox);  
                            	break;

                            
                            }
                }    
}


footerBack();
function footerBack(){
    var leftH = $('#sideLeft').height();
    var contentH = $('#content').height();
  
    if(contentH > leftH) {
        var h = contentH - leftH;
        if(h>399) h = 399; 
    $('#footer_wrap').height(h).css('margin-top',(-h+300));
  
    }
    return false;
}

});

function strip_tags( str ){	// Strip HTML and PHP tags from a string
	return str.replace(/<\/?[^>]+>/gi, '');
}

function htmlspecialchars(html) { 
      // Сначала необходимо заменить & 
      html = html.replace(/&/g, "&amp;"); 
      // А затем всё остальное в любой последовательности 
      html = html.replace(/</g, "&lt;"); 
      html = html.replace(/>/g, "&gt;"); 
      html = html.replace(/"/g, "&quot;"); 
      // Возвращаем полученное значение 
      return html; 
}
