/**
 *	dynamic segmented information wheel 1.0
 *	@author:	Tom Adlam
 *	@created:	21/06/2009
 */

var numSegments = 7;		// no. of wheel segments
var effects		= false		// display effects?
var host 		= window.location.protocol + "//" + window.location.hostname;

$(function(){
	preLoadSegments();
//	display relevant segments
	$('map .segment').mouseover(function(){ displaySegment(this.id); });
//	hide segment when not hovering
	$('map .segment').mouseout(function(){ $('#banner > #segment').css({display: 'none'});});
//	allow info display when clicked
	$('map .segment').mousedown(function(){ displayInformation(this.id); });
//	close description box when clicked
	$('#banner > #description').click(function(){ $(this).fadeOut('slow'); });
});

/**	
 *	preloads all segments for smooth interaction
 */	
	function preLoadSegments(){
	//	attach segment placeholder
		$('#banner').prepend('<img id="segment" name="segment" style="position: absolute; display: none;" src="" usemap="" />');
	//	preload all segments
		for(i=0;i<numSegments;i++)
			$('#banner > #segment').attr({src: host+'/wp-content/themes/claritum/images/wheel-seg-'+(i+1)+'a.png'});
	}

/**
 *	displays a segment in the correct position
 */
	function displaySegment(id){
	//	set segment
		$('#banner > #segment').attr({src: host+'/wp-content/themes/claritum/images/wheel-seg-'+(id.replace(/s/, ''))+'a.png', usemap: '#m_claritumwheelsolo'});
//		$('#banner > #segment').css({display: 'block'});
		$('#banner > #segment').fadeIn(200);
	}

/**
 *	displays displays segment information
 */
	function displayInformation(id){

		var description = null;
		var learnMore 	= null;
		
		switch(id){
			case 's1': 
				description = "<h2>Spend Analysis</h2><p>Claritum's data driven Spend Analysis program enables our Clients to gain granular insight into their spend, or monitor performance of a current outsourcing arrangement, in order to achieve significant, measurable and sustainable savings and efficiencies.</p><ul><li>Spend Visibility</li><li>Efficiencies</li><li>Savings</li></ul>";	
				learnMore 	= "solutions/spend-analysis/";
			break;
			case 's2': 
				description = "<h2>Sourcing</h2><p>To address the complexities of day-to-day buying, Sourcing provides novice and expert users with a unique combination of a structured RFx (Request-for-Quote, Request-for-Proposal), contract (fixed price) and spot pricing (capacity based).</p><ul><li>controlled best practice sourcing process</li><li>real time, granular management insights into spend</li><li>bid award sent to Procurement or Sales Order Processing capabilities</li></ul>"; 
				learnMore 	= "solutions/sourcing/";
			break;
			case 's3': 
				description = "<h2>Contract Compliance</h2><p>Claritum enables buying organisations to control which suppliers are used, monitors buyer and supplier performance to provide a 360 degree view of contract compliance. The application ensures operational and regulatory compliance across your supply base via monitoring of your spend, contracts and controls to drive down risk and identify opportunities for greater savings and efficiencies.</p><ul><li>control your spend, suppliers and contracts</li><li>achieve savings</li></ul>"; 
				learnMore 	= "solutions/compliance/";
			break;
			case 's4': 
				description = "<h2>Procurement</h2><p>Procurement integrates seamlessly with Claritum's Sourcing to enable users to select winning supplier(s) and raise, authorise and issue purchase order(s). The procurement capability handles change orders for complex and last minute changes with full audit facility.</p><ul><li>select winning supplier, raise, authorise and issue PO(s)</li><li>best practice compliant process, with audit trail</li><li>lower cost per PO than using ERP</li><li>export to financials</li></ul></p>";	
				learnMore 	= "solutions/procurement/";
			break;
			case 's5': 
				description = "<h2>Invoicing &amp; Payment</h2><p>Claritum's Invoice to Pay capability seamlessly integrates with Claritum's procurement software to streamline the processes of supplier invoice matching, reconciliation and approval.</p><ul><li>Integrates with Claritum Procurement</li><li>Streamlines invoice to settle processes</li><li>Eliminates cost variances</li><li>Export to financials</li></ul>";	
				learnMore 	= "solutions/invoice-to-pay/";
			break;
			case 's6': 
				description = "<h2>Supplier Management</h2><p>Claritum's Supplier Management software empowers supply chain managers and print buyers to view and manage supplier contact details, production capabilities and establish and monitor KPI performance criteria.</p><ul><li>access Claritum's supplier network to find new vendors</li><li>review and benchmark current suppliers</li><li>manage your approved and preferred suppliers</li><li>monitor performance against KPIs</li></ul>"; 
				learnMore 	= "solutions/supplier-management/";
			break;
			case 's7': window.location.href = host + '/business-case/'; return false;	break;
		}
		
		description += '<p class="more-information"><a href="'+learnMore+'">More information &raquo;</a></p>';

		$('#banner > #description').html(description);
		$('#banner > #description h2').css({margin: '10px 0 0 10px'});
		$('#banner > #description p').css({margin: '10px 0 0 10px', clear: 'both'});
		$('#banner > #description .more-information').css({margin: '20px 12px 0 10px', clear: 'both', textAlign: 'right', fontWeight: 'bold'});
		$('#banner > #description ul').css({margin: '10px 0 0 10px'});
		$('#banner > #description ul li').css({background: 'none', margin: '0 0 0 15px', listStyleType: 'square'});
		$('#banner > #description').css({margin: '25px 0 0 350px', width: '490px', height: '205px'});
		$('#banner > #description').fadeIn('slow');

	}
