/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/*
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
*/

//ab testing logic
$(document).ready(function() {
    /*
    var cookie = $.cookie("abtest");
    
    if (cookie != null)
    {
        //hide header and footer
        $('#shopContainer .shopContainerInner .leftContainer .column1').css('margin-left', '160px');
        $('#shopContainer .shopContainerInner .leftContainer .column2').css('display', 'none');
        $('#shopContainer .shopContainerInner .leftContainer .column3').css('display', 'none');
        $('#shopContainer .shopContainerInner .leftContainer .column4').css('display', 'none');
        $('#bottomContainer').css('display', 'none');
        $('#bottomNavigation').css('display', 'none');
        
        //hide switzerland and austria flag on order page
        $('#topColGenRightColumn').find('table:first td:eq(1)').css('display', 'none');
        $('#topColGenRightColumn').find('table:first td:eq(2)').css('display', 'none');
        
        //alter order.aspx urls on homepage
        $('.topNav ul:first-child li:last a').attr('href', 'http://fp.jaron.de/track/click/A3114/ID8694?url=http://www.proactivsolution.de/order.aspx');
        $('.topMiddleConRight map:last area').attr('href', 'http://fp.jaron.de/track/click/A3114/ID8694?url=http://www.proactivsolution.de/order.aspx');
    }
    */
    
    var host = window.location.host;
    var pathname = window.location.pathname;
    var currentUrl = "http://" + host + pathname;
    
    //live
    if (currentUrl == "http://www.proactivsolution.de/"
        || currentUrl == "http://www.proactivsolution.de/default.aspx")
    {
        $('.topNav ul:first-child li:last a').attr('href', 'http://fp.jaron.de/track/click/A3114/ID8694?url=http://www.proactivsolution.de/order.aspx');
        $('.topMiddleConRight map:last area').attr('href', 'http://fp.jaron.de/track/click/A3114/ID8694?url=http://www.proactivsolution.de/order.aspx');
    }
    
    //staging
    if (currentUrl == "http://staging.proactivsolution.de/"
        || currentUrl == "http://staging.proactivsolution.de/default.aspx")
    {
        $('.topNav ul:first-child li:eq(1) a').attr('href', 'http://fp.jaron.de/track/click/A3114/ID8694?url=http://staging.proactivsolution.de/order.aspx');
    }
});