$(function() {

$("#testimonial-cycle").after('<div id="cycle_nav">').cycle({
        fx:'fade',
        speed:500,
        timeout:15000,
        pager:'#cycle_nav',
        cleartypeNoBg: true
    });

    $footerWoman = $("#footer-woman");

    $(window).resize(function(){
        footerWoman();
    });

    footerWoman();

    function footerWoman() {
        var h = $(window).height();
        var w = $(window).width();
        var newWidth = w-(w*0.31);
        $footerWoman.css("left",newWidth+"px"); 
    }

    $("#testimonials-table div:even").addClass("testimonials-block-alt");

    $(".inputRow:even .inputLabel").addClass("inputRowAlt");
    $(".inputBRow:even .inputBLabel").addClass("inputRowAlt");

});

var partnercode="";
var ckpartnercode="";

function AffiliateTrack() {

var ckpartnercode = tGetCookie("AFFILIATE");

    var fbit = '';
     var args = location.search;
      if (args.charAt(0) == '?')
       {
           fbit = args.substring(1);
           if (!fbit.match("=")) 
            {
             partnercode = fbit.replace(/[^0-9]/gi, "");
                if (!ckpartnercode) {
                document.cookie = "AFFILIATE=" + partnercode + ";expires=Friday,25-Feb-2020 12:00:00 GMT";
                }
            }
       }

    if (partnercode) 
    {
        var referrer = document.referrer;
        referrer = referrer.toLowerCase(); 
        if (!referrer.match("attractant.co")) 
        {
        var trackurl = '<img src="http://www.attractant.co.uk/pheromones/track.cgi?prg=phero&affil=' + partnercode + '" height=1 width=1>';
        document.write(trackurl);
        //alert("just working on our affiliate system - please click OK and ignore this message. DEBUG: " + partnercode + ":" + ckpartnercode);
        }       
    }

}

function tGetCookie( Name )
{
    var Len = Name.length;
    var i = 0;
    while( i < document.cookie.length )
    {
    var j = i + Len + 1;
    if( document.cookie.substring( i, j) == (Name + "=") )
    return tGetValue( j );
    i = document.cookie.indexOf( " ", i ) + 1;
    if( i == 0)
    break;
    }
    var a = "";
    return a;
}
function tGetValue( Offset )
{
    var End = document.cookie.indexOf (";", Offset);
    if( End == -1 )
    End = document.cookie.length;
    return unescape( document.cookie.substring( Offset, End) );
}
