﻿
function setVisible(obj) 
{
    obj = document.getElementById(obj);
    obj.style.visibility = 'hidden';
    return;
    obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}

var CanPostBack = true;
var is2ndSubmit = false;
window.onbeforeunload = canSubmit;

function ExpiredEvent() {
    alert("Event is Expired.Cannot Process");
    return false;
}

function test(id) {
    var obj = document.getElementById("displayNews_hidNewsId");
    var btn = document.getElementById("displayNews_btnNewsId");
    obj.value = id;
    btn.click();
}
function ShowMenu() {
    document.getElementById("toolbarMenu").style.visibility = 'visible';
}
function HideMenu() {
    document.getElementById("toolbarMenu").style.visibility = 'hidden';
}


function cancelDblBeforeUnload() {
    // IE7 seems to call onbeforeunload twice
    // when a control does an auto post back
    // call this from body onmousemove to reset the form
    // is2ndSubmit = false;
}

function canSubmit() {
    // IE7 seems to call onbeforeunload twice
    // when a control does an auto post back                                                            
    // call this from body onbeforeunload to show message
    //  if (!is2ndSubmit) {
    //     is2ndSubmit = true;                
    if (!CanPostBack)
        return "You have made changes to the data and will lose these if you continue.";
}

function SetPostback(bln) {
    CanPostBack = bln;
}

function setNavItem(value) {
    if (document.forms[0].hidNavItem == null) return;
    document.forms[0].hidNavItem.value = value;
    return true;
}

function canDelete() {
    return confirm("Are you sure you want to delete the selected record ?")
}

function AccessDenied() {
    alert("You do not have rights to access this area")
    return false;
}


// ****************************************  //
//  START FOR LEFT COLUMN                    //
// ****************************************  //

function LC_loadRSTEmail() {
    var url = "RSTEmail/RSTEmail.aspx"
    wOptions = 'dependent=no,directories=no,location=no,';
    wOptions += 'menubar=no,personalbar=no,status=no,resizable=yes,';
    wOptions += 'titlebar=no,toolbar=no,scrollbars=yes,width=605,height=560';
    var win = window.open(url, 'windowRSTemail', wOptions);
    win.focus();
    return false;
}

function LC_InviteBuddies() {
    var url = "DefaultPopUp.aspx?";
    url += "commandName=inviteBuddiesCommand";

    wOptions = 'dependent=no,directories=no,location=no,';
    wOptions += 'menubar=no,personalbar=no,status=no,';
    wOptions += 'titlebar=no,toolbar=no,scrollbars=no,width=605,height=200';

    var win = window.open(url, '_previewPopup', wOptions);
    win.focus();
    return false;
}
function LC_SetEvent(id, hidEventId, btnEventsId) {
    var hidEvent = document.getElementById(hidEventId)
    hidEvent.value = id;
    document.getElementById(btnEventsId).click();
}

function LC_SetStage(id, hidStageId, btnStageId) {
    var hidStage = document.getElementById(hidStageId)
    hidStage.value = id;
    document.getElementById(btnStageId).click();
}

// ****************************************  //
//  END FOR LEFT COLUMN                    //
// ****************************************  //


// ****************************************  //
//  START FOR SEARCH CONTACT                 //
// ****************************************  //


// This is unused so far
function SC_isUserSelected(isLeader) {
    alert(isLeader);
    return true;
}

function SC_SetFocus(txtFirstNameId) {
    document.getElementById(txtFirstNameId).focus()
}

// ****************************************  //
//  END FOR SEARCH CONTACT                   //
// ****************************************  //


