function Init(image, width, height, image_width_min, image_width_max, image_height_min, image_height_max)
	{
		if (image_width_min == null)
		{
			image_width_min = 0;
		}
		if (image_width_max == null)
		{
			image_width_max = 0;
		}
		if (image_height_min == null)
		{
			image_height_min = 0;
		}
		if (image_height_max == null)
		{
			image_height_max = 0;
		}
		//alert ("width "+image.width());
		image.attr("width_ori",width);
		image.attr("height_ori",height);
		image.attr("ratio",(height/width));
		
		image.attr("image_width_min",image_width_min);
		image.attr("image_width_max",image_width_max);
		image.attr("image_height_min",image_height_min);
		image.attr("image_height_max",image_height_max);

		//Width[image] = $("#"+image).width();
		//Height[image] = $("#"+image).height();
		Resize(image);
	}
	
	function Resize(image)
	{		
		var width = 0;
		var height = 0;
		if( image.attr("image_width_min") != 0){
			if( image.attr("image_width_min") > $(window).width()){
				width = image.attr("image_width_min");
			}
		}
		if( image.attr("image_width_max") != 0){
			if( image.attr("image_width_max") < $(window).width()){
				width = image.attr("image_width_max");
			}
		}
		if( image.attr("image_height_min") != 0){
			if( image.attr("image_height_min") > $(window).height()){
				height = image.attr("image_height_min");
			}
		}
		if( image.attr("image_height_max") != 0){
			if( image.attr("image_height_max") < $(window).height()){
				height = image.attr("image_height_max");
			}
		}
		if (( height != 0) && ( width != 0))
		{
			if (width*image.attr("ratio") < height)
			{
				image.width($(window).width());
				image.height($(window).width()*image.attr("ratio"));
			}
			else
			{
				image.height($(window).height());
				image.width($(window).height()/image.attr("ratio"));
			}
		}
		else if( height != 0)
		{
			image.height(height);
			image.width(height/image.attr("ratio"));
		}
		else if( width != 0)
		{
			image.width(width);
			image.height(width*image.attr("ratio"));
		}
		else if ((image.attr("image_width_min") != 0 || image.attr("image_width_max") != 0) && (image.attr("image_height_min") != 0 || image.attr("image_height_max") != 0))
		{
			if ($(window).width()*image.attr("ratio") <  $(window).height())
			{
				image.width($(window).width());
				image.height($(window).width()*image.attr("ratio"));
			}
			else
			{
				image.height($(window).height());
				image.width($(window).height()/image.attr("ratio"));
			}
		}
		else if (image.attr("image_width_min") != 0 || image.attr("image_width_max") != 0)
		{
			image.width($(window).width());
			image.height($(window).width()*image.attr("ratio"));
		}
		else if (image.attr("image_height_min") != 0 || image.attr("image_height_max") != 0)
		{
			image.height($(window).height());
			image.width($(window).height()/image.attr("ratio"));
		}
		else
		{
			if ($(window).width()*image.attr("ratio") < $(window).height())
			{
				image.width($(window).width());
				image.height($(window).width()*image.attr("ratio"));
			}
			else
			{
				image.height($(window).height());
				image.width($(window).height()/image.attr("ratio"));
			}
		}
	}