function swapImage(imageCount) {
    var whichImage = imageCount.no % 7;
    var nextImage = (imageCount.no + 1) % 7;
    //console.info(nextImage);
    if (whichImage != 7) {
        $("#image" + nextImage).fadeIn(900);
        $("#image" + nextImage).css("display", "block");
        $("#image" + whichImage).fadeOut(900);
    }
    else
        $("#image" + nextImage).fadeIn(900);
    imageCount.no += 1;
}

function ImageCount(theCount) {
    this.no = theCount; //this is an object so it can be altered inside a function as I couldn't seem to do it by returning the amended number from a function
}

jQuery(document).ready(function () {

    var imageCount = new ImageCount(0);
    imageCount.no = (Math.floor(Math.random() * 7));
    $("#image" + imageCount.no).css("display", "block");
    setInterval(function () { swapImage(imageCount) }, 6000);
});

function clearText() {
    s.value = ""
}

function resetText() {
    if (s.value == "")
        s.value = "search..."
}
