

function getCookie(c_name)
{
    found=false;
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=");
        if (c_start!=-1)
        {
            found= true;
        }
    }
    return found;
}
function trackWhitepaper(whitepaperName){
    if(getCookie('codero-whitepapers-'+whitepaperName.toString())== true ){
        switch(whitepaperName){
            case 'pci-compliance-whitepaper':
                if(typeof dcsMultiTrack =='function')
                    dcsMultiTrack('DCS.dcsuri','/docs/whitepapers/pci-compliance-whitepaper.pdf','WT.ti','PCI Compliance Whitepaper');
								// at 20110607 by Marcelino - trackEvent affects bounce rate because GA take it as page view
                //_gaq.push(['_trackEvent', 'Whitepaper Downloads', 'Downloaded', 'PCI Compliance Whitepaper']);
                break;
            case 'managed-whitepaper':
                if(typeof dcsMultiTrack =='function')
                    dcsMultiTrack('DCS.dcsuri','/docs/whitepapers/managed-whitepaper.pdf','WT.ti','Managed Whitepaper');
								// at 20110607 by Marcelino - trackEvent affects bounce rate because GA take it as page view
                //                _gaq.push(['_trackEvent', 'Whitepaper Downloads', 'Downloaded', 'Managed Whitepaper']);
                break;
            case 'cobrand-codero-spend-less-while-improving-data-protection_wp_e':
                if(typeof dcsMultiTrack =='function')
                    dcsMultiTrack('DCS.dcsuri','/docs/whitepapers/cobrand-codero-spend-less-while-improving-data-protection_wp_e.pdf','WT.ti','Spend Less While Improving Data Protection Whitepaper');
								// at 20110607 by Marcelino - trackEvent affects bounce rate because GA take it as page view
                //                _gaq.push(['_trackEvent', 'Whitepaper Downloads', 'Downloaded', 'Spend Less While Improving Data Protection Whitepaper']);
                break;
            case 'Codero-dollars-sense_wp_en_w':
                if(typeof dcsMultiTrack =='function')
                    dcsMultiTrack('DCS.dcsuri','/docs/whitepapers/Codero-dollars-sense_wp_en_w.pdf','WT.ti','Dollars and Sense of Online Backup Whitepaper');
								// at 20110607 by Marcelino - trackEvent affects bounce rate because GA take it as page view
                //                _gaq.push(['_trackEvent', 'Whitepaper Downloads', 'Downloaded', 'Dollars and Sense of Online Backup Whitepaper']);
                break;
            default:
                if(typeof dcsMultiTrack =='function')
                    dcsMultiTrack('DCS.dcsuri','/docs/whitepapers/'+whitepaperName.toString()+'.pdf','WT.ti',whitepaperName.toString()+'.pdf');
								// at 20110607 by Marcelino - trackEvent affects bounce rate because GA take it as page view
                //                _gaq.push(['_trackEvent', 'Whitepaper Downloads', 'Downloaded', whitepaperName.toString()+'.pdf']);
        }
    }
}

$(document).ready(function(){
    //cobrand-codero-spend-less-while-improving-data-protection_wp_e.pdf start
    $('#spend-less-while-improving-data-protection-download').submit(function(){
        trackWhitepaper('cobrand-codero-spend-less-while-improving-data-protection_wp_e');
    });
    $('#cobrand-codero-spend-less-while-improving-data-protection_wp_en').submit(function(){
        trackWhitepaper('cobrand-codero-spend-less-while-improving-data-protection_wp_e');
    });
    //cobrand-codero-spend-less-while-improving-data-protection_wp_e.pdf end
    //Codero-dollars-sense_wp_en_w.pdf start
    $('#dollars-sense-download').submit(function(){
        trackWhitepaper('Codero-dollars-sense_wp_en_w');
    });
    $('#Codero-dollars-sense_wp_en_w').submit(function(){
        trackWhitepaper('Codero-dollars-sense_wp_en_w');
    });
    //Codero-dollars-sense_wp_en_w.pdf end
    //pci-compliance-whitepaper.pdf start
    $('#pci-compliance-whitepaper-download').submit(function(){
        trackWhitepaper('pci-compliance-whitepaper');
    });
    $('#pci-compliance-whitepaper').submit(function(){
        trackWhitepaper('pci-compliance-whitepaper');
    });
    //pci-compliance-whitepaper.pdf end
    //managed-whitepaper.pdf start
    $('#managed-whitepaper-download').submit(function(){
        trackWhitepaper('managed-whitepaper');
    });
    $('#managed-whitepaper').submit(function(){
        trackWhitepaper('managed-whitepaper');
    });
    //managed-whitepaper.pdf end
    $('#down_btn').click(function()
    {
        $("#pop-download").show('slow');
        return false;
    });
    $('.addthis_separator').removeClass('hide');
    $('#close_btn').click(function()
    {
								// at 20110607 by Marcelino - trackEvent affects bounce rate because GA take it as page view
                //        _gaq.push(['_trackEvent', 'Whitepaper Downloads', 'Download Window', 'Closed']);
        $("#pop-download").hide();
        return false;
    });
        
    if($('#swpaper_fullname'))$('#swpaper_fullname').focus();
    if(typeof(download_whitepaper)!='undefined' && download_whitepaper != '')
        $('#'+download_whitepaper.toString()).submit();
});
