﻿/// <reference path="jquery-1.3.2.min.js"/>
var arrImg1, arrImg2, arrImg3, lnkImg1, lnkImg2, lnkImg3, count1, count2, count3;

$(document).ready(function() {
    var uri = 'http://www.freshaccommodation.co.uk/';
    arrImg1 = new Array(uri + 'images/home-banners/airport-transfers.gif', uri + 'images/home-banners/cleaning-packs.gif');
    lnkImg1 = new Array(uri + 'bulgarian-airport-taxis.aspx', uri + 'property-cleaning-packages.aspx');
    
    arrImg2 = new Array(uri + 'images/home-banners/property-management.gif', uri + 'images/home-banners/rent-property.gif');
    lnkImg2 = new Array(uri + 'property-management.aspx', uri + 'bulgarian-property-rentals.aspx');
    
    arrImg3 = new Array(uri + 'images/home-banners/vehicle-sharing.gif', uri + 'images/home-banners/welcome-packs.gif');
    lnkImg3 = new Array(uri + 'bulgarian-airport-taxis.aspx', uri + 'welcome-packages.aspx');

    arrImg4 = new Array(uri + 'images/home-banners/cleaning-packs.gif', uri + 'images/home-banners/insurance.gif');
    lnkImg4 = new Array(uri + 'property-cleaning-packages.aspx', uri + 'insurance.aspx');

    count1 = 0;
    count2 = 0;
    count3 = 0;
    count4 = 0;
    
    function Img1Rotation() {
        switch (count1) {
            case 0:
                $(".jqImg1").attr("src", arrImg1[count1]);
                $(".jqLink1").attr("href", lnkImg1[count1]);
                count1 += 1;
                break;
            case 1:
                $(".jqImg1").attr("src", arrImg1[count1]);
                $(".jqLink1").attr("href", lnkImg1[count1]);
                count1 = 0;
                break;
        }
    }

    function Img2Rotation() {
        switch (count2) {
            case 0:
                $(".jqImg2").attr("src", arrImg2[count2]);
                $(".jqLink2").attr("href", lnkImg2[count2]);
                count2 += 1;
                break;
            case 1:
                $(".jqImg2").attr("src", arrImg2[count2]);
                $(".jqLink2").attr("href", lnkImg2[count2]);
                count2 = 0;
                break;
        }
    }

    function Img3Rotation() {
        switch (count3) {
            case 0:
                $(".jqImg3").attr("src", arrImg3[count3]);
                $(".jqLink3").attr("href", lnkImg3[count3]);
                count3 += 1;
                break;
            case 1:
                $(".jqImg3").attr("src", arrImg3[count3]);
                $(".jqLink3").attr("href", lnkImg3[count3]);
                count3 = 0;
                break;
        }
    }

    function Img4Rotation() {
        switch (count4) {
            case 0:
                $(".jqImg4").attr("src", arrImg4[count4]);
                $(".jqLink4").attr("href", lnkImg4[count4]);
                count4 += 1;
                break;
            case 1:
                $(".jqImg4").attr("src", arrImg4[count4]);
                $(".jqLink4").attr("href", lnkImg4[count4]);
                count4 = 0;
                break;
        }
    }

    Img1Rotation();
    Img2Rotation();
    Img3Rotation();
    Img4Rotation();

    setInterval(Img1Rotation, 3000);
    setInterval(Img2Rotation, 3000);
    setInterval(Img3Rotation, 3000);
    setInterval(Img4Rotation, 3000);
});

