function slide(){
		if(($('#banners .up').size()==0)&($('#banners li:animated').size()==0)){
			$('#banners ul').addClass('anim');
			if($('#banners li.sel').next().size()>0){var li=$('#banners li.sel').next();}
			else{var li=$('#banners ul li:first-child');}
			var sel = li.parent().find('.sel');
			li.show().css('top',-136)
			sel.removeClass('sel');
			li.addClass('sel').animate({top: 0}, 900, '',function(){sel.hide();$('#banners ul').removeClass('anim');});
		}
		setTimeout('slide()',5000);
	}

function linr(){
	if($.browser.msie){$('#rollerimage').css('margin-left',-$('#rollerimage').width()/2);
	}else{$('#rollerimage').css('margin-left',-$('#rollerimage').width()/2);}
}

function setimg(fn){
	if($.browser.msie){
		$('#rollerimage img').attr('src',fn);
		linr();
	}else{
//        $('#rollerimage img').attr('src',fn);
//        linr();
		$.ajax({url: '/images/map.jpg', success: function(data) {
			$('#rollerimage img').attr('src',fn);linr();}});
	}
	setTimeout('linr()',100);	
	}

$(document).ready(function(){
	var tmp;
		
	$('.blanck').attr('target','blank');
	
	$('#head .menu div a').hover(function(){$(this).parent().parent().addClass('hover');},
						  		 function(){$(this).parent().parent().removeClass('hover');});
	$('#content form .edit input').focus(function(){$(this).parent().addClass('focus');});
	$('#content form .edit input').blur(function(){$(this).parent().removeClass('focus');});

	$('#content form .textarea textarea').focus(function(){$(this).parent().addClass('focust');});
	$('#content form .textarea textarea').blur(function(){$(this).parent().removeClass('focust');});
	
	$('#content .files p a').click(function(){
//            $('#wrap').attr('padding', '0px 0px 0px 0px');
			var fn=$(this).attr('href');
			tmp = $(this);
			$('#roller_bg').show();
			if(tmp.prev().size()>0){$('#rollerarrlft').show();}
			if(tmp.next().size()>0){$('#rollerarrrgt').show();}
			setimg(fn);
			$('#rollerimage').show();
			$('#rollerclose').show();
			return false;
		});
	
	$('#roller_bg').click(function(){
		$(this).hide();
		$('#rollerarrlft').hide();
		$('#rollerarrrgt').hide();
		$('#rollerimage').hide();
		$('#rollerclose').hide();
	});

	$('#rollerclose').click(function(){
		$(this).hide();
		$('#rollerarrlft').hide();
		$('#rollerarrrgt').hide();
		$('#rollerimage').hide();
		$('#roller_bg').hide();
	});

	$('#rollerarrlft').click(function(){
		tmp = tmp.prev();
		setimg(tmp.attr('href'));
		if(tmp.prev().size()>0){$('#rollerarrlft').show();}else{$('#rollerarrlft').hide();}
		if(tmp.next().size()>0){$('#rollerarrrgt').show();}else{$('#rollerarrrgt').hide();}
	});

	$('#rollerarrrgt').click(function(){
		tmp = tmp.next();
		setimg(tmp.attr('href'));
		if(tmp.prev().size()>0){$('#rollerarrlft').show();}else{$('#rollerarrlft').hide();}
		if(tmp.next().size()>0){$('#rollerarrrgt').show();}else{$('#rollerarrrgt').hide();}
	});
	
	$('#content .img_list li img').click(function(){
			$(this).parent().parent().parent().parent().find('.sel').removeClass('sel');
			$(this).parent().parent().parent().parent().prev().html('<span class="img_box"><span class="lt"></span><span class="rt"></span><img src="'+$(this).parent().attr('href')+'" alt="'+$(this).attr('alt')+'"><span class="lb"></span><span class="rb"></span></span>'+$(this).attr('alt'));
			$(this).parent().parent().parent().addClass('sel');
			return false;
		});

	var ptlw=0;
	$('.product_type_list ul li').each(function(){ptlw=ptlw+$(this).width()+21;});
	$('.product_type_list ul').width(ptlw).css('position','absolute');
	$('#butrig img').mousedown(function() {
								var s=$('.product_type_list ul').width()-$('.product_type_list').width()+43;
								$('.product_type_list ul').animate({left:-s}, $('.product_type_list ul').width()-Math.abs($('.product_type_list ul').position().left),'linear', function() {$('#butrig').addClass('stop');});
								$('#butlef').removeClass('stop');
							});
	$('#butrig img').mouseup(function() {$('.product_type_list ul').stop();});
	$('#butlef img').mousedown(function() {$('.product_type_list ul').animate({left: 0},  Math.abs($('.product_type_list ul').position().left),'linear', function() {$('#butlef').addClass('stop');});
										   $('#butrig').removeClass('stop');
										 });
	$('#butlef img').mouseup(function() {$('.product_type_list ul').stop();});

	
	$('.product_list ul').width($('.product_list ul li').size()*172).css('position','absolute');
	$('#pldetrigth img').mousedown(function() {
								var s=$('.product_list ul').width()-$('.product_list').width()
								$('.product_list ul').animate({left:-s-200}, $('.product_list ul').width()-Math.abs($('.product_list ul').position().left),'linear', function() {$('#pldetrigth span').addClass('stop');});
								$('#pldetleft span').removeClass('stop');
							});
	$('#pldetrigth img').mouseup(function() {$('.product_list ul').stop();});
	$('#pldetleft img').mousedown(function() {
											$('.product_list ul').animate({left: 35}, Math.abs($('.product_list ul').position().left),'linear', function() {$('#pldetleft span').addClass('stop');});
										   $('#pldetrigth span').removeClass('stop');
										 });
	$('#pldetleft img').mouseup(function() {$('.product_list ul').stop();});
	
	$('#banners li.sel').hide().show();/*0.o*/
	$('#banners li').hover(function(){
							if($('#banners .anim').size()==0){
								$(this).parent().addClass('up');
								$(this).stop().animate({height: 337}, 500, '',function(){}).parent().stop().animate({height: 337}, 500, '',function(){})
								.find('img').stop().animate({top: 0}, 500, '',function(){$('#banners .pslink').css('display','block');$('#banners .text').css('display','block');});
								$(this).find('.h1').stop().animate({top: 84}, 500, '',function(){});
								$(this).find('.d').stop().animate({top: 87}, 500, '',function(){});
							}
							},
					  	   function(){
							$('#banners .pslink').css('display','none');
							$('#banners .text').css('display','none');
							if($('#banners .anim').size()==0){
								$(this).parent().removeClass('up');
								$(this).stop().animate({height: 156}, 500, '',function(){}).parent().stop().animate({height: 156}, 500, '',function(){})
							   .find('img').stop().animate({top: -150}, 500, '',function(){});
								$(this).find('.h1').stop().animate({top: 40}, 500, '',function(){});
								$(this).find('.d').stop().animate({top: 43}, 500, '',function(){});
							}
						   });
	setTimeout('slide()',5000);

    if($('.product_list').size()>0){
		var h=0;
		if($('.product_list li.sel').size()>0){
			$('.product_list li').each(function(index){if(($(this).height()+12)>h){h=$(this).height();}});
			$('.product_list').height(h+24);
			$('.product_list li').height(h+12);
			$('#pldetleft').height(h+15);
			$('#pldetrigth').height(h+15);
		}
		else{$('.product_list li').each(function(index){if(($(this).height())>h){h=$(this).height();}});
			$('.product_list li').height(h+20);
		}
	}

	if($('#content .product_type_list ul .sel').size()>0){
			var ptlul = $('#content .product_type_list ul .sel');
			if((ptlul.position().left+ptlul.width())>ptlul.parent().parent().width()){
				ptlul.parent().css('left',-(ptlul.position().left+ptlul.width()-ptlul.parent().parent().width()+90));
				$('#butlef').removeClass('stop');
			}
		}

	if($('#content .product_list ul .sel').size()>0){
			var ptlul = $('#content .product_list ul .sel');
			if((ptlul.position().left+ptlul.width())>ptlul.parent().parent().width()){
				ptlul.parent().css('left',-(ptlul.position().left+ptlul.width()-ptlul.parent().parent().width()+90));
				$('#pldetleft').find('span').removeClass('stop');
			}
		}

});

