var delay=5000 //set delay in miliseconds
var curindex=0
var randomimages=new Array()
        randomimages[0]="../img/identity/identity_green.jpg"
	randomimages[1]="../img/identity/identity_blue.jpg"
	randomimages[2]="../img/identity/identity_orange.jpg"
        var preload=new Array()
        for (n=0;n<randomimages.length;n++)
        {
            preload[n]=new Image()
            preload[n].src=randomimages[n]
        }
        tempindex=Math.random();
	$('#main').css('background-image', 'url('+randomimages[Math.floor(Math.random()*(randomimages.length))]+')');
	
        function rotateimage()
        {
    	    if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
    		curindex=curindex==0? 1 : curindex-1
    	    }
    	    else curindex=tempindex;
    	    $('#main').css('background-image', 'url('+randomimages[curindex]+')');
        }
        setInterval("rotateimage()",delay)

