﻿// SkinService Object
function cSkinService() {
    this._baseURL = "www.myorderdesk.com";
    this._QS = location.search.substring(1,location.search.length);
    if (this._QS) {
	    this.params = new Object();
	    this._QS = this._QS.replace(/\+/g, ' ');
	    var args = this._QS.split('&'); // parse out name/value pairs separated via &
	    for (var i=0;i<args.length;i++) { // split out each name=value pair
		    var value;
		    var pair = args[i].split('=');
		    var name = unescape(pair[0]);
            value = (pair.length == 2) ? unescape(pair[1]) : name;
		    this.params[name] = value;
	    }
        this._locationID = (this.params["L"]) ? this.params["L"] : '';
        this._providerID = (this.params["P"]) ? this.params["P"] : 0;
        this._userID = (this.params["U"]) ? this.params["U"] : 0;
        this._groupID = (this.params["G"]) ? this.params["G"] : 0;
        this._jobID = (this.params["J"]) ? this.params["J"] : 0;
        this._itemID = (this.params["I"]) ? this.params["I"] : 0;
        this._orderformID = (this.params["O"]) ? this.params["O"] : 0;
        this._processTag = (this.params["ProcessTag"]) ? this.params["ProcessTag"] : '';
        this._browse = (this.params["Browse"]) ? this.params["Browse"] : '';
    }
}

cSkinService.prototype._QS;
cSkinService.prototype._locationID;
cSkinService.prototype._providerID;
cSkinService.prototype._userID;
cSkinService.prototype._jobID;
cSkinService.prototype._groupID;
cSkinService.prototype._itemID;
cSkinService.prototype._orderformID;
cSkinService.prototype._processTag;
cSkinService.prototype._browse;
cSkinService.prototype._baseURL;

cSkinService.prototype.GetTargetURL = function() {
    var url, urlArgs;
    switch (this._locationID) {
        case 'J':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._jobID > 0) urlArgs += (urlArgs) ? "&Job_ID=" + this._jobID : "Job_ID=" + this._jobID;
            url = 'http://' + this._baseURL + '/JobDetailsOrder.asp?' + urlArgs;
            break;
        case 'JA':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._jobID > 0) urlArgs += (urlArgs) ? "&Job_ID=" + this._jobID : "Job_ID=" + this._jobID;
            url = 'http://' + this._baseURL + '/JobDetailsApprover.asp?' + urlArgs;
            break;
        case 'JF':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._jobID > 0) urlArgs += (urlArgs) ? "&Job_ID=" + this._jobID : "Job_ID=" + this._jobID;
            url = 'http://' + this._baseURL + '/JobDetailsDownload.asp?' + urlArgs;
            break;
        case 'JC':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._jobID > 0) urlArgs += (urlArgs) ? "&Job_ID=" + this._jobID : "Job_ID=" + this._jobID;
            url = 'http://' + this._baseURL + '/JobDetailsContacts.asp?' + urlArgs;
            break;
        case 'JH':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._jobID > 0) urlArgs += (urlArgs) ? "&Job_ID=" + this._jobID : "Job_ID=" + this._jobID;
            url = 'http://' + this._baseURL + '/JobDetailsDiary.asp?' + urlArgs;
            break;
        case 'JP':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._jobID > 0) urlArgs += (urlArgs) ? "&Job_ID=" + this._jobID : "Job_ID=" + this._jobID;
            url = 'http://' + this._baseURL + '/JobDetailsProof.asp?' + urlArgs;
            break;
        case 'R':
            if (this._providerID > 0) urlArgs = "&Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/MyJobs.asp?View=R' + urlArgs;
            break;
        case 'T':
            if (this._providerID > 0) urlArgs = "&Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/MyJobs.asp?View=M' + urlArgs;
            break;
        case 'S':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/Settings.asp?' + urlArgs;
            break;
        case 'P':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/MyPackage.asp?' + urlArgs;
            break;
        case 'I':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/BillingInfo.asp?' + urlArgs;
            break;
        case 'B':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._orderformID > 0) urlArgs += (urlArgs) ? "&OrderFormID=" + this._orderformID : "OrderFormID=" + this._orderformID;
            if (this._processTag) urlArgs += (urlArgs) ? "&ProcessTag=" + this._processTag : "ProcessTag=" + this._processTag;
            if (this._browse) urlArgs += (urlArgs) ? "&Browse=" + this._browse : "Browse=" + this._browse;
            url = 'http://' + this._baseURL + '/JobSubmit.asp?' + urlArgs;
            break;
        case 'BR':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._jobID > 0) urlArgs += (urlArgs) ? "&Job_ID=" + this._jobID : "Job_ID=" + this._jobID;
            url = 'http://' + this._baseURL + '/JobFilesReceived.asp?' + urlArgs;
            break;
        case 'U':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._userID > 0) urlArgs += (urlArgs) ? "&User=" + this._userID : "User=" + this._userID;
            url = 'http://' + this._baseURL + '/VIPZonesUser.asp?' + urlArgs;
            break;
        case 'C':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/Charges.asp?' + urlArgs;
            break;
        case 'W':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/HomePage_WebLink.asp?' + urlArgs;
            break;
        case 'H':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/HomePageAddress.asp?' + urlArgs;
            break;
        case 'F':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/SetupOptions.asp?' + urlArgs;
            break;
        case 'L':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._groupID > 0) urlArgs += (urlArgs) ? "&GroupID=" + this._groupID : "GroupID=" + this._groupID;
            url = 'http://' + this._baseURL + '/UserLogin.asp?' + urlArgs;
            break;
        case 'AL':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._groupID > 0) urlArgs += (urlArgs) ? "&GroupID=" + this._groupID : "GroupID=" + this._groupID;
            if (this._QS > 0) urlArgs += (urlArgs) ? "&" + this._QS : this._QS;
            url = 'http://' + this._baseURL + '/UserLogin.asp?' + urlArgs;
            break;
        case 'N':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._groupID > 0) urlArgs += (urlArgs) ? "&GroupID=" + this._groupID : "GroupID=" + this._groupID;
            url = 'http://' + this._baseURL + '/UserSignup.asp?' + urlArgs;
            break;
        case 'Z':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._groupID > 0) urlArgs += (urlArgs) ? "&GroupID=" + this._groupID : "GroupID=" + this._groupID;
            url = 'http://' + this._baseURL + '/Home.asp?' + urlArgs;
            break;
        case 'O':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            if (this._itemID > 0) urlArgs += (urlArgs) ? "&InventoryItemID=" + this._itemID : "InventoryItemID=" + this._itemID;
            url = 'http://' + this._baseURL + '/DocMart.asp?' + urlArgs;
            break;
        case 'Q':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/Logout.asp?' + urlArgs;
            break;
        case 'RH':
            if (this._providerID > 0) urlArgs = "Provider_ID=" + this._providerID;
            url = 'http://' + this._baseURL + '/RegisterHelper.asp?framed=1&' + urlArgs;
            break;
            /*
        default:
            if (this._providerID > 0) urlArgs = 'Provider_ID=' + this._providerID;
            url = 'http://' + this._baseURL + '/home.asp?' + urlArgs;
            break;
            */
    }
    return url;
}
