var css_browser_selector=function(){var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t)!=-1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera\s(\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('chrome')?'chrome webkit safari':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js';h.className+=h.className?' '+c:c;}();
var isIE_lt_7 = false;
var isIE = false;
var nu = navigator.userAgent;
if(nu.indexOf("MSIE") != -1) {
  isIE = true;
  if(nu.match(/MSIE (\d)/i)[1] < 7) {
    isIE_lt_7 = true;
  }
}

function d(s) {document.title=s;return false;}

jQuery(function() {
  jQuery('.blank').attr('target', '_blank');
  
  if(typeof jQuery.fn.modx_highLight == 'function') {
    if(jQuery('#forHighLight').size()  > 0) {
      jQuery('#forHighLight').modx_highLight();
    }
  }

  cssRules();
  if(jQuery('div.content').size() > 0) {
  	jQuery('#content').height(jQuery('.content').height() + parseInt(jQuery('.content').css('padding-top')) + jQuery('#adv').height());
  }

  if(isIE_lt_7) {
  	jQuery('img, div, input, li').css('behavior', 'url(/assets/templates/site/img/iepngfix.htc)');
  	jQuery('#navigation li:not(.current)').hover(function() {
  	  jQuery(this).addClass('active');
  	}, function() {
  	  jQuery(this).removeClass('active');
  	});
  }
  
  jQuery('#navigation li').click(function() {
    if(jQuery('a', this).attr('rel') != 'ajax') {
  	  window.location.href = jQuery('a', this).attr('href');
  	} else {  	 OnAjaxHandler(jQuery('a', this));  	}
  	return false;
  });

  if(jQuery('#personal').size() > 0) {
    var c = jQuery(window).height() - jQuery('#content').height()-180;
    c = (c > 0) ? c : 0;
    var c1 = jQuery('#content').height();
    jQuery('#content').height(c+c1);
  } else if(jQuery('#portfolio').size() > 0) {  	jQuery('#portfolio .content table td:first-child').addClass('first');  	jQuery('#portfolio .content table td:last-child').addClass('last');  }
  
  jQuery('#contentText').height(Math.max(jQuery('.rightColumn').height(),jQuery('.content').height()));
  

  
///////////////////////////////////////////////////////////////////////////
// Start Ajax                                                            //
///////////////////////////////////////////////////////////////////////////

  var htmlAjaxBlock =
  	'<div id="ajax_bg"></div>'+
    '<div id="ajax_block">'+
      '<table border="0" width="100%">'+
        '<tr><td align="right"><a class="closeAjaxWindow" href="javascript:void(0)"><img alt="Закрыть" title="Закрыть" src="/assets/templates/site/img/x.jpg" width="36" height="30" /></a></td></tr>'+
        '<tr><td style="padding: 10px;"><div id="ajax_content"><img class="loading" alt="" src="/assets/templates/site/img/lightbox/loading.gif" width="32" height="32" /></div></td></tr>'+
      '</table></div>';
  jQuery('body').append(jQuery(htmlAjaxBlock));
  jQuery('#ajax_bg').height(jQuery(document).height());
  jQuery('#ajax_bg, #ajax_block').css('opacity', '0');
  jQuery('a[rel=ajax]').click(function() {
    OnAjaxHandler(jQuery(this));
  	return false;  });

  jQuery('a.closeAjaxWindow').click(function() {    jQuery('#ajax_block').animate({'opacity':0}, 600, function() {
  	  jQuery('#ajax_bg').animate({'opacity':0}, 600, function() {  	  	jQuery('#ajax_bg, #ajax_block').css('visibility', 'hidden');  	  });
  	});  });
///////////////////////////////////////////////////////////////////////////
// End Ajax                                                              //
///////////////////////////////////////////////////////////////////////////
});

jQuery(window).resize(function() {
  cssRules();
});

function cssRules() {
  //если окно меньше, чем 1109, то
  if(jQuery(document).width() < 1109) {
  	if(isIE) jQuery('.pageWidth').css('overflow', 'hidden');
    //убираем изображение из правого нижнего угла
    jQuery('.pageInner').removeClass('image');
  } else {
  	if(isIE) jQuery('.pageWidth').css('overflow', 'visible');
    //в противном случае показываем его
    jQuery('.pageInner').addClass('image');
  }
  return false;
}

function _(s) { document.title = s; }


function OnAjaxHandler(obj) {
  	window.scrollTo(0,0);
  	jQuery('#ajax_bg, #ajax_block').css('visibility', 'visible');

  	jQuery('#ajax_bg').animate({'opacity': 0.9}, 600, function() {
  	  jQuery('#ajax_block').animate({'opacity': 0.9}, 600);
  	});
  	jQuery('#ajax_content').load(obj.attr('href'));
  	return false;
}


jQuery(function() {
  // Карта гугл	var map = '<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.ru/maps?f=q&amp;source=s_q&amp;hl=ru&amp;geocode=&amp;q=%D0%BC%D0%BE%D1%81%D0%BA%D0%B2%D0%B0+%D1%83%D0%BB.+%D0%94%D0%BD%D0%B5%D0%BF%D1%80%D0%BE%D0%BF%D0%B5%D1%82%D1%80%D0%BE%D0%B2%D1%81%D0%BA%D0%B0%D1%8F,+%D0%B4.2&amp;sll=55.354135,40.297852&amp;sspn=21.667754,56.513672&amp;ie=UTF8&amp;hq=&amp;hnear=%D0%90%D0%9E+%D0%AE%D0%B6%D0%BD%D1%8B%D0%B9,+%D0%B3%D0%BE%D1%80%D0%BE%D0%B4+%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0,+%D0%94%D0%BD%D0%B5%D0%BF%D1%80%D0%BE%D0%BF%D0%B5%D1%82%D1%80%D0%BE%D0%B2%D1%81%D0%BA%D0%B0%D1%8F+%D1%83%D0%BB.,+2&amp;ll=55.629789,37.608004&amp;spn=0.002611,0.006899&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a target="_blank" href="http://maps.google.ru/maps?f=q&amp;source=embed&amp;hl=ru&amp;geocode=&amp;q=%D0%BC%D0%BE%D1%81%D0%BA%D0%B2%D0%B0+%D1%83%D0%BB.+%D0%94%D0%BD%D0%B5%D0%BF%D1%80%D0%BE%D0%BF%D0%B5%D1%82%D1%80%D0%BE%D0%B2%D1%81%D0%BA%D0%B0%D1%8F,+%D0%B4.2&amp;sll=55.354135,40.297852&amp;sspn=21.667754,56.513672&amp;ie=UTF8&amp;hq=&amp;hnear=%D0%90%D0%9E+%D0%AE%D0%B6%D0%BD%D1%8B%D0%B9,+%D0%B3%D0%BE%D1%80%D0%BE%D0%B4+%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0,+%D0%94%D0%BD%D0%B5%D0%BF%D1%80%D0%BE%D0%BF%D0%B5%D1%82%D1%80%D0%BE%D0%B2%D1%81%D0%BA%D0%B0%D1%8F+%D1%83%D0%BB.,+2&amp;ll=55.629789,37.608004&amp;spn=0.002611,0.006899&amp;z=14&amp;iwloc=A">Просмотреть увеличенную карту</a></small>';
	if(jQuery('.googleMap').size() > 0) {		jQuery('.googleMap').html(jQuery(map));	}
	//alert(j﻿Query('a.comment').size());
  //Комментарии в блоге	
	//j﻿Query('a.comment').click(function(){
      //j﻿Query(this).html('Скрыть форму ответа &uarr;');
      //id = j﻿Query(this).attr('id');  
      //j﻿Query('#form'+id).show();
  //    return false;
  //});});
/*
/*,
    function (){
      //id = j﻿Query(this).attr('id');
      //j﻿Query('#form'+id).hide();      
      //j﻿Query(this).html('Ответить &darr;');	
      return false;
    }*/
