window.onload = function(){

	var $img = new Image();
	var $fuzhi = $(".fuzhi").children("img");
	var $width,$height,$x,$y;
	var $src = $fuzhi.attr("src");
	$img.src = $src;
	$width = $img.width;
	$height = $img.height;


	if($width > 300)
	{
		$x = 300;
	}
	else
	{
		$x = $width;
	}
	if($height > 220)
	{
		$y = 220;
	}
	else
	{
		$y = $height;
	}
	$(".fuzhi").css("width",parseInt($x) + "px");
	$(".fuzhi").css("height",parseInt($y) + "px");
	$(".fuzhi").css("overflow","hidden");


	var $copy = document.body.createControlRange();

	$(".ctrlc").click(function(){

		var $id = $(this).attr("alt");

		var $this = document.getElementById($id);

		if ($this.tagName != 'IMG')
		return;

		if (typeof $this.contentEditable == "undefined")
		return;

		if (!document.body.createControlRange)
		return;

		$this.contentEditable = true;
		$copy.addElement($this);
		$copy.execCommand("Copy");
		$this.contentEditable = false;
		alert("复制完成，请在QQ聊天对话框里按Ctrl+V（或点右键后在出现的菜单中点粘贴）然后发图！");

	});

}
