function readPhoto()
		{
			var strCookie = document.cookie;
			var arrCookie=strCookie.split("; ");
			var resultAddress; 
			var Flag = false;			
			for(var i = 0; i < arrCookie.length; i++)
			{
				var arr = arrCookie[i].split("=");
				if("userPhotoAddress" == arr[0])
				{
					Flag = true;
					resultAddress = arr[1];					
					break;
				}
			}
			var thePhoto = document.getElementById("userPhoto");
			if (Flag == true)
			{
				thePhoto.src = unescape(resultAddress);									
			}
			else
			{
				thePhoto.src = "images/defaultphoto.gif";
			}
			return false;
		}
		
function changePhoto()
		{
			var obj = document.getElementById("selectPhoto");
			photoAddress = obj.value;
			if (photoAddress.length == 0)
			{
				alert("请选择后再提交");
			}
			else
			{
				var thePhoto = document.getElementById("userPhoto");
				thePhoto.src = photoAddress;				
				var theTime = new Date();
				var expireDays = 30;
				theTime.setTime(theTime.getTime() + expireDays * 240 * 3600 * 10000);
				document.cookie  = "userPhotoAddress=" + escape(photoAddress) + " ;path=/ ; expires=" + theTime.toGMTString();
			}	
			return false;
		}

	
function turnDefault() 
		{
			  var thePhoto = document.getElementById("userPhoto");
			  thePhoto.src = "images/defaultphoto.gif";				
			　 var strCookie = document.cookie;
			　 var arrCookie = strCookie.split(";");
			　 var i;
			　 var expires = new Date(); 
			　 expires.setDate(expires.getDate() - 1); 
			　 for(i=0; i<arrCookie.length; i++)
			　 {
			　 　 document.cookie = arrCookie[i].split('=')[0]+'=null;expires=' + expires.toGMTString(); 
			　 }
} 