function CliGetProfileName()
{
    return "sky_prod";
}

function CliGetProfileAuthToken()
{
    return 'sky_prod | *.sky.com,*.vod.sky.com | urn:kid:sky:';
}

function CliGetProfileAuthSig()
{
    return '1FyYfpPCZ2buRjIK7pHRTWZ475g1UmfUg+satWr5vA92uW+QTzja/SJpODLwCdE5V/n/q594IMEBIHvXNp58tcmMJEhL5x0YrQaPXKWZWrPQekDcxBXJfjhW9guasjL1r7foUM5ytaIGzudbUB6EIeFny4/Gr1pbpORo8C5B1Vs=';
}

function CliBuilOnlineUrl( urlSegment, useBrowserDomain )
{
    if (useBrowserDomain==null)
        useBrowserDomain=false;
        
    var domain = useBrowserDomain ? CliGetBrowserDomain() : CliGetClientDomain();
    return domain + CliGetAppRoot() + urlSegment;
}

function CliCoerceUrlScheme(url, scheme)
{
    ///<summary>Takes a url and replaces the scheme with the specified scheme.
    ///If no scheme is supplied, the current page scheme is used</summary>

    if(scheme == null)
        scheme = document.location.protocol;

    var urlBody;
    if(url.substring(0, 5) == "http:")
        urlBody = url.substring(5);
    else
        urlBody = url.substring(6);

    return scheme + urlBody;
}

function CliGetClientDomain()
{
    return "http://anytimepc-client.sky.com"; 
}

function CliGetBrowserDomain()
{
    return "http://skyplayer.sky.com"; 
}

function CliGetAppRoot()
{
    return "/vod";
}

var CliErrorAction_Download     = 1;
var CliErrorAction_General      = 2;
var CliErrorAction_Bookmark     = 3;
var CliErrorAction_SetPcName    = 4;
var CliErrorAction_Delete       = 5;

function CliDisplayError( errorAction, errorCode )
{
    try{ hide_waiting(); } catch( e ){}
    
    var errorMessage;
    
    if( errorCode == null || errorAction == null )
    {
        errorMessage = "Unspecified error occurred [?].";
    }
    else
    {
        switch( errorAction )
        {
            case CliErrorAction_Download:  errorMessage = "Sorry, Sky Player has encountered a problem starting your download.\n"; break;
            case CliErrorAction_Bookmark:  errorMessage = "Sorry, Sky Player has encountered a problem bookmarking your item.\n"; break;
            case CliErrorAction_SetPcName: errorMessage = "Sorry, Sky Player has encountered a problem completing your installation.\n"; break;
            case CliErrorAction_Delete:    errorMessage = "Sorry, Sky Player has encountered a problem deleting your item.\n"; break;


            case CliErrorAction_General:  errorMessage = "There has been a problem with Sky Player.\n"; break;
            
            default: errorMessage = "Sky Player has encountered a problem.\n"; break;
        }
        
        if( errorCode < 1 )
            errorCode *= -1;
            
        switch( errorCode )
        {
            case  1  : errorMessage += "Your Sky Player software did not start up correctly.  Please exit Sky Player and try again.  If the problem persists, try re-starting your computer.  If it still persists call Customer Services on 08442 411 599 and tell them 'download manager initialisation failed', quoting the code"; break;
            case  2  : errorMessage += "Setting(s) are not available. Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  3  : errorMessage += "Settings appear invalid. Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  4  : errorMessage += "Saving settings failed. Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  5  : errorMessage += "Loading initialisation settings failed. Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  6  : errorMessage += "It was not possible to load the installation configuration file. Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  7  : errorMessage += "It was not possible to load the subscriber settings. Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  8  : errorMessage += "Failed To Create TraceFile. Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  9  : errorMessage += "The item is already in the library."; break; 
            case  10 : errorMessage += "You have reached the limit on the number of bookmarks you can have.  Please remove some old bookmarks and try again"; break;
            case  11 : errorMessage += "Please exit Sky Player and try again.  If the problem persists try rebooting your computer or call Customer Services on 08442 411 599 quoting the code"; break;
            case  12 : errorMessage += "This item should already be in your Library.  Please check and if it's not, exit Sky Player and try again.  If the problem persists try rebooting your computer or call Customer Services on 08442 411 599 quoting the code"; break;
            case  13 : errorMessage += "You've reached the limit of the number of videos you can download at one time.  Hint: bookmark this item so you can easily find it and download it later."; break;
            case  14 : errorMessage += "The download is not allowed. Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  19 : errorMessage += "There was a problem with your Download Destination (where your downloads sit on your PC).  Go to Accounts and Settings to check your Download Destination is set to your hard drive.   If the problem persists, please call Customer Services on 08442 411 599 and quote code "; break;
            case  21 : errorMessage += "You do not have enough free disk space to download this video.  Go to Accounts and Settings to choose a new Download Destination, or delete some old videos from your Library, and try again"; break;
            case  22 : errorMessage += "Some of the characters of your PC friendly name are invalid. Please re-try with letters A-Z."; break;
            case  23 : errorMessage += "There was a problem processing your PIN.  Please exit Sky Player and try again.  If the problem persists try rebooting your computer or call Customer Services on 08442 411 599 quoting the code"; break;
            case  24 : errorMessage += "Please exit Sky Player and try again.  If the problem persists try rebooting your computer or call Customer Services on 08442 411 599 quoting the code"; break;
            case  30 : errorMessage += "Please exit Sky Player and try again.  If the problem persists try rebooting your computer or call Customer Services on 08442 411 599 quoting the code"; break;
            case  31 : errorMessage += "Please exit Sky Player and try again.  If the problem persists try rebooting your computer or call Customer Services on 08442 411 599 quoting the code"; break;
            case  32 : errorMessage += "Please exit Sky Player and try again.  If the problem persists try rebooting your computer or call Customer Services on 08442 411 599 quoting the code"; break;


            case  10000 : errorMessage += "Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  10001 : errorMessage += "Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  10003 : errorMessage += "Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  10004 : errorMessage += "There is a problem pausing your download.  Please exit Sky Player and try again.  If the problem persists call Customer Services on 08442 411 599 quoting the code"; break;
            case  10005 : errorMessage += "There is a problem pausing your download.  Please exit Sky Player and try again.  If the problem persists call Customer Services on 08442 411 599 quoting the code"; break;
            case  10006 : errorMessage += "There is a problem resuming your download.  Please exit Sky Player and try again.  If the problem persists call Customer Services on 08442 411 599 quoting the code"; break;
            case  10007 : errorMessage += "There is a problem resuming your download.  Please exit Sky Player and try again.  If the problem persists call Customer Services on 08442 411 599 quoting the code"; break;
            case  10008 : errorMessage += "Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  10009 : errorMessage += "Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  10010 : errorMessage += "It's not possible to sort this column"; break;
            case  10011 : errorMessage += "Please allow the download to complete."; break;
            case  10012 : errorMessage += "Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  10013 : errorMessage += "Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;
            case  10015 : errorMessage += "Please exit Sky Player, re-start your PC and try again. \nIf the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break;

            // duplicate from LicenseAquisitionPage, for completion
            case  20000 : errorMessage += "This video needs a permission for you to be able to watch it, and it seems this has either expired or has not yet been delivered to your computer.  Please exit Sky Player and try again.  If the problem persists call Customer Services on 08442 411 599 quoting the code"; break;
            case  20001 : break; // this is for general errors that we dont want to tell the user much about.  typicially with CliErrorAction_General
            
            default: errorMessage += "Please exit Sky Player, re-start your PC and try again. \n If the problem persists, please call Customer Services on 08442 411 599 and quote the following error code."; break; 
        }
        
        errorMessage += " [" + errorCode + "]";
    }
    
    alert( errorMessage );
}

function CliIsDebug()
{
    return false;
}

function CliDebug(message)
{
//    if (CliIsDebug())
//        alert(message);
}
