﻿// JScript 文件
// 王钊于2010年8月20日创建,用于DCT新blog的相关功能!
// 王钊于2010年8月23日添加,用于DCT新blog的头像功能!
// 王钊于2010年8月31日添加,用于DCT新blog的内容页功能组!
// 王钊于2010年9月2日添加,用于DCT新blog的相册页功能组!

function yjBlogPhotoPrev(){var objDiv = document.getElementById("yjObjAlbum");var objDiv1 = document.getElementById("yjObjAlbum1");var objDiv2 = document.getElementById("yjObjAlbum2");var objBodys = objDiv1.getElementsByTagName("div")[0];if (objDiv2.innerHTML == ""){objDiv2.innerHTML = objDiv1.innerHTML;}if (objDiv.scrollLeft <= 0){objDiv.scrollLeft += objDiv1.offsetWidth;}if (objDiv.scrollLeft % objBodys.offsetWidth == 0){yjBlogPhotoMove(objDiv,(0-objBodys.offsetWidth));}}function yjBlogPhotoNext(){var objDiv = document.getElementById("yjObjAlbum");var objDiv1 = document.getElementById("yjObjAlbum1");var objDiv2 = document.getElementById("yjObjAlbum2");var objBodys = objDiv1.getElementsByTagName("div")[0];if (objDiv2.innerHTML == ""){objDiv2.innerHTML = objDiv1.innerHTML;}if (objDiv1.offsetWidth - objDiv.scrollLeft <= 0){objDiv.scrollLeft = 0;}if (objDiv.scrollLeft % objBodys.offsetWidth == 0){yjBlogPhotoMove(objDiv,objBodys.offsetWidth);}}function yjBlogPhotoMove(obj,vNum){var MyCloseSession;var SessionTime = 8;var speed = 100;var intTemp = vNum;function myBlogPhotoDo(){if (SessionTime > 0){obj.scrollLeft += parseInt(intTemp / 2);intTemp -= parseInt(intTemp / 2);SessionTime--;}else{obj.scrollLeft += intTemp;clearInterval(MyCloseSession);}}MyCloseSession = setInterval(function(){myBlogPhotoDo();},speed);}function yjBlogFaceFormat(objID,objID1,objID2){var obj = document.getElementById(objID);var obj1 = document.getElementById(objID1);var obj2 = document.getElementById(objID2);var l;obj.style.height = (obj1.offsetHeight + 2) + "px";l = parseInt((obj.offsetWidth-2-obj1.offsetWidth) / 2);obj1.style.left = l + "px";l += 2;obj2.style.width = obj1.offsetWidth + "px";obj2.style.height = obj1.offsetHeight + "px";obj2.style.left = l + "px";}function yjObjChgUserFace(thisoption){var obj = document.getElementById("objUserface");obj.src = "/weblog/images/face/" + thisoption.options[thisoption.selectedIndex].value + ".gif";}function yjGetBlogFormCode(objID){if (document.getElementById(objID).value == ""){var vUrl = "/yjFunction/yjObjVerifyCode.aspx?yjCache=" + (11111 + Math.round(Math.random() * 99999));var obj = document.getElementById(objID);yjAjaxValue(obj,vUrl);}}function yjAjax(obj,objUrl){var xmlHttpRequest;xmlHttpRequest = createXmlHttpRequest();xmlHttpRequest.onreadystatechange = yjHtmlShow;xmlHttpRequest.open("get",objUrl,true);xmlHttpRequest.send(null);function yjHtmlShow(){if(xmlHttpRequest.readyState == 4){if(xmlHttpRequest.status == 200){obj.innerHTML = xmlHttpRequest.responseText;}}}}function yjAjaxValue(obj,objUrl){var xmlHttpRequest;xmlHttpRequest = createXmlHttpRequest();xmlHttpRequest.onreadystatechange = yjHtmlShow;xmlHttpRequest.open("get",objUrl,true);xmlHttpRequest.send(null);function yjHtmlShow(){if(xmlHttpRequest.readyState == 4){if(xmlHttpRequest.status == 200){obj.value = xmlHttpRequest.responseText;}}}}function yjBlogGradeClick(objNum){document.getElementById("grade").value = objNum;}function yjBlogGradeOver(objNum){var _images = document.getElementById("bloggrade").getElementsByTagName("img");for (var i=0;i<_images.length;i++){if ((i+1) > objNum){_images[i].src = "/images/weblog/images_37.gif";}else{_images[i].src = "/images/weblog/images_38.gif";}}}function yjBlogGradeOut(){var objNum = parseInt(document.getElementById("grade").value);if (objNum == ""){objNum == 0;}yjBlogGradeOver(objNum);}function yjChkBlogForm(objIDs,objWords){var objItems = objIDs.split(',');var objAlert = objWords.split(',');for (var i=0; i<objItems.length; i++){if (document.getElementById(objItems[i]).value == ''){alert("You need type in " + objAlert[i] + " !");document.getElementById(objItems[i]).focus();return false;}}}function yjBlogFormUsernameIn(obj,objValue){if (obj.value == objValue){obj.value = "";}}function yjBlogFormUsernameOut(obj,objValue){if (obj.value == ""){obj.value = objValue;}}function showLeftCursor(obj){var h = obj.offsetHeight;var w = obj.offsetWidth;obj.style.background = "url('/images/icons/left.gif')";obj.style.backgroundRepeat = "no-repeat";obj.style.backgroundPosition = (w-37) + "px " + (h-42) + "px";}function showRightCursor(obj){var h = obj.offsetHeight;obj.style.background = "url('/images/icons/right.gif')";obj.style.backgroundRepeat = "no-repeat";obj.style.backgroundPosition = "10px " + (h-42) + "px";}function closeCursor(obj){obj.style.backgroundPosition = "1000px 1000px";}function yjFormatObjDiv(){var objDiv = document.getElementById("yjObjImageGroup");var arrDiv = objDiv.getElementsByTagName("div");var objImg = objDiv.getElementsByTagName("img")[0];var dw,dh,w;dw = objImg.offsetWidth;dh = objImg.offsetHeight;w = dw / 2;objDiv.style.width = dw + "px";arrDiv[0].style.width = w + "px";arrDiv[0].style.height = dh + "px";arrDiv[0].style.left = "0";arrDiv[1].style.width = (dw - w) + "px";arrDiv[1].style.height = dh + "px";arrDiv[1].style.left = w + "px";}function firstphotomove(objNumbers){var s;var MyCloseSession;function firstPhotoDo(){var s = document.getElementById("yjObjFileField");if (s){var n = parseInt(s.innerHTML);if (n - objNumbers < 1){document.getElementById("yjObjDiv").scrollLeft = (objNumbers*2-n)*131;yjPicMove((objNumbers*2-n+1),n);}else{document.getElementById("yjObjDiv").scrollLeft = 0;if (n > 1){yjPicMove(1,n);}}clearInterval(MyCloseSessions);}}MyCloseSessions = setInterval(function(){firstPhotoDo();},100);}function photoprev(){var n = parseInt(document.getElementById("yjObjFileField").innerHTML);yjChkPhotoAlbum();yjPicMove(n,(n-1));}function photonext(){var n = parseInt(document.getElementById("yjObjFileField").innerHTML);yjChkPhotoAlbum();yjPicMove(n,(n+1));}function yjPicMove(objNow,objGoto){var objWidth = 131;var objMaxWidth = (objGoto - objNow) * objWidth;var MyCloseSession;var SessionTime = 8;var speed = 100;var intTemp = 0;var objDiv = document.getElementById("yjObjDiv");var objSpan = document.getElementById("yjObjFileField");var objMax = document.getElementById("yjObjDiv1").getElementsByTagName("li").length;var scrollWidth = objMax * objWidth;if (objDiv.scrollLeft % objWidth != 0){objDiv.scrollLeft += (objMaxWidth % objWidth);}else{if (objDiv.scrollLeft == 0){objDiv.scrollLeft += scrollWidth;}if (objDiv.scrollLeft >= scrollWidth*2){objDiv.scrollLeft -= scrollWidth;}if (objGoto == 0){objGoto = objMax;}if (objGoto > objMax){objGoto = 1;}function yjObjPicDo(){if (SessionTime > 0){intTemp = parseInt(objMaxWidth / 2);objDiv.scrollLeft += intTemp;objMaxWidth -= intTemp;SessionTime--;}else{objDiv.scrollLeft += objMaxWidth;objSpan.innerHTML = objGoto;if (objDiv.scrollLeft < 0){objDiv.scrollLeft += scrollWidth;}clearInterval(MyCloseSession);}}MyCloseSession = setInterval(yjObjPicDo,speed);}}function yjChkPhotoAlbum(){var objDiv1 = document.getElementById("yjObjDiv1");var objDiv2 = document.getElementById("yjObjDiv2");var objDiv3 = document.getElementById("yjObjDiv3");if (objDiv2.innerHTML == ""){objDiv2.innerHTML = objDiv1.innerHTML;objDiv3.innerHTML = objDiv1.innerHTML;}}
