// File: /include/js/Shared/Http/URL.js
// Desc: VM_URL
// $Revision: 6$
// $Date: 5/31/2007 10:03:16 AM$
// $Author: R.J. Plummer$
// $NoKeywords$


function VM_clsURL( targetService, rootIfWebServer )
{
    if (arguments.length > 1)
    {
        var baseUrl = location.protocol + "//" + location.host + rootIfWebServer;
        
        this.m_wxServerNumber = -1;
        
        this.WWW = baseUrl;
        this.WS1 = baseUrl + "/widgets/" + targetService + "/service.aspx";
        this.WS2 = this.WS1;
        this.WSS1 = this.WS1;
        this.WSS2 = this.WSS1;

        this.WX1 = baseUrl + "/wx/wx.aspx?/v2w";
        this.WX2 = this.WX1;
    }
    else
    {
        this.m_wxServerNumber = 0;
        
        this.WWW = "http://www.callwave.com";
        this.WS1 = "http://wxlb.callwave.com/widgets/" + targetService  + "/service.aspx";
        this.WS2 = this.WS1.replace( /callwave/, "gotpb" );
        this.WSS1 = this.WS1.replace( /http/, "https" );
        this.WSS2 = this.WS2; // gotpb doesn't have a certificate right now
        
        this.WX1 = "http://wx0.callwave.com/v2w";
        this.WX2 = this.WX1.replace( /callwave/, "gotpb" );
    }
}

VM_clsURL.prototype.setAccountNumber = function( accountNumber )
{
    if ( this.m_wxServerNumber >= 0 && this.m_wxServerNumber != accountNumber % 32 )
    {
        this.m_wxServerNumber = accountNumber % 32
        this.WX1 = "http://wx" + this.m_wxServerNumber + ".callwave.com/v2w";
        this.WX2 = this.WX1.replace( /callwave/, "gotpb" );
    }
}
