// JavaScript Document

function formatText(index, panel) {
  return index + "";
}
/*Homepage image slider*/
$(function () {

	$('.anythingSlider').anythingSlider({
		easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 5000,                    // How long between slide transitions in AutoPlay mode
		startStopped: false,            // If autoPlay is on, this can force it to start stopped
		animationTime:2000,             // How long the slide transition takes
		hashTags: true,                 // Should links change the hashtag in the URL?
		buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover

		navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
	});
	
	$("#slide-jump").click(function(){
		$('.anythingSlider').anythingSlider(1);
	});
	
});

/*Menu highlighting*/
$(function(){
	var url = location.pathname;
	var sel = false;
	var ben = new Array('/value-chain', '/managing-risks', '/consulting-services', '/solutions');
	var how = new Array('/design-criteria');
	var homeLink;
	$(".nav>ul>li>a").each(function(){
		switch($(this).attr('href')){
			case "/":
				homeLink = $(this);
			break;
			case url:
				$(this).parent().addClass('selected');
				sel = true;
			break;
			case "/benefits":
				if($.inArray(url, ben) > -1){
					$(this).parent().addClass('selected');
					sel = true;
				}
			break;
			case "/how-it-works":
				if($.inArray(url, how) > -1){
					$(this).parent().addClass('selected');
					sel = true;
				}
			break;
		}
	});
	if(!sel){
		homeLink.parent().addClass('selected');	
	}
});


/*Menu Dropdown */
$(function(){
	$(".nav>ul>li>a").mouseover(function(){
		$(".nav li ul").hide();
		$(this).siblings('ul').show();
	});
});

/*Quotes*/
$(function(){
	$(".quote p").html('"'+chooseQuote()+'"');
	var c = Math.floor(Math.random() * 4) + 1; 	
	$(".quote").addClass("bgColour"+c);
});
function chooseQuote(){
	var i;
	var quote = [];
	quote.push("We're creating a new ecosystem with automated, electronic solutions for group health insurers and self insurers that eliminates manual processes, paperwork, human error and inconsistencies and speeds up payment and settlement.");
	quote.push("A good insurer is constantly straining to narrow the gap between premiums and costs.  They want to lower administration costs, pay out less in claims by improving their accuracy and handling, manage external costs and incentivise brokers to continue to sell their products year in year out.");
	quote.push("The OMNIQ system allows online collaboration  between key stakeholders – insurer, broker, employer, member, health providers.");
	quote.push("While many insurance companies realise they need to implement new business processes, they also discover that their systems have become overly complicated and cumbersome, increasing both risks and delivery costs.");
	quote.push("The insurance world is changing.  The old model is broken.  The silos are going.  The cloud creates a transparent, seamless collaboration from end to end and exposes the traps where money and inefficiencies are locked.");
	var q = Math.floor(Math.random() * (quote.length - 1)); 
	return quote[q];
}



