var ie = navigator.appVersion.match(/MSIE/) ? true : false;

var myimages = new Array();
function preloading(){
	for (x=0; x<preloading.arguments.length; x++){
		myimages[x] = new Image();
		myimages[x].src = preloading.arguments[x];
	}
}
preloading("images/collage-button-left-hover.png", "images/collage-button-right-hover.png", "images/menu-main-hover.gif", "images/promo-block-button-gray-left-hover.gif", "images/promo-block-button-gray-right-hover.png", "images/promo-block-button-left-hover.gif", "images/promo-block-button-right-hover.png");

$(document).ready(function(){
	$('.promo-block .field').focus(function(){
		$(this).addClass('field-active');

		if ($(this).val() == document.getElementById($(this).attr('id')).defaultValue && !$(this).hasClass('posted') ) {
			
				$(this).val('');
		}
		else $(this).select();
	}).blur(function(){
	
		$(this).removeClass('field-active');
		if ($(this).val() == '') $(this).val(document.getElementById($(this).attr('id')).defaultValue);
		
	});
	
	$('.subscribe .field').focus(function(){
		$(this).addClass('field-active');
		if ($(this).val() == document.getElementById($(this).attr('id')).defaultValue && !$(this).hasClass('posted') ) $(this).val('');
		else $(this).select();
	}).blur(function(){
		$(this).removeClass('field-active');
		if ($(this).val() == '') $(this).val(document.getElementById($(this).attr('id')).defaultValue);
	});
	
	
	$('.news-block ul li:first').css({border: 0});
	
	
	
	t = 0;
	$('.index-page .promo-block').each(function(){
		$height = $(this).height();
		if ($height > t) t = $height;
	});
	$('.index-page .promo-block .content').css({height: t-51-10-25});
	
	
	
	$('.reasons a').hover(function(){
		$note = $(this).parent().find('.note');
		$top = $note.height() - 17;
		
		$note.css({'margin-top': -$top, 'margin-left': -188}).show();
		
		$note.hover(function() {
			$(this).show();
		}, function(){
			$(this).hide();
		});
		return false;
	}, function(){
		$(this).parent().find('.note').hide();
	});
	
	$('#subscribe-field').focus(function(){
		$(this).addClass('focus');
		if ($(this).val() == document.getElementById($(this).attr('id')).defaultValue) $(this).val('');
		else $(this).select();
	}).blur(function(){
		$(this).removeClass('focus');
		if ($(this).val() == '') $(this).val(document.getElementById($(this).attr('id')).defaultValue);
	});
	
	$('.reg-form .info').hover(function(){
		$height = $(this).find('b').height();
		$(this).find('b').css({'margin-top': -$height}).show();
	}, function(){
		$(this).find('b').hide();
	});
	
	$('.main-container div:first').addClass('main-container-' + $('.menu-main .active').parent().attr('class'));
});
