// if we use member(), have this
function member(arr, element) {
	if (! Array.indexOf) {
	    // patch IE7 and lower
	    Array.prototype.indexOf = function(val) {
	        for (var i = 0; i < this.length; i ++) {
	            if (this[i] == val) {
	                return i;
			}
		    }
	        return -1;
	        }
	    }
	return (arr.indexOf(element) >= 0);
}

window.onbeforeunload = function () {};

var actnum = 1; // featured activity index
var rLeft = 1;	// left reward index
 
function acNext() {
	actnum ++;
	$(".featured").load("/splash/factivity/" + actnum.toString());
}

function acPrev() {
	actnum --;
	$(".featured").load("/splash/factivity/" + actnum.toString());
}

function urit(aid) {
	$(".featured").load("/splash/tag/" + aid.toString());
}

function tab(n) {
	$("#hiwText").load("/splash/hiwTab/" + n.toString());
}

	

$(document).ready(function(){ 
   $("#rNext").click(function(event){ 
     rLeft += 2;
     $("#rewardsList").load("/splash/reward/" + rLeft.toString());
     event.preventDefault();
	}); 

   $("#rPrevious").click(function(event){ 
     rLeft -= 2;
     $("#rewardsList").load("/splash/reward/" + rLeft.toString());
     event.preventDefault();
	}); 

   $(".featured").load("/splash/factivity/1");
   $("#rewardsList").load("/splash/reward/1");
   $("#tagcloud").load("/splash/get_featured_tags");
   $("#hiwText").load("/splash/hiwTab/1");
}); 


