// JavaScript Document
function setCookie(name, value, expires, path, domain, secure)
{
    var curCookie = name + "=" + escape(value) +
      (expires ? "; expires=" + expires.toGMTString() : "") +
      (path ? "; path=" + path : "") +
      (domain ? "; domain=" + domain : "") +
      (secure ? "; secure" : "");

    return document.cookie = curCookie;
}
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);

    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

//*****
//
if (!getCookie('currentImageIndex'))
{
    var now = new Date();
    now.setMinutes(now.getMinutes() + 1);

    setCookie('currentImageIndex', -1, now, null, null, null);
}

// JSON Object
// (http://www.json.org/js.html)
//
// This is where you add more images
//
var slideShow = { "bindings":
                    [
                        { "imageUrl": "../images/ad-easy.jpg", "linkLocation": "http://www.easyinsuranceindia.com", "linkTitle": "Easy Insurance India", "imageText": "" },
                        { "imageUrl": "../images/health-ad.jpg", "linkLocation": "http://www.easyinsuranceindia.com/healthHomeSearch.do", "linkTitle": "Easy Insurance India", "imageText": ""  },
                        { "imageUrl": "../images/life-ad.jpg", "linkLocation": "http://www.easyinsuranceindia.com/lifeHomeSearch.do", "linkTitle": "Easy Insurance India", "imageText": ""  },
						{ "imageUrl": "../images/motor-ad.jpg", "linkLocation": "http://www.easyinsuranceindia.com/motorHomeSearch.do", "linkTitle": "Easy Insurance India", "imageText": ""  },
						{ "imageUrl": "../images/travel-ad.jpg", "linkLocation": "http://www.easyinsuranceindia.com/travelhome.do", "linkTitle": "Easy Insurance India", "imageText": ""  }
                    ]
                };

//*****
//
function ChangeImage() {

    var now = new Date();
    now.setMinutes(now.getMinutes() + 1);

    var currentImageIndex = parseInt(getCookie('currentImageIndex'), 10);
    currentImageIndex++;
    
    if (currentImageIndex >= slideShow.bindings.length) {
        currentImageIndex = 0;
    }
    setCookie('currentImageIndex', currentImageIndex, now, null, null, null);

    var currentSlide = slideShow.bindings[currentImageIndex];
return document.write('<a href="' + currentSlide.linkLocation + '" title="' + 
                                    currentSlide.linkTitle + '"><img src="' + 
                                    currentSlide.imageUrl + '" border="0" width="181px" height="602px"/></a>');
}


// Force IE 7 to refresh
//
// This is only for IE7 browser. FF & Opera don't need this.


function refresh() {
    var sURL = unescape(window.location.pathname);
    window.location.href = sURL; 
}

function forceIE7_Refresh() {
    var longTime = 80000*1000
    setTimeout( "refresh()", longTime );
}


window.onload = forceIE7_Refresh;