$(document).ready(function(){
  var menu_id = 0;

  $('#banner .search form .submit').mouseover(function(){$(this).css("background", "url("+img_path+"/b_go_over.gif) no-repeat");})
                                   .mouseout(function(){$(this).css("background", "url("+img_path+"/b_go_up.gif) no-repeat");})
								   .click(function(){$(this).css("background", "url("+img_path+"/b_go_down.gif) no-repeat"); });
		
  var banner_id   = 0;
  banner_hover($("#left > .banner > ul > .n1"));

  $('#left > .banner > ul > li').mouseover(function(){banner_hover(this)});
  
  $('.customers > .list > li').click(function(){						
											
									    $('.customers .show > span').html($('div',this).html()).show();
										$('#customers_show').hide();
							       	   
									    var customers = $('.customers');
									    var offset = customers.offset();

										$("*").mousemove(function(e){
										if(  !(e.pageX  > offset.left  &&   e.pageX < offset.left + customers.width()  && e.pageY  > offset.top &&  e.pageY  < offset.top + customers.height() )  ){
										  $('.customers .show > span').hide();
										  $('#customers_show').show();
										}		
										});
									  });
  	
  marquee();
  $('.news_line li').mouseover(function(){$('.news_line').stopTime();}).mouseout(marquee);
  
  var list = $('#product_list > .product > .list > li');
  list.click(function(){
       var product = $('#product_list > .product');
       var show = $( '#product_list .product > .show');
	   
       var details_object = $('div',this).eq(2);

       list.hide();
	   show.show().html(details_object.html());
	   
	   show.find('.close').mouseover(function(){$(this).attr('src',img_path+'/b_ra.gif');})
	              .mouseout(function(){$(this).attr('src',img_path+'/b_r.gif');})
				  .click(function(){show.html('').hide();list.show();}); 
				  

       show.find('.more').mouseover(function(){$('img',this).attr('src',img_path+'/ba_more.gif');})
                                         .mouseout(function(){$('img',this).attr('src',img_path+'/b_more.gif');});	  
  });


  
  function marquee(){$('.news_line').everyTime(2000, news_move);}
  function news_move(){var $item = $('.news_line li:eq(0)');$item.clone().appendTo('.news_line');$item.animate({marginTop:"-=21px"},1000,function(){$item.remove(); });}
 
  function banner_hover(element){
	var element_class = $(element).attr('class');
	var banner_focus = element_class.substr(1,1);
	if( banner_focus != banner_id )
	{
 		$('#left > .banner > ul > .n'+banner_id).css(   "background", "url("+img_path+"/menu/"+language+"/ad"+banner_id+".gif) no-repeat");
 		$('#left > .banner > ul > .n'+banner_id + '> .show').hide();
    	$('#left > .banner > ul > .n'+banner_focus).css("background", "url("+img_path+"/menu/"+language+"/ad"+banner_focus+"_a.gif) no-repeat");
 		$('#left > .banner > ul > .n'+banner_focus + '> .show').show();
		banner_id = banner_focus;
	}
  };

})
