function hbxMediaPlay(hbxFileName, hbxCurrentPos, hbxEndPos, hbxFlashVersion) {
/*
alert('hbxFileName:'+hbxFileName);
alert('hbxCurrentPos:'+hbxCurrentPos);
alert('hbxEndPos:'+hbxEndPos);
alert('hbxFlashVersion:'+hbxFlashVersion);
*/
_hbSet('m.f',hbxFileName);
_hbSet('m.cp',hbxCurrentPos);
_hbSet('m.ep',hbxEndPos);
_hbSet('m.s','play');
_hbSet('m.cl','Flash Player');
_hbSet('m.cv',hbxFlashVersion);
_hbSet('m.tt','e');
_hbSend();
}

function hbxMediaPause(hbxFileName, hbxCurrentPos, hbxEndPos, hbxFlashVersion) {
/*
alert('hbxFileName:'+hbxFileName);
alert('hbxCurrentPos:'+hbxCurrentPos);
alert('hbxEndPos:'+hbxEndPos);
alert('hbxFlashVersion:'+hbxFlashVersion);
*/
_hbSet('m.f',hbxFileName);
_hbSet('m.cp',hbxCurrentPos);
_hbSet('m.ep',hbxEndPos);
_hbSet('m.s','pause');
_hbSet('m.cl','Flash Player');
_hbSet('m.cv',hbxFlashVersion);
_hbSet('m.tt','e');
_hbSend();

}

function hbxMediaStop(hbxFileName, hbxCurrentPos, hbxEndPos, hbxFlashVersion ) {
/*
alert('hbxFileName:'+hbxFileName);
alert('hbxCurrentPos:'+hbxCurrentPos);
alert('hbxEndPos:'+hbxEndPos);
alert('hbxFlashVersion:'+hbxFlashVersion);
*/
_hbSet('m.f',hbxFileName);
_hbSet('m.cp',hbxCurrentPos);
_hbSet('m.ep',hbxEndPos);
_hbSet('m.s','stop');
_hbSet('m.cl','Flash Player');
_hbSet('m.cv',hbxFlashVersion);
_hbSet('m.tt','e');
_hbSend();
}

function hbxMediaPlayProgress(hbxFileName, hbxCurrentPos, hbxEndPos, hbxFlashVersion) {
_hbSet('m.f',hbxFileName);
_hbSet('m.cp',hbxCurrentPos);
_hbSet('m.ep',hbxEndPos);
_hbSet('m.s','playp');
_hbSet('m.cl','Flash Player');
_hbSet('m.cv',hbxFlashVersion);
_hbSet('m.tt','e');
_hbSend();
}


function hbxMediaPlayTrackPath( mediaFilename ) {
    //var doctitle=document.title; //eval("document.title");
    var myURL = parseUrl(document.URL); // hosting page
    var cat = "";

    if (document.getElementsByName("scPath").length > 0)
    {
        cat = document.getElementsByName("scPath")[0].content; // /sitecore/content/Home
        cat = cat.replace("/sitecore/content/Home", "");
        if (cat.length==0) cat="HOME"; // home page
    }
    else { cat = myURL.path; } // /sitecore/content/Home

    // Just use the file name and ditch the full URL path
    var shortMediaFilename = parseUrl(mediaFilename).file;
    _hbSet('n', shortMediaFilename );
    // Most Request Content Category drill down report based on SC path
    _hbSet('vcon', '::' + cat);
    // Custom Report based on page URL
    _hbSet('c1', cat +  " (" + myURL.path + myURL.file + ")|" + shortMediaFilename  );
    _hbSend();
}


function parseUrl(data) {
    var e=/((http|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+\.[^#?\s]+)(#[\w\-]+)?/;

    if (data.match(e)) {
        return  {url: RegExp['$&'],
                protocol: RegExp.$2,
                host:RegExp.$3,
                path:RegExp.$4,
                file:RegExp.$6,
                hash:RegExp.$7};
    }
    else {
        return  {url:"", protocol:"",host:"",path:"",file:"",hash:""};
    }
}

