﻿PostInfo("/GuestBookAdd.aspx?action=load", function(txt) { $("hGuestBook").innerHTML = txt; });
var interval;
var isShowGuestObj = true;
var yPos = GetClientInfo("h");
var img = $("moveObj");
img.style.top = yPos;
img.style.left = GetClientInfo("w") + GetClientInfo("x") - img.offsetWidth - 1;
function changePos() {
    width = GetClientInfo("w");  //document.body.clientWidth;
    height = GetClientInfo("h");  //document.body.clientHeight;
    Hoffset = img.offsetHeight;
    Woffset = img.offsetWidth;
    //img.style.left = xPos + GetClientInfo("x");
    img.style.top = yPos + GetClientInfo("y");
    if (yPos > (GetClientInfo("h") + GetClientInfo("y") - img.offsetHeight - 1)) {
        yPos = yPos - 1;
    }
    else {
        clearInterval(interval);
    }
}
function start() {
    img.style.visibility = "visible";
    interval = setInterval('changePos()', 10);
}
function CloseObj() {
    img.style.visibility = 'hidden';
    isShowGuestObj = false;
}
function SubmitGuest()
{
	var l_frm = document.forms["guestBook"];
	var t = l_frm.elements["gc"].value+"";
	var c = l_frm.elements["gcontent"].value+"";
	if(t.length<3||c.length<3)
	{
	    alert("plaese input all info");
	}
	else
	{
	    PostInfo("/GuestBookAdd.aspx",
	    function(data){
            if(data == "1")
            {
                confirm("Done!");
                l_frm.elements["gc"].value="";
                l_frm.elements["gcontent"].value="";
                CloseObj();
            }
            else
            {
                confirm("error,plaese input all info");
                ShowGuest(0);
            }},
	    "action","save","type","1","Title",t,"Content",c);
	}
}
start();
window.onscroll = function ScrollWindow() { if (isShowGuestObj) { img.style.left = GetClientInfo("w") + GetClientInfo("x") - img.offsetWidth - 1; img.style.top = GetClientInfo("h") + GetClientInfo("y") - img.offsetHeight - 1; } }
window.onresize = function ResizeWindow() { if (isShowGuestObj) { img.style.left = GetClientInfo("w") + GetClientInfo("x") - img.offsetWidth - 1; img.style.top = GetClientInfo("h") + GetClientInfo("y") - img.offsetHeight - 10; } } //事件响应