﻿// JScript File
var g_Toolbar;
var g_Status;
var g_Data;
var g_Debug;

var g_Assessment1;
var g_Assessment2;
var g_Scheme;
var g_Compare1;
var g_Glossary;

g_Debug = false;

var LHU_SERVER_ADDRESS2 ="http://www.leaseholdersunited.com";


function doTelPress(e)
{
    var keynum;
    var keychar;
    var numcheck;


    if(window.event) 
    {
    keynum = e.keyCode;
    }
    else if(e.which)
    {
    keynum = e.which;
    }

    if (keynum == 8)
    {
    return(true);
    }

    keychar = String.fromCharCode(keynum);
    numcheck = /\d/;
    return(numcheck.test(keychar));
}

function ShowForums(PropertyID)
{
    var hwndForum;
    
    hwndForum = window.open(LHU_SERVER_ADDRESS2 + "/members/CostMINDER/Forums.aspx?PropertyID=" + PropertyID,"wForums","height=820,width=950,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndForum.focus();

}


function OpenUserGuide(GuideID)
{
    OpenUserGuide(GuideID,10,10,600,600);
}

function OpenUserGuide(GuideID,iT,iL,iW,iH)
{
    var hWnd;
    var strURL;
    
    strURL = LHU_SERVER_ADDRESS2 + "/ViewUserGuide.aspx?GuideID=" + GuideID;
    
    if (!iH)
    {
	    iH = 600;
    }
    if (!iW)
    {
	    iW = 600;
	}

    hWnd = window.open(strURL,"wGuide","height=" + iH + ",width=" + iW + ",resizable=yes,location=no,scrollbars=yes,toolbar=no,top=" + iT + ",left=" + iL);
    hWnd.focus();
}


function ShowApprovedSurveyors(PropertyID,TheType)
{
    var hwndApproved;
    
    hwndApproved = window.open(LHU_SERVER_ADDRESS2 + "/members/CostMINDER/SurveyorsRegional.aspx?Type=" + TheType + "&PropertyID=" + PropertyID,"wApproved","height=600,width=950,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndApproved.focus();

}


function ViewCostMinder(PropertyID)
{
    var hwndEdit;
    
    hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/CostMINDER/CostMinder.aspx?ToolID=1&PropertyID=" + PropertyID,"wCostMinder","height=625,width=950,resizable=0,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();

}

function ShowKnowledgebaseBR(PropertyID)
{
   ShowKB(PropertyID,5);
}

function ShowKnowledgebaseService(PropertyID)
{
    ShowKB(PropertyID,2);
}
function ShowKnowledgebaseInsurance(PropertyID)
{
    ShowKB(PropertyID,3);
}

function ShowKnowledgebaseSell(PropertyID)
{
    ShowKB(PropertyID,4);
}

function ShowKnowledgebaseRent(PropertyID)
{
    ShowKB(PropertyID,1);
}

function ShowKB(PropertyID,Type)
{
    var hwndEdit;
    
    hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/knowledgebase/KB_Free.aspx?KBT=" + Type + "&PropertyID=" + PropertyID,"wRates","height=600,width=950,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
}

function ViewUsergroup(PropertyID)
{
    var hwndEdit;
    
    hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/PropertyUsergroup.aspx?PropertyID=" + PropertyID,"wRates","height=600,width=750,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
}

function ShowDataWindow()
{

    if (g_Status)
    {
        g_Status.close();
    }
    
    g_Data = window.open(LHU_SERVER_ADDRESS2 + "/members/BATools/BAContent.aspx","wStatus","height=500,width=900,location=no,scrollbars=yes,menubar=no,toolbar=no,status=no");
    g_Data.moveTo(2,140);
    g_Toolbar.focus();
}

function AffiliateCode(PropertyID)
{
    var hWndAffiliate;
    
    hWndAffiliate = window.open(LHU_SERVER_ADDRESS2 + "/members/AffiliateProperty.aspx?PropertyID=" + PropertyID,"wAff","height=300,width=700,location=no,scrollbars=yes,menubar=no,status=no,toolbar=no");
    hWndAffiliate.focus();
    
}

function ViewReport(PropertyID)
{
    var hwndEdit;
    
    hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/reporting/FreeStartup.aspx?PropertyID=" + PropertyID,"wRates","height=600,width=750,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
}

function doMessaging(PropertyID)
{
    var hwndMes;
    
    hwndMes = window.open(LHU_SERVER_ADDRESS2 + "/members/lhuforum/LHUForum_Free.aspx?PropertyID=" + PropertyID,"wRates","height=600,width=975,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndMes.focus();
}

function PropertyReport(PropertyID)
{
    var hwndReport;
    
    hwndReport = window.open(LHU_SERVER_ADDRESS2 + "/members/avm/AVM_Free.aspx?PropertyID=" + PropertyID,"wReport","height=600,width=750,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndReport.focus();

}

function BusinessRatesReport(PropertyID)
{
    var hwndReport;
    
    hwndReport = window.open(LHU_SERVER_ADDRESS2 + "/members/BATools/BATools_Free.aspx?PropertyID=" + PropertyID,"wReport","height=600,width=750,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndReport.focus();

}

function SBRRTool(PropertyID,iRV)
{
    var hwndReport;
    
    hwndReport = window.open(LHU_SERVER_ADDRESS2 + "/members/BATools/BAToolbarSBR.aspx?Year=" + iRV + "&mode=SBRR&PropertyID=" + PropertyID,"wReport","height=250,width=750,location=no,scrollbars=no,menubar=no,status=no");
    hwndReport.focus();
}


function ProcessRates(PropertyID,BARef)
{
    var hwndRates;
    
    if (g_Debug)
    {
    	alert("Business Rates button pushed PropertyID=" + PropertyID +";BAREf=" + BARef); 
    }

    if (BARef != "")
    {
        // localhost:3245
        //g_Toolbar = window.open("http://" + LHU_SERVER_ADDRESS2 + "/members/BATools/BAToolbar.aspx?PropertyID=" + PropertyID,"wToolbar","height=225,width=900,location=no,scrollbars=yes,menubar=no,status=no,toolbar=no");
        g_Toolbar = window.open(LHU_SERVER_ADDRESS2 + "/members/BATools/BAToolbar.aspx?PropertyID=" + PropertyID,"wToolbar","height=400,width=900,location=no,scrollbars=yes,menubar=no,status=no,toolbar=no");
        g_Toolbar.moveTo(2,2);
        
    }
    else
    {
        g_Toolbar = window.open(LHU_SERVER_ADDRESS2 + "/members/BATools/BAFreeToolbar.aspx?PropertyID=" + PropertyID,"wToolbar","height=65,width=900,location=no,scrollbars=yes,menubar=no,status=no,toolbar=no");
        g_Toolbar.moveTo(2,2);
        
        g_Status = window.open(LHU_SERVER_ADDRESS2 + "/members/BATools/BAToolsStep1.aspx","wStatus","height=300,width=900,location=no,scrollbars=yes,menubar=no,toolbar=no,status=no");
        g_Status.moveTo(2,200);
        g_Toolbar.focus();
    }
}

function ShowSBR()
{
        
        g_Toolbar = window.open(LHU_SERVER_ADDRESS2 + "BAFreeToolbar.aspx","wToolbar","height=65,width=900,location=no,scrollbars=yes,menubar=no,status=no,toolbar=no");
        g_Toolbar.moveTo(2,2);
        
        g_Status = window.open(LHU_SERVER_ADDRESS2 + "BAToolsStep1.aspx","wStatus","height=300,width=900,location=no,scrollbars=yes,menubar=no,toolbar=no,status=no");
        g_Status.moveTo(2,200);
        g_Toolbar.focus();
}

function ProcessHelp(PropertyID)
{
    var hwndRates;
    
    hwndRates = window.open(LHU_SERVER_ADDRESS2 + "/members/RicsHelp.aspx?PropertyID=" + PropertyID,"wHelp","height=600,width=700,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndRates.focus();
}

function ViewCommunity(PropertyID)
{
    var hwndEdit;
    
    hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/CostMINDER/YourCommunity.aspx?ToolID=1&PropertyID=" + PropertyID,"wCostMinder","height=625,width=950,resizable=0,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();

}

function ViewEditProperty(PropertyID)
{
    ViewEditProperty(PropertyID,0);
}

function ViewEditProperty(PropertyID,IsCommunity)
{
    var hwndEdit;
    
    // alert(LHU_SERVER_ADDRESS2 + "/members/EditProperty.aspx?PropertyID=" + PropertyID);
   if (IsCommunity == 1)
    {
        hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/EditProperty2009.aspx?Community=1&PropertyID=" + PropertyID,"wRates","height=600,width=950,location=no,scrollbars=yes,menubar=no,status=yes");
        hwndEdit.focus();
    }
    else
    {
        hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/EditProperty2009.aspx?PropertyID=" + PropertyID,"wRates","height=600,width=950,location=no,scrollbars=yes,menubar=no,status=yes");
        hwndEdit.focus();
    }
    
}

function SubmitWorldpay()
{
    var frm1;
    var frm2;
    
    frm1 = document.forms[0];
    frm2 = document.forms[1];
    
    frm2.cartId.value = frm1.cartId_X.value;
    frm2.M_LHUUserID.value = frm1.M_LHUUserID_X.value;
    frm2.M_LHUItem.value = frm1.M_LHUItem_X.value;
    frm2.amount.value = frm1.amount_X.value;
    
    frm2.submit();
}
    
function ShowPayment()
{
    var hWnd;
    
    hWnd = window.open("/members/payment/PaymentSingleProperty.aspx","wWorldpay","height=600,width=800,location=no,scrollbars=yes,location=no,toolbar=no");
    hWnd.focus();
    
}

function ViewMessages(PropertyID)
{
    var hwndEdit;
    
    hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/ListMessages.aspx?PropertyID=" + PropertyID,"wRates","height=600,width=700,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
}

function SendMessage(PropertyID)
{
    var strURL = LHU_SERVER_ADDRESS2 + "/members/SendMessage.aspx?PropertyID=";
    var hwndEdit;
    
    hwndEdit = window.open(strURL + PropertyID,"wRates","height=600,width=700,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
}


// VOA Stuff
var g_Toolbar;
var g_Status;
var g_Data;

var g_Assessment1;
var g_Assessment2;
var g_Scheme;
var g_Compare1;
var g_Glossary;

function ShowDataWindow()
{

    if (g_Status)
    {
        g_Status.close();
    }
    
    g_Data = window.open(LHU_SERVER_ADDRESS2 + "/members/BATools/BAContent.aspx","wStatus","height=500,width=900,location=no,scrollbars=yes,menubar=no,toolbar=no,status=no");
    g_Data.moveTo(2,140);
    g_Toolbar.focus();
}

function AffiliateCode(PropertyID)
{
    var hWndAffiliate;
    
    hWndAffiliate = window.open(LHU_SERVER_ADDRESS2 + "/members/AffiliateProperty.aspx?PropertyID=" + PropertyID,"wAff","height=500,width=700,location=no,scrollbars=yes,menubar=no,status=no,toolbar=no");
    hWndAffiliate.focus();
    
}


function ProcessHelp(PropertyID)
{
    var hwndRates;
    
    hwndRates = window.open(LHU_SERVER_ADDRESS2 + "/members/RicsHelp.aspx?PropertyID=" + PropertyID,"wHelp","height=600,width=700,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndRates.focus();
}

function ViewEditProperty_OLD(PropertyID)
{
    var hwndEdit;
    
    hwndEdit = window.open("EditProperty.aspx?PropertyID=" + PropertyID,"wRates","height=600,width=750,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
    
}

function SendAffiliateMessage(AffID,AffType)
{
    alert(AffID);
    alert(AffType);
}

 function ViewMessage(MessageID)
{
    var hwndEdit;
    
    hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/members/ViewMessage.aspx?MessageID=" + MessageID,"wRates","height=600,width=700,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
}

function RespondToMessage(MessageID,UserID,PropertyID)
{
    var hwndEdit;
    
    hwndEdit = window.open(LHU_SERVER_ADDRESS2 + "/messaging/LHUResponder.aspx?PropertyID=" + PropertyID + "&MessageID=" + MessageID + "&UserID=" + UserID,"wRates","height=600,width=700,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
}

 function ViewEditProperty_OLD2(PropertyID)
{
    var hwndEdit;
    
    hwndEdit = window.open("EditProperty.aspx?PropertyID=" + PropertyID,"wRates","height=600,width=700,location=no,scrollbars=yes,menubar=no,status=yes");
    hwndEdit.focus();
    
}