$(document).ready (
	function() {
		var slash="";
		if ($('script').attr('src').substr(0,1)=='/') slash='/';
		
		$.ifixpng(slash+'assets/js/x.gif');
		$('img[@src$=.png], .png').ifixpng();
		
		$('#logo').flashembed({src:slash+'assets/flash/logo.swf',width:170,height:125,version:[8,0],menu:false,flashvars:"url=/"});

		$('#flash-head:not(.continent)').flashembed({src:slash+'assets/flash/big-ban.swf',width:507,height:170,version:[8,0],wmode:'transparent',menu:false, flashvars:'xml=/assets/banners.xml'});
		
		$('.header .phones').each(function(){	
			$(this).after('<div class="phones-shadow">'+$(this).html()+'</div>');
		});
								   
		$(".hmenu li:not(.active) span.text").each(function(){							
			$(this).before('<span class="shadow">'+$(this).text()+'</span>');
		});
		
		$(".vmenu li span.text").each(function(){							
			$(this).before('<span class="shadow">'+$(this).text()+'</span>');
		});
		
		$(".spec-menu li span.text").each(function(){							
			$(this).before('<span class="shadow">'+$(this).text()+'</span>');
		});		
		
		$('.bullet').click(
			function(){
				if ($(this).parent().parent().hasClass('closed'))
				{
					$(this).parent().parent().removeClass('closed');
					$(this).parent().parent().addClass('opened');
				} else {
					$(this).parent().parent().removeClass('opened');
					$(this).parent().parent().addClass('closed');
				}
				
				return false;
			}
		);
		
		
		if ($('.search-form').length>0) {
			$('.incorrect').each(
				function () {
					if ($(this).attr('for')) 
						$(this).attr('for',$(this).attr('for').replace('___','[]'));
					else 
						$(this).attr('id',$(this).attr('id').replace('___','[]'));
				}
			);
			trr_LoadCityDep();
		}
		
		
		$('input[type=text],input[type=password],textarea,select').focus(
			function () {
				$(this).css("backgroundColor","#e1ff84");
			}
		).blur(
			function () {
				$(this).css("backgroundColor","");
			}			
		);
		
		
		if ($('#order-form').length>0) {	
			$('#order-form').submit(
				function() {
					var inp=$(this).find('input.required');	
					for (i=0; i<inp.length; i++) {
						if ($(inp[i]).val()=="") {
							document.location="#order-error";
							$(inp[i]).focus();
							$('#order-error').animate({opacity:"show"},1000);
							return false;
							break;
						}
					}	
				});
		}
		
		
		if ($('.gb form').length>0) {	
			$('.gb form').get(0).onsubmit=
				function() {
					var inp=$(this).find('.required');	
					for (i=0; i<inp.length; i++) {
						if ($(inp[i]).val()=="") {
							document.location="#error";
							$(inp[i]).focus();
							$('.gb #error').animate({opacity:"show"},1000);
							return false;
							break;
						}
					}	
				};
		}		
		$('.vip .trr_best_main_table td[bgcolor]').addClass('trr_bot_bord');
		
		$('.content>ul.submenu2>li>a').click (
			function()
			{
				if ( $(this).next().length )
				{
				
					if ($(this).next().css('display')=='none')
						$(this).next().css('display','block');
					else 
						$(this).next().css('display','none');
					return false;
				}
			}
		)
	}
)

function headImage (img) {
	$('#flash-head').addClass('continent').html('<img src="'+img+'" width="507" height="170" alt="" />'); 
}
