/* 
 * Scripts to be excuted on the home page only
 */

//AB test conversion tracking script
function ConversionCount()
{
    var gwoTracker=_gat._getTracker("UA-230706-6");
    gwoTracker._trackPageview("/3961380539/goal");
    return true;
}

$(document).ready(function(){
    $('.searchBox').keyup(function(){
        livePhoneSearch($(this).val(), 'large');
    })

    $('#searchForm').submit(function(){
        return checkSearch($('#search'));
    })

    $('.searchBox').click(function(){
        if( $(this).val() == 'Type your phone model here...' )
            $(this).val('')
    })

    // If user clicks anywhere outside text box, hide the suggestions box
    $(document).click(function(){
        $('#suggests').fadeOut(400);
    });

    // Make sure clicking on the text box itself doesnt hide the suggestions box
    $('.bigTextSearch').click(function(e){
        e.stopPropagation();
    });

    // Attach onfocus event on all <a> links so that there is none of that horrible marquee business around the links
    $('a, .bigSearchBtn').focus(function(){(this).blur()});

    $("#dealsContainer").scrollable({circular: true}).autoscroll({ autoplay: true, interval: 4500 });

    $("#sliderRecycler").scrollable({circular: true}).autoscroll({ autoplay: false });

    /*
    //For AB testing only - attach goal event for all links
    $('a, .bigSearchBtn').click(function(){
        return ConversionCount();
    })
    */
})


