function getCookie(value) {
    var dc = document.cookie;
    var prefix = value + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
    } else {
    begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
    end = dc.length;
    }
    return dc.substring(begin + prefix.length, end);
}


function doTSA_Tracking()
{
   var TSA_OptOut = getCookie("TSA_OptOut");
   if (TSA_OptOut && TSA_OptOut!=null && TSA_OptOut=='true') return false
   else return true;
}

var expdate=new Date();
expdate.setDate(expdate.getDate()+365);

function writeTSA() {
var div = "<input type='checkbox' id='TSA_OptOut' value='true' onClick='this.checked?document.cookie=\"TSA_OptOut=false;path=/;expires="+expdate.toGMTString()+";\":document.cookie=\"TSA_OptOut=true;path=/;expires="+expdate.toGMTString()+";\"'> <label for='TSA_OptOut'>Besuch mit <a href='http://www.tobsolution.de/allgemein/piwik-opensource-alternative-zu-google-analytics' title='Beitrag zu Piwik auf tobsolution.de' target='_blank'>Piwik</a> tracken.</label>";
document.getElementById("TSA_OptOutSwitch").innerHTML = div;
}