﻿// JScript File
var currentIdValue;
var currentIdDiv;
function setConfirm(idValue,idDiv,typeValue)
{
    if(confirm('are you sure?'))
    {
    currentIdValue=idValue;
    currentIdDiv=idDiv;
    getAjaxContent(ajaxRoot + "postGuestBook.aspx?t="+typeValue+"&q=" + idValue ,onFinishedPosted);
    }
}


function onFinishedPosted(ajaxResult)
{
      if(ajaxResult!="")
      {
         setCss(currentIdDiv,"Hide");
      }
}

//Guest Post window////////////////////
var popDivId = "__DIV_Message_Post";
var _divWidth=600;
var _divHeight=420;

function showMesaagePost(txtId,currentId)
{
    var shareContainer = document.getElementById(popDivId);
    if(!shareContainer)
    {
        var container = document.createElement("DIV");
        container.style.width = _divWidth+"px";
        container.style.height = _divHeight+"px";
        container.style.position = "absolute";
        container.style.zIndex = 9999;
        container.id = popDivId;
        document.body.appendChild(container);
    }
    setCss(popDivId,"Hide");
    setValue(popDivId,"");
    lockScreen();
    var msg = escape(getValue(txtId));
//    if(msg == ""|| msg == "Write a message...")
//    {
//        showDialog("Please input new message");
//        closeMessagePost();
//        return;
//    }
    getAjaxContent("../ajaxResponse/guestbook_guest.aspx?q=" + currentId+ "&msg=" + msg ,null,popDivId);
    setCss(popDivId,"");
    setTimeout(function(){resetControlToCenter(popDivId,_divWidth,_divHeight);},800);
    
    return false;
}

function closeMessagePost()
{
    setValue(popDivId,"");
    setCss(popDivId,"Hide");
    unlockScreen();
    unlockControl(popDivId);
}

window.onscroll = function()
{
    setTimeout(function(){resetControlToCenter(popDivId,_divWidth,_divHeight);},200);
}

window.onresize=function()
{
    setTimeout(function(){resetControlToCenter(popDivId,_divWidth,_divHeight);},200);
}
function parentFormReload()
{
    window.location.reload();
}
