﻿// JavaScript Document
var xx = 0;
var windowWidth, windowHeight;
function GetWH()
{
	if (self.innerHeight) {    // all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
}
function ShowGuest(x)
{
	var vW,vH;
	vW = 720;
	vH = 310;
	GetWH();
	if(windowWidth>1024)
	{
		vW = (windowWidth - 1024) / 2 + vW;
	}
	g('hGuestBook').style.top = vH + "px";
	g('hGuestBook').style.left = vW + "px";
	if(x==1)
	{
		xx=0;
		g('hGuestBook').style.display='none';
	}
	else
	{
		if(xx==1)
		{
			g('hGuestBook').style.display='none';
			xx=0;
		}
		else
		{
			g('hGuestBook').style.display='block';
			xx=1;
		}
	}
	
}
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("请正确填写相关信息，再点击提交！");
	}
	else
	{
	    PostInfo("/My517/Guest.aspx",
	    function(data){
            if(data == "1")
            {
                confirm("提交成功！");
                l_frm.elements["gc"].value="";
                l_frm.elements["gcontent"].value="";
                CloseObj();
            }
            else
            {
                confirm("提交失败，请正确填写相关信息！");
                ShowGuest(0);
            }},
	    "action","save","type","1","Title",t,"Content",c);
	}
}
