﻿/* 
---------------------------------------------------------------------------------------------------------------------
This code is placed by Biscardi Associates, Inc as a part of the purlME program
---------------------------------------------------------------------------------------------------------------------
*/
function pushToPurlFrame() {
    /*
    this purl will grab the right-most forward slash (/) and then check to see if there 
    is a reference to a page, if not, then it is probably a pURL, so continue
    */
    //grab the URL 
    var strString = self.location.href;

    //set the variables 
    var strDomainName = "BiscardiAssociates.com";
    var strErrorPageURL = "test.aspx";
    var strRecordID = "";

    //strip off 'https', 'http', 'www.', '127.0.0.1/'
    strString = strString.replace("https://", "")
    strString = strString.replace("http://", "")
    strString = strString.replace("www.", "")
    strString = strString.replace("127.0.0.1/", "")

    //use the / to string the string into two parts 
    strString = strString.split("/")

    //the length of the new string array has to be two, otherwise, do nothing
    if (strString.length = 2) {
        //populate the strPURLID variable with the second index of the strString array
        strRecordID = strString[1];

        //now redirect to our website
        if (strRecordID != "") {
            //document.getElementById("frmPurl").src = "https://www.purlME.com/capture/_.aspx?d=" + strDomainName + "&r=" + strRecordID;
            //document.getElementById("frmPurl").src = "http://www.purlME.com/capture/_.aspx?d=" + strDomainName + "&r=" + strRecordID;
            document.getElementById("frmPurl").src = "http://127.0.0.1/purlME/capture/_.aspx?d=" + strDomainName + "&r=" + strRecordID;
        }
        else {
            document.location.href = strErrorPageURL;
        }
    }
}
/* 
---------------------------------------------------------------------------------------------------------------------
This code is placed by Biscardi Associates, Inc as a part of the purlME program
---------------------------------------------------------------------------------------------------------------------
*/ 


