/**
 * jQuery.fullBg
 * Version 1.0
 * Copyright (c) 2010 c.bavota - http://bavotasan.com
 * Dual licensed under MIT and GPL.
 * Date: 02/23/2010
**/
(function($) {
	$.fn.fullBg = function(){
		var bgImg = $("#banner_list img");
		bgImg.addClass('fullBg');
		function resizeImg() {
			var imgwidth = bgImg.width();//图片宽度
			var imgheight = bgImg.height();//图片高度
			var winwidth = $(window).width();//浏览器的宽度
			var winheight = $(window).height();//浏览器的高度
			
			$("#picture_mian").css({height:winheight-90 +'px',width:winwidth +'px',overflow:'hidden'});
			$(".kidulty_mian_left").css({height: winheight-90 +'px'});
			$("#banner").css({height: winheight-40 +'px'});//控制ie6
			
		    //图库详细页左边定位内容
			$(".pictuer_wen").css({
			   "margin-top": winheight/2 -200 +"px"				  
			});
			//求倍数	
			var widthratio = winwidth/imgwidth;
			var heightratio = winheight/imgheight;
			
			var widthdiff = heightratio*imgwidth;
			var heightdiff = widthratio*imgheight;
			var imgh=$("#galleryimg").height();
		
			if(winheight>imgh){
				var h=winheight-imgh-90
				$("#galleryimg").css({marginTop: h/2 +'px'});
				}else{
				$("#galleryimg").css({marginTop:'0px'});	
			    }
			
			if(heightdiff>winheight) {
				bgImg.css({
					width: winwidth +'px',
					height: heightdiff +'px'
				});
			} else {
				bgImg.css({
					width: widthdiff +'px',
					height: winheight +'px'
				});	
			}
		} 
		resizeImg();
		$(window).resize(function() {
			resizeImg();
		}); 
	};
})(jQuery)



//图库页图片放大缩小
$(function(){
	var move = -15;//移动像素的图像
	var zoom = 1.1;//缩放比例，1.2 =120％
	$('.small_galleryimg').live('mouseenter',function(){//在对这些缩略图的鼠标滑过事件
		//根据缩放百分比设置宽度和高度
		width = $('.small_galleryimg').width() * zoom;
		height = $('.small_galleryimg').height() * zoom;
		//移动和缩放图像
		$(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
		$(this).find('.big_img_title').show();
	}).live('mouseleave',function(){
		//复位图像
		$(this).find('img').stop(false,true).animate({'width':$('.small_galleryimg').width(), 'height':$('.small_galleryimg').height(), 'top':'0', 'left':'0'}, {duration:100});
		 $(this).find('.big_img_title').hide();
	});
	$('.big_galleryimg').live('mouseenter',function(){
		//根据缩放百分比设置宽度和高度
		width = $('.big_galleryimg').width() * zoom;
		height = $('.big_galleryimg').height() * zoom;
		//移动和缩放图像
		$(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
		$(this).find('.big_img_title').show();
	}).live('mouseleave',function(){
		//复位图像
		$(this).find('img').stop(false,true).animate({'width':$('.big_galleryimg').width(), 'height':$('.big_galleryimg').height(), 'top':'0', 'left':'0'}, {duration:100});
		 $(this).find('.big_img_title').hide();
	});

	
	
	
});


