
// Preload images
var imageCache = new Array();
preloadImages();

// On load starts everything
window.onload = main;

function main() {
	window.resizeTo(920,825);
	var wT = new nitobi.spotlight.Spotlight('GREYSWIPE', 'impact', 'round');
				
	wT.allowScrolling = false;
	wT.createCalloutStep(null, 'VisiRun', "Let's discover the main features");
	wT.createCalloutStep('step1', 'Position', 	'Control your vehicles positions in real time');
	wT.createCalloutStep('step2', 'Position',	'Search for vehicles by name, license plate, address etc.');
	wT.createCalloutStep('step3', 'Position', "Click on a vehicle to quickly access main functions");
	wT.createCodeStep("changeImage(4)", 0);
	wT.createCalloutStep('step3a', 'Position', "Satellite view of current position");
	wT.createCodeStep("changeImage(3)", 0);
	wT.createCalloutStep('step4', 'Position', "Send text message to the driver");
	wT.createCodeStep("changeImage(0)", 0);
	wT.createCalloutStep('step5', 'Route', "Vehicle route  details, driving time, distance etc.");
	wT.createCalloutStep('step6', 'Route', "Verify drive times, stops and rest time, departure and arrival time");
	wT.createCalloutStep('step7', 'Route', "Departure, tracking, stops along the way, arrival at destination");
	wT.createCodeStep("changeImage(5)", 0);
	wT.createCalloutStep('step7a', 'Route', "Check unexpected stops, exceeding speed limit, arrival at the customer's site");
	wT.createCodeStep("changeImage(6)", 0);
	wT.createCalloutStep('step7b', 'Route', "Check stops at POI: clients, plants, warehouses, delivery locations");
	wT.createCodeStep("changeImage(7)", 0);
	wT.createCalloutStep('step8', 'Route', "Retrieve routes by date or period from the archive of the last 12 months");
	wT.createCodeStep("changeImage(8)", 0);
	wT.createCalloutStep('step8b', 'Route', "Virtual tachograph that shows activity, drive,  stop and rest times");
	wT.createCodeStep("changeImage(18)", 0);
	wT.createCalloutStep('step20', 'Route Calculation', "Enter a destination and calculate the shortest route for a particular vehicle");
	wT.createCodeStep("changeImage(19)", 0);
	wT.createCalloutStep('step21', 'Route Calculation', "The route will be displayed directly on the map providing indications on duration and distance");
	wT.createCodeStep("changeImage(1)", 0);
	wT.createCalloutStep('step9', 'Events', "Setting of alerts and alarms");
	wT.createCodeStep("changeImage(9)", 0);
	wT.createCalloutStep('step10', 'Events', "Delivery notice");	
	wT.createCalloutStep('step11', 'Events', "Alert for unexpected stop");	
	wT.createCalloutStep('step11b', 'Events', "Alert for unexpected movements in specific hourly time intervals");
	wT.createCalloutStep('step11c', 'Events', "Alerts for speed limit");
	wT.createCodeStep("changeImage(10)", 0);
	wT.createCalloutStep('step11d', 'Events', "Alerts notified with SMS or email");
	wT.createCodeStep("changeImage(2)", 0);
	wT.createCalloutStep('step12', 'Messages', "Send instant messages to drivers");	
	wT.createCalloutStep('step13', 'Messages', "History of all messages sent and received");	
	wT.createCodeStep("changeImage(11)", 0);
	wT.createCalloutStep('step14', 'P.O.I.', "Define important addresses for customers' sites, warehouse etc., and control stop and arrival times");
	wT.createCodeStep("changeImage(12)", 0);
	wT.createCalloutStep('step15', 'Reports', "Summarized reports of daily activities for the whole fleet");
	wT.createCodeStep("changeImage(13)", 0);
	wT.createCalloutStep('step16', 'Reports', "Detailed reports of daily activities of any vehicles");	
	wT.createCalloutStep('step17', 'Reports', "Export all reports to EXCEL");
	wT.createCodeStep("changeImage(14)", 0);
	wT.createCalloutStep('step18', 'Reports', "Detailed reports for all stops at your P.O.I. such as customers sites, warehouse, etc.");	
	wT.createCodeStep("changeImage(15)", 0);
	wT.createCalloutStep('step19', 'User management', "Offer limited and configurable access to your clients, departments, remote branches");
	wT.createCodeStep("changeImage(16)", 0);
	wT.createCalloutStep('step14b', 'Device Status', "Monitor GPS tracker status in real time");
	wT.createCodeStep("changeImage(17)", 0);
	wT.createCalloutStep('step14c', 'Device Status', "The diagnosis and the actual status of the device are shown in the specific section");
	wT.createCalloutStep('step14d', 'Device Status', "Historical device status allows to discover technical problems");
	wT.createCalloutStep(null, 'VisiRun', "The virtual tour is finished. Thank you for your attention. Click to continue.");
	wT.createCodeStep("exitTour()", 0);
	wT.play();
		
}

function exitTour()
{
	var dest = "../index.php?pageName=MainPage&package=Interface";
	
	if(window.opener) {
		window.close();
		return;
	}
	if (parent) {
		parent.location.href = dest;
		return;
	}
	window.location.href = dest;
	
}

function preloadImages()
{
	var i;
	
	if (!document.images) return;
	
	addImageToCache( "../images/tour_en/screen2small.png" );
	addImageToCache( "../images/tour_en/screen3small.png" );
	addImageToCache( "../images/tour_en/screen4small.png" );
	addImageToCache( "../images/tour_en/screen1small.png" );
	setTimeout('addImageToCache( "../images/tour_en/screen1smallb.png" )', 1500);
	setTimeout('addImageToCache( "../images/tour_en/screen2smallb.png" )', 3000);
	setTimeout('addImageToCache( "../images/tour_en/screen2smallc.png" )', 4500);
	setTimeout('addImageToCache( "../images/tour_en/screen2smalld.png" )', 6000);
	setTimeout('addImageToCache( "../images/tour_en/screen2smalle.png" )', 7500);
	setTimeout('addImageToCache( "../images/tour_en/screen3smallb.png" )', 9000);
	setTimeout('addImageToCache( "../images/tour_en/screen3smallc.png" )', 10500);
	setTimeout('addImageToCache( "../images/tour_en/screen5small.png" )', 12000);
	setTimeout('addImageToCache( "../images/tour_en/screen6small.png" )', 13500);
	setTimeout('addImageToCache( "../images/tour_en/screen7small.png" )', 15000);
	setTimeout('addImageToCache( "../images/tour_en/screen8small.png" )', 17500);
	setTimeout('addImageToCache( "../images/tour_en/screen9small.png" )', 19000);
	setTimeout('addImageToCache( "../images/tour_en/screen1small.png" )', 20500);
	setTimeout('addImageToCache( "../images/tour_en/screen5smallb.png" )', 22000);
	setTimeout('addImageToCache( "../images/tour_en/screen10small.png" )', 23500);
	setTimeout('addImageToCache( "../images/tour_en/screen11small.png" )', 25000);
}

function addImageToCache( src )
{
	i = new Image();
	i.src = src;
	imageCache.push( i );
}

function changeImage( index ) 
{
	var img = document.getElementById("img");
	img.src = imageCache[index].src;
}
