/* -------------------------------
Top Calender—pJavascript
	2006/07/19 oomomo
------------------------------- */
function submitCalenderDate(y,m,f){
	$("year").value = y;
	$("month").value = m;
	$("fnc").value = f;
	document.DateSelect.submit();
}
function viewPhotoList(obj){
	var arrystr = $("arrystr").value;
	var arryArryStr = arrystr.split(",");
	var dttext;
	
	for(i=0;i < arryArryStr.length;i++){
		dttext = arryArryStr[i];
		dttext = "pl"+dttext;
		if($(dttext)){
			$(dttext).style.display = "none";
		}
	}
	var idname = obj.id;
	idname = idname.replace("td","pl");
	idname = idname.replace("dt","pl");
	idname = idname.replace("im","pl");
	$(idname).style.display = "block";
	$("photolist").style.display="block";
}
function viewPhoto(dttext){
	var ImgSrc = $("pl"+dttext+"0").src;
	var tdWidth = 100;
	var tdHeight = 75;
	
	var imgWidth = $("pl"+dttext+"0").style.width;
	imgWidth = imgWidth.replace("px","");
	var imgHeight = $("pl"+dttext+"0").style.height;
	imgHeight = imgHeight.replace("px","");

	var newImgSize = calcImgSize(imgWidth,imgHeight,tdWidth,tdHeight);
	var objTd = $("dv"+dttext);
	var objImage = document.createElement("img");
	objImage.setAttribute("src", ImgSrc);
	objImage.setAttribute("width", newImgSize[0]);
	objImage.setAttribute("height", newImgSize[1]);
	objImage.setAttribute("id", "im"+dttext);
	objImage.className = "thumb";
	objImage.onerror = function(){
		this.src="images/my_album/noimage.gif";
		this.width=120;
		this.height=90;
		return false;
	}
	objTd.appendChild(objImage);
}

var photoID;
function viewPhotoCalender(){
	var arrystr = $("arrystr").value;
	if(arrystr != ""){
		var arryArryStr = arrystr.split(",");

		if(photoID == undefined){
			photoID = 0;
		}
		
		if(photoID == arryArryStr.length){
			clearTimeout(CalenderPhotoTimerID);
		}else{
			var dttext = arryArryStr[photoID];
			viewPhoto(dttext);
			$("td"+dttext).onclick = function(){
				viewPhotoList(this);
				return false;
			}
			$("td"+dttext).style.cursor="pointer";
			photoID = photoID +1
			CalenderPhotoTimerID = setTimeout("viewPhotoCalender()",80);
		}
	}
}

