
/* Dataview Webpart Forms engine*/
function VWSendForm(redirurl, message, action) {

    var theForm = document.forms['aspnetForm'];
    if (theForm.vwFormRedirecturl != null)
        theForm.vwFormRedirecturl.value = redirurl;
    if (theForm.vwFormMessage != null)
        theForm.vwFormMessage.value = message;
    if (theForm.vwFormAction != null)
        theForm.vwFormAction.value = action;
    theForm.submit();
    return true;
}


/* "Siteactions" => "Create new page" openwindow handler*/
function VWCreatePage()
{
    try {
        OpenCreateWebPageDialog('/_layouts/createwebpage.aspx');
        window.setTimeout(IsDlgOpen, 500);        
	}
    catch (e) 
    {
		alert(e);
	}
}

function IsDlgOpen() {
    if (SP.UI.ModalDialog.get_childDialog() == null) {        
        window.document.location.href = window.document.location.href;
    }
    else {
        window.setTimeout(IsDlgOpen, 500);
    }    
}

function ShowRef(intTMP) {
    var objRoot = document.getElementById("dvPanel");
    var i = 0;
    while (i < objRoot.childNodes.length) {
        if (objRoot.childNodes[i].nodeType == 1) {
            objRoot.childNodes[i].style.display = "none";
        }        
        i++;
    }
    
    var objDiv = document.getElementById("div" + intTMP);
    objDiv.style.display = "block";    
}
