﻿function coording(){
//	ww = $(document).width();
	ww = $('#sizer').width();
	w = Math.round( ww * 0.25 );
	if(w < 320) w = 320;
	l = ww-w;
	$('.tels').width(w);
	$('.tels').css({'left':l+'px'});

}


function showVideo(src){
jQuery('#frame').attr("src",src);
cont=jQuery('#container').get(0);
cont.style.top=document.body.scrollTop+200;
cont.style.left=document.body.clientWidth/2-320;
back=jQuery('#back_roll').get(0);
back.style.width=document.body.scrollWidth;
back.style.height=document.body.scrollHeight;
back.style.left=0;
back.style.top=0;
back.style.display='block';
cont.style.display='block';

}
function hideVideo(){
jQuery('#frame').attr("src","");
back=jQuery('#back_roll').get(0);
cont=jQuery('#container').get(0);
back.style.display='none';
cont.style.display='none';
}

function subscribe(){
    email=$('#sbemail').val();
    if(echeck(email)) SmartyAjax.call('/index.php', 'post', 'email='+email+'&f=dosubscribe', sbanswer, undefined);
    else {
		$('#sbanswer').html('<b>ВЫ НЕ ВВЕЛИ АДРЕС E-MAIL <br /> ИЛИ ВВЕЛИ ЕГО НЕВЕРНО!</b>');
		$("#delivery_answer").animate({opacity:100});
		$('#delivery_form').hide();
		$('#delivery_answer').show();
	  setTimeout(function(){
			$("#delivery_answer").animate({opacity:0,speed:500})
		}, 3000);
      setTimeout(function(){
      	$("#delivery_answer").hide();
		$('#delivery_form').show();
      	}
      , 3500);
	}
    return false;
}
          
function sbanswer(originalRequest){
answer=originalRequest.responseText;
 $('#sbanswer').html(answer);
 $("#delivery_answer").animate({opacity:100});
 $('#delivery_form').hide();
 $('#delivery_answer').show();
 
      setTimeout(function(){
			$("#delivery_answer").animate({opacity:0,speed:500})
		}, 3000);
      setTimeout(function(){
      	$("#delivery_answer").hide();
		$('#delivery_form').show();
      	}
      , 3500);
}

var monthes=new Array();

$(document).ready(function(){

	if($.browser.safari)
	{
		//$('.meropr').css({'top':'-150px'});
		$('.pop').css({'margin-top':'3px'});
	}
$("#filterYear").change(function(){
	$("#filterMonth option").attr("disabled","disabled");
	$("#filterMonth option").attr("selected",false);
	year=$("#filterYear option:selected").val();
	t=true;
	for(i=1;i<=12;i++){
		if(monthes[year][i]!=undefined){
			opt=$("#filterMonth option").get(i-1);
			opt.disabled=false;
			if(t) opt.selected=true;
			t=false;
		}
	}
});
$('#pr_select').change(function(){
	var VRegExp = new RegExp(/\/([a-z]{2})\//i);
    var VResult = VRegExp.exec(document.location.href); 
	if(VResult==null) lang='ru';
	else lang=VResult[1];
	if($("#pr_select option:selected").val()!=undefined) document.location="/project/"+lang+"/grpID"+$("#pr_select option:selected").val()+"/";
});
	
	//$('body').pngFix( );
	
	$('img').hover(
		function()
		{
			if( (!$(this).hasClass('act')) && ($(this).attr('hover')) )
			{
				tmp = $(this).attr('src');
				$(this).attr('src', $(this).attr('hover'));
			}
		},
		function()
		{
			if( (!$(this).hasClass('act')) && ($(this).attr('hover')) )
				$(this).attr('src', tmp);
		}
	);
	
	$('input:image').hover(
		function()
		{
			if($(this).attr('hover'))
			{
				tmp = $(this).attr('src');
				$(this).attr('src', $(this).attr('hover'));
			}
		},
		function()
		{
			if($(this).attr('hover'))
				$(this).attr('src', tmp);
		}
	);
	
	$('.article a, .partner_name a').hover(
		function()
		{
			img=$(this).parent().prev().find('img');
			if($(img).attr('hover'))
			{
				tmp = $(img).attr('src');
				$(img).attr('src', $(img).attr('hover'));
			}
		},
		function()
		{
			img=$(this).parent().prev().find('img');
			if($(img).attr('hover'))
				$(img).attr('src', tmp);
		}
	);
	
	$('.partners a').hover(
		function()
		{
			img=$(this).parent().prev().find('img');
			if($(img).attr('hover'))
			{
				tmp = $(img).attr('src');
				$(img).attr('src', $(img).attr('hover'));
			}
		},
		function()
		{
			img=$(this).parent().prev().find('img');
			if($(img).attr('hover'))
				$(img).attr('src', tmp);
		}
	);
	
	
	$('a.more3').hover(
		function()
		{
			img=$(this).prev().prev().prev().find('img');
			if($(img).attr('hover'))
			{
				tmp = $(img).attr('src');
				$(img).attr('src', $(img).attr('hover'));
			}
		},
		function()
		{
			img=$(this).prev().prev().prev().find('img');
			if($(img).attr('hover'))
				$(img).attr('src', tmp);
		}
	);
	

	$('.b_close a').click(function()
	{
		$(this).parent().parent().parent().parent().parent().hide();
		$('.l').removeClass('popedl');
		$('.r').removeClass('popedr');
		return false;
	});

	$('.more a, .b_ing img, .b_edu img').click(function()
	{		
		$('.pop_text').hide();

		$('#txt_group_bazis').show();
		$('.l').addClass('popedl');
		$('.r').addClass('popedr');
		return false;
	});


/*	$('.more a, .b_ing img, .b_edu img').click(function()
	{
		$('#txt_1').show();
		$('.l').addClass('poped');
		$('.r').addClass('poped');
		return false;
	});*/

	$('.bp1 img').click(function()
	{
		$('#txt_1').show();
		$('.l').addClass('popedl');
		$('.r').addClass('popedr');
		return false;
	});
	$('.bp2 img').click(function()
	{
		$('#txt_2').show();
		$('.l').addClass('popedl');
		$('.r').addClass('popedr');
		return false;
	});
	$('.bp3 img').click(function()
	{
		$('#txt_3').show();
		$('.l').addClass('popedl');
		$('.r').addClass('popedr');
		return false;
	});
	$('.bp4 img').click(function()
	{
		$('#txt_4').show();
		$('.l').addClass('popedl');
		$('.r').addClass('popedr');
		return false;
	});


	$('.menu td a img').hover(
		function()
		{
			$('.pop.'+$(this).attr('pop')).show(50);
		},
		function()
		{
			$('.pop.'+$(this).attr('pop')).hide(50);
		}
	);

	$('.bhnt img').hover(
		function()
		{
			$('.hint.'+$(this).attr('hnt')).show();
		},
		function()
		{
			$('.hint.'+$(this).attr('hnt')).hide();
		}
	);


	$('#link_short').click(function()
	{
		$('#short_about').hide(200);
		$('#long_about').show(200);
		$(this).parent().hide();
		$('#link_long').parent().show();
		return false;
	});

	$('#link_long').click(function()
	{
		$('#short_about').show(200);
		$('#long_about').hide(200);
		$(this).parent().hide();
		$('#link_short').parent().show();
		return false;
	});

	
	//coording();
	

});


$(window).resize(function(){
	//coording();
});
