/* ------------------------------------------------------------
   Rotating Bits Function
   ------------------------------------------------------------*/
var stopAnim = 0, i, j;
function rotateItems() {
	for (j = 0; j < circArr.length; ++ j) {
		if (stopAnim == 0) {
			$(circArr [j] [0]).fadeOut(100);
			$(circArr [j] [0] + ":nth-child(" + circArr [j] [1] + ")").fadeIn(1000);
			(circArr [j] [1]) = (circArr [j] [1] + 1);
			if ((circArr [j] [1]) == (circArr [j] [2] +1)) { (circArr [j] [1]) = 1 };
		}
	}
}

$(document).ready(function() {

/* ------------------------------------------------------------
   Homepage Tabs
   ------------------------------------------------------------*/
	/* Style */
//	$("div.solutions h2 a, div.solutions h3 a").wrapInner("<div><div></div></div>");
	
	/* Behaviour */
//	$("div.solutions h2 a, div.solutions h3 a").click(function(){
//		$("div.solutions *").removeClass("cur");
//		$(this).parent().parent().addClass("cur");
//		$("div.solutions li.cur li:nth-child(1)").addClass("cur");
//		return false;
//	});
//	$("div.solutions h4 a").click(function(){
//		$("div.solutions *").removeClass("cur");
//		$(this).parent().parent().parent().parent().addClass("cur");
//		$(this).parent().parent().addClass("cur");
//		return false;
//	});
   
/* ------------------------------------------------------------
   Rotating Bits
   ------------------------------------------------------------*/
	$("div.rotate ul").addClass("ok");
	var theElement = $("div.rotate");
	var numIDs = $(theElement).size();
	eleArr = new Array (numIDs);
	var curElement = 0;
	$(theElement).each(function(){
		eleArr [curElement] = "div#" + $(this).attr('id') + " ul li";
		curElement = curElement + 1;
	});
	circArr = new Array (eleArr.length);
	for (i = 0; i < circArr.length; ++ i) {
		circArr [i] = new Array (3);
		circArr [i] [0] = eleArr [i];
		circArr [i] [1] = 2;
		circArr [i] [2] = $(eleArr [i]).size();
		$(circArr [i] [0]).hide();
		$(circArr [i] [0] + ":nth-child(1)").show();
		$(circArr [i] [0] + " *").hover(function(){ stopAnim = 1; },function(){ stopAnim = 0; });
	}
	setInterval(rotateItems,4000);
	
/* ------------------------------------------------------------
   Random Quotes
   ------------------------------------------------------------*/
	$("#quotes li").hide();
	$("#quotes ul").reorder();
	$("#quotes li:first-child").show();
	
});
var isError = 0;