var IE = !window.getComputedStyle && !!document.getElementById;
var IE6 = IE && navigator.appVersion.indexOf('MSIE 6') != -1;
var _ext = IE6 ? 'gif' : 'png';

$(document).ready(function() { 
    $("#contentTochno").jScrollPane({showArrows : true});
    $("#bigKnopka").hover(function(){$("#btnNormal").css("display", "none"); $("#btnActive").css("display", "block"); $('#textGl').animate({opacity:1}, 1500);},
    function(){$("#btnActive").css("display", "none"); $("#btnNormal").css("display", "block");$('#textGl').animate({opacity:0}, 1500);});
						  
    
    $('.cc_header img').hover(function(){$(this).attr('src', "/design/images/logo.jpg");},
    function(){$(this).attr('src', IE6 ? "/design/images/logo_passiv.gif" : "/design/images/logo_passiv.png"); });
    $('.leftMenuLink a').hover(function(){ 
	    var img = $('img', this)[0];
	    var ext = img.src.substr(img.src.lastIndexOf('.') + 1);
	    img.src = img.src.replace('_passiv.' + ext, '.' + ext);
    }, function(){
	    var img = $('img', this)[0];
	    var ext = img.src.substr(img.src.lastIndexOf('.') + 1);
	    img.src = img.src.replace('.' + ext, '_passiv.' + ext);
    });   
    $('.uslugiInner').appendTo('.apend');

    $('#pochta').hover(function(){
		$(this).attr('src', "/design/images/pochta_orang." + _ext)},
        function(){$(this).attr('src', "/design/images/pochta_siniy." + _ext);});
    $('#telephon').hover(function(){
		$(this).attr('src', "/design/images/telephon_orang." + _ext )},
        function(){$(this).attr('src', "/design/images/telephon_siniy." + _ext);});

		if(IE6){
			$('img.png').each(function(){
				$(this).attr('src', $(this).attr('src').replace(/\.png$/, '.gif'));
			});
			$('#pochta, #telephon').each(function(){
				$(this).attr('src', $(this).attr('src').replace(/\.png$/, '.gif'));
			});
			$('#mcvl, #mcvr').css('position', 'relative');
			$('#mcvl').css('margin-left', 0).css('left', -2);
			$('#content').css('height', 550);
			$('#mainContent').css('width', $('#mainContent').width())
				.css('position', 'absolute')
				.css('left', 0)
				.css('top', 100);
		}
		if(IE6 || window.opera){
			var minus = window.opera ? 0 : 3;
			var left = 0;
			var len = $('#uslugi .uslugi').length;
			$('#uslugi .uslugi').each(function(index){
				$(this).css('position', 'absolute').css('left', left);
				if(index == len - 1){
					$(this).css('width', $(this).parent().width() - left - minus);
				}
				left += this.offsetWidth;				
			});
			left = 0;
			len = $('#portfolio').children().length;
			$('#portfolio').children().each(function(index){
				$(this).css('width', $(this).width());
				$(this).css('position', 'absolute').css('left', left);
				if(index == len - 1){
					$(this).css('width', $(this).parent().width() - left - minus);
				}
				left += this.offsetWidth;				
			});		
		}
		correctBtns();
		
		$('.fotoButton').click(function(){
			var num = $(this).children('p').html();
			var src = $('#'+num).children('img').attr('src');
			$('#bigFoto').attr( 'src' , src);
			newSrs = src.replace('content/files/catalog1/','');
			$('a[rel]').attr('href', 'content/files/catalog1/source/'+newSrs);

										});
		
		
 });
 function resizeBoxJSPane() {
    var ww = $(".cc_cc").width();
    if (IE6) {
        ww = ww - 15;
    }
    $(".jScrollPaneContainer").css("width", ww+"px");
    $("#contentTochno").css("width", (ww-15)+"px");
    correctBtns();
 }
 function correctBtns() {
     var cc = $(".cc_box").width() + 220 - 30;
    $(".jScrollArrowUp").css("left", cc+"px");
    $(".jScrollArrowDown").css("left", cc+"px");
	$(".dot").css("left", cc+"px"); 
 }