function DrawImage(ImgD,FitWidth,FitHeight){     
	    var image=new Image();      
	    image.src=ImgD.src;       
	    if(image.width>0 && image.height>0){       
	        if(image.width/image.height>= FitWidth/FitHeight){     
	            if(image.width>FitWidth){   
	                ImgD.width=FitWidth;   
	                ImgD.height=(image.height*FitWidth)/image.width;       
	            }else{   
	                ImgD.width=image.width;   
	                ImgD.height=image.height;   
	                }   
	            }else{    
	                if(image.height>FitHeight){   
	                    ImgD.height=FitHeight;    
	                    ImgD.width=(image.width*FitHeight)/image.height;    
	                }else{   
	                    ImgD.width=image.width;         
	                    ImgD.height=image.height;   
	                    }   
	                }   
	            }   
	    }

jq = jQuery.noConflict();
jq(document).ready(function() {

//	var image = jq("img[id=fixsize]");
//	image.load(function(){
//		img_width = image.width();
//		img_height = image.height();
//		ratio = img_height/img_width;
//		
//		new_width = 400;
//		new_height = new_width * ratio;
//		jq(this).attr("width",new_width).attr("height",new_height);
//		
//	})
/*
	if (jq.browser.safari) {
		var image = jq("img[id=fixsize]");
		jq("img[id=fixsize]").each(function(){
			jq(this).load(function(){
				
				img_width = jq(this).width();
				if(img_width > 520){
					img_height = jq(this).height();
					ratio = img_height/img_width;
					
					new_width = 520;
					new_height = new_width * ratio;
					
					jq(this).attr("width",new_width).attr("height",new_height);
				}
				
		
			})
		})
	}else{
		jq("img[id=fixsize]").each(function(){
			img_width = jq(this).width();alert(jq(this).attr('src'));
			if(img_width > 520){
				img_height = jq(this).height();
				ratio = img_height/img_width;
				
				new_width = 520;
				new_height = new_width * ratio;
				
				jq(this).attr("width",new_width).attr("height",new_height);
			}
		})
	}
	*/
	jq("a.zoom").fancybox({
		'overlayColor':'#000',
		'overlayOpacity'     :'0.8'
	});
	
});
