// JavaScript Document
function showGate(ID,part){
	ShowASBox(2,'相册密码','验证密码,请稍后',230,330,0,2,false);
	if(part=="Photo"){
		var actionUrl="index.asp?Show=getdailog&PhotoId="+ID;	
	}else{
		var actionUrl="index.asp?Show=getdailog_Album&AlbumID="+ID;	
	}
	AjaxUpdate(actionUrl, "ASBox_main");
}
function answer_Album(AlbumId,AlbumAnswer){
	if(AlbumAnswer==""){
		alert("请输入密码！");
	}else{
		var actionUrl="index.asp?Show=checkAlbumPW&AlbumId="+AlbumId+"&Password="+AlbumAnswer;	
		AjaxUpdate(actionUrl, 
			function(obj) {
				if(obj.responseText=="checkOk"){			
					hideASBox();
					innerAlbum(AlbumId);
					window.location.href="?Show=List&AlbumID="+AlbumId;
					//alert("d")
				}else{
					document.getElementById("ASBox_main").innerHTML = obj.responseText;
				}
			}
		);		 
	}
}
function answer_Photo(PhotoId,PhotoAnswer){
	if(PhotoAnswer==""){
		alert("请输入密码！");
	}else{
		var actionUrl="?Show=checkPhotoPW&PhotoId="+PhotoId+"&Password="+PhotoAnswer;	
		AjaxUpdate(actionUrl, 
		function(obj) {
			if(obj.responseText=="checkOk"){
				//alert(obj.responseText);
				hideASBox();
				innerPhoto(PhotoId);
			}else{
				document.getElementById("ASBox_main").innerHTML = obj.responseText;
			}
		}
		);
		//hideASBox();
	}
}
function innerAlbum(AlbumId){
	var actionUrl="?Show=innerAlbum&AlbumId="+AlbumId;	
	AjaxUpdate(actionUrl, "hiddenDiv_"+AlbumId);
}
function innerPhoto(PhotoId){
	var actionUrl="?Show=innerPhoto&PhotoId="+PhotoId;	
	AjaxUpdate(actionUrl, "hiddenDiv_"+PhotoId);
}
function ResizeImage(){
			if(document.getElementById("ListForPage")){
				var info = document.getElementById("ListForPage").getElementsByTagName("img");
				for (var i=0;i<info.length;i++){
					DrawImage(info[i]);
				}
			}
		}
		function DrawImage(imgid){
			var diyHeight=122;
			var diyWidth=	162;
			var mypic = new Image();
			mypic.src = imgid.src;
			var mywidth = mypic.width;
			var myheight = mypic.height;
			if (myheight >= diyHeight){    
				imgid.style.height = diyHeight;
				imgid.style.width = Math.floor(mywidth/(myheight/diyHeight));
			}
			if (mywidth >=diyWidth) {
				imgid.width =diyWidth;
				imgid.height = Math.floor(myheight/(mywidth/diyWidth));
			}else{
				imgid.width = mywidth;
				imgid.height = myheight;
			}
		}
		window.onload = function (){
			ResizeImage();
		}
