
// ----- CMO Home Page for NN6+ and IE5+ ------

// Module: cmohomedom1.js	Version 1.8

// Date 15.5.2001	

// Author Rod Fletcher

// This script is Copyright ©1999 - 2010 Rod and Sue Fletcher.


/* Maintenance ----------------
	
   Version 1.0 to 1.1 - 20.2.2002 New design RYA logo positioning
   
   Version 1.1 to 1.2 - 30.9.2002 Remove special offer and Change Offers to R.A.F

   Version 1.2 to 1.3 - 13.1.2003 2003 Enhancements

   Version 1.3 to 1.4 - 3.1.2006 Multiple booking system

   Version 1.4 to 1.5 - 16.1.2006 Add world map
   
   Version 1.5 to 1.6 - 19.10.2009 Message re. postal strike

   Version 1.6 to 1.7 - 06.11.2009 comment out message re. postal strike

   Version 1.7 to 1.8 - 4.03.2010 fix problem with element positioning in Chrome.
------------------------------- */


var domType = location.search.substr(1, 5);

if (domType == '') {
	location = 'index.html';
}

var timeSent = parseInt(location.search.substr(6));
var now = new Date();
var timeNow = now.getTime();
var timeDiff = timeNow - timeSent;

//if (timeDiff > 180000) {
	//location = 'index.html';
//}

document.cookie = "checkCookie=cmonline; path=/";


var lastId = '';


function formatPage() {


	document.getElementById('world').style.visibility = 'hidden';


	switch(domType) {

		case '1NN6+':

			var topBlueWidth = window.innerWidth - 428;
			var rightBlueHeight = window.innerHeight - 185;
			var rightBluePos = window.innerWidth - 48;
			var botBluePosX = window.innerWidth - 70;
			var botBluePosY = window.innerHeight - 69;
			var ryalogoPosX = window.innerWidth - 210;
			var ryalogoPosY = window.innerHeight - 136;
			var worldWidth = window.innerWidth - 332;
			var worldHeight = worldWidth * 0.5431;			
			var blueDotPosY = window.innerHeight - 102;
			var ryaTheory1PosY = window.innerHeight - 61;
			var copyrightPosY = window.innerHeight - 45;

			if (rightBlueHeight < 258) {
				rightBlueHeight = 258;
				botBluePosY = 375;
				ryalogoPosY = 308;
			}

			if (topBlueWidth < 302) {
				topBlueWidth = 302;
				rightBluePos = 684;
				botBluePosX = 662;
				ryalogoPosX = 522;
			}




			document.getElementById('topblue').width = topBlueWidth;
			document.getElementById('rightblue').height = rightBlueHeight; 
			document.getElementById('rightblue').style.left = rightBluePos;                                                                                                
			document.getElementById('rightblue').style.visibility = 'visible';
			document.getElementById('botblue').style.left = botBluePosX;
			document.getElementById('botblue').style.top = botBluePosY;
			document.getElementById('botblue').style.visibility = 'visible'; 
			document.getElementById('ryalogo').style.left = ryalogoPosX;
			document.getElementById('ryalogo').style.top = ryalogoPosY;




			if ((window.innerHeight >= 590) && (window.innerWidth >= 690)) {

				document.getElementById('plotter2').style.visibility = 'hidden';  
				document.getElementById('plotter1').style.top = '150px';        
				document.getElementById('plotter1').style.visibility = 'visible'; 
				document.getElementById('bluedot').style.top = blueDotPosY;
				document.getElementById('bluedot').style.visibility = 'visible'; 
				document.getElementById('ryatheory2').style.visibility = 'hidden'; 				
				document.getElementById('ryatheory1').style.top = ryaTheory1PosY;				
				document.getElementById('ryatheory1').style.visibility = 'visible';
				document.getElementById('copyright').style.top = copyrightPosY;
				document.getElementById('copyright').style.left = '186px';

				document.getElementById('co').style.top = '203px'; 
				document.getElementById('co').style.left = '153px'; 
				document.getElementById('bo').style.top = '225px'; 
				document.getElementById('bo').style.left = '165px'; 
				document.getElementById('qu').style.top = '251px'; 
				document.getElementById('qu').style.left = '175px'; 
				document.getElementById('con').style.top = '280px';
				document.getElementById('con').style.left = '181px';
				document.getElementById('fe').style.top = '309px';  
				document.getElementById('fe').style.left = '183px';  
				document.getElementById('ab').style.top = '337px'; 
				document.getElementById('ab').style.left = '181px'; 
				document.getElementById('sm').style.top = '365px';
				document.getElementById('sm').style.left = '176px';
				document.getElementById('tr').style.top = '391px'; 
				document.getElementById('tr').style.left = '166px'; 
				document.getElementById('li').style.top = '415px';  
				document.getElementById('li').style.left = '152px';
				
				
				if (document.body.clientWidth >= 895) {

					document.getElementById('world').style.width = worldWidth;
					document.getElementById('world').style.height = worldHeight;
					document.getElementById('world').style.visibility = 'visible';
					document.getElementById('special').style.visibility = 'visible';
				}
				else {
					  document.getElementById('world').style.visibility = 'hidden';
					  document.getElementById('special').style.visibility = 'hidden';
				}

				document.getElementById('whole').style.visibility = 'visible'; 



			}
			else {
			
				  document.getElementById('world').style.visibility = 'hidden';
				  document.getElementById('special').style.visibility = 'hidden';
			
			  	  document.getElementById('plotter1').style.visibility = 'hidden';  
			  	  document.getElementById('plotter1').style.top = '0px';  
			  	  document.getElementById('plotter2').style.visibility = 'visible';  

			  	  document.getElementById('bluedot').style.visibility = 'hidden';  
			  	  document.getElementById('bluedot').style.top = '0px';  

			  	  document.getElementById('ryatheory1').style.visibility = 'hidden';  
			  	  document.getElementById('ryatheory1').style.top = '0px';  
			  	  document.getElementById('ryatheory2').style.visibility = 'visible';  

			  	  document.getElementById('copyright').style.top = '418px';  
			  	  document.getElementById('copyright').style.left = '16px';  

				  document.getElementById('co').style.top = '210px'; 
				  document.getElementById('co').style.left = '222px'; 
				  document.getElementById('bo').style.top = '232px'; 
				  document.getElementById('bo').style.left = '270px'; 
				  document.getElementById('qu').style.top = '255px'; 
				  document.getElementById('qu').style.left = '301px'; 
				  document.getElementById('con').style.top = '278px';
				  document.getElementById('con').style.left = '324px';
				  document.getElementById('fe').style.top = '301px';  
				  document.getElementById('fe').style.left = '341px';  
				  document.getElementById('ab').style.top = '324px'; 
				  document.getElementById('ab').style.left = '352px'; 
				  document.getElementById('sm').style.top = '347px';
				  document.getElementById('sm').style.left = '360px';
				  document.getElementById('tr').style.top = '370px'; 
				  document.getElementById('tr').style.left = '364px'; 
				  document.getElementById('li').style.top = '393px';  
				  document.getElementById('li').style.left = '367px';
				


			  	  document.getElementById('whole').style.visibility = 'visible';  


			}

			break;



		case '1IE5+':


			var topBlueWidth = document.body.clientWidth - 428;
			var rightBlueHeight = document.body.clientHeight - 185;
			var rightBluePos = document.body.clientWidth - 48;
			var botBluePosX = document.body.clientWidth - 70;
			var botBluePosY = document.body.clientHeight - 69;
			var ryalogoPosX = document.body.clientWidth - 210;
			var ryalogoPosY = document.body.clientHeight - 136;
			var worldWidth = document.body.clientWidth - 332;
			var worldHeight = worldWidth * 0.5431;			
			var blueDotPosY = document.body.clientHeight - 102;
			var ryaTheory1PosY = document.body.clientHeight - 61;
			var copyrightPosY = document.body.clientHeight - 45;
			
			
			
			
			if (rightBlueHeight < 258) {
				rightBlueHeight = 258;
				botBluePosY = 375;
				ryalogoPosY = 308;
			}

			if (topBlueWidth < 302) {
				topBlueWidth = 302;
				rightBluePos = 684;
				botBluePosX = 662;
				ryalogoPosX = 522;
			}

			document.getElementById('topblue').width = topBlueWidth;
			document.getElementById('rightblue').height = rightBlueHeight;

			changeIEStyleBySelector('#rightblue', 'left', rightBluePos);
			changeIEStyleBySelector('#rightblue', 'visibility', 'visible');
			changeIEStyleBySelector('#botblue', 'left', botBluePosX);
			changeIEStyleBySelector('#botblue', 'top', botBluePosY);
			changeIEStyleBySelector('#botblue', 'visibility', 'visible');
			changeIEStyleBySelector('#ryalogo', 'left', ryalogoPosX);
			changeIEStyleBySelector('#ryalogo', 'top', ryalogoPosY);

			if ((document.body.clientHeight >= 590) && (document.body.clientWidth >= 690)) {
				changeIEStyleBySelector('#plotter2', 'visibility', 'hidden');
				changeIEStyleBySelector('#plotter1', 'top', '150px');
				changeIEStyleBySelector('#plotter1', 'visibility', 'visible');

				changeIEStyleBySelector('#bluedot', 'top', blueDotPosY);
				changeIEStyleBySelector('#bluedot', 'visibility', 'visible');

				changeIEStyleBySelector('#ryatheory2', 'visibility', 'hidden');
				changeIEStyleBySelector('#ryatheory1', 'top', ryaTheory1PosY);
				changeIEStyleBySelector('#ryatheory1', 'visibility', 'visible');

				changeIEStyleBySelector('#copyright', 'top', copyrightPosY);
				changeIEStyleBySelector('#copyright', 'left', '186px');

				changeIEStyleBySelector('#co', 'top', '203px');
				changeIEStyleBySelector('#co', 'left', '153px');
				changeIEStyleBySelector('#bo', 'top', '225px');
				changeIEStyleBySelector('#bo', 'left', '165px');
				changeIEStyleBySelector('#qu', 'top', '251px');
				changeIEStyleBySelector('#qu', 'left', '175px');
				changeIEStyleBySelector('#con', 'top', '280px');
				changeIEStyleBySelector('#con', 'left', '181px');
				changeIEStyleBySelector('#fe', 'top', '309px');
				changeIEStyleBySelector('#fe', 'left', '183px');
				changeIEStyleBySelector('#ab', 'top', '337px');
				changeIEStyleBySelector('#ab', 'left', '181px');
				changeIEStyleBySelector('#sm', 'top', '365px');
				changeIEStyleBySelector('#sm', 'left', '176px');
				changeIEStyleBySelector('#tr', 'top', '391px');
				changeIEStyleBySelector('#tr', 'left', '166px');
				changeIEStyleBySelector('#li', 'top', '415px');
				changeIEStyleBySelector('#li', 'left', '152px');
				
				if (document.body.clientWidth >= 895) {
				
					document.getElementById('world').style.width = worldWidth;
					document.getElementById('world').style.height = worldHeight;
					document.getElementById('world').style.visibility = 'visible';
					document.getElementById('special').style.visibility = 'visible';
				}
				else {
					  document.getElementById('world').style.visibility = 'hidden';
					  document.getElementById('special').style.visibility = 'hidden';
				}



			    changeIEStyleBySelector('#whole', 'visibility', 'visible');
			    


			}
			else {
			
				  document.getElementById('world').style.visibility = 'hidden';
				  document.getElementById('special').style.visibility = 'hidden';

				  changeIEStyleBySelector('#plotter1', 'visibility', 'hidden');
				  changeIEStyleBySelector('#plotter1', 'top', '0px');
				  changeIEStyleBySelector('#plotter2', 'visibility', 'visible');

				  changeIEStyleBySelector('#bluedot', 'visibility', 'hidden');
				  changeIEStyleBySelector('#bluedot', 'top', '0px');

				  changeIEStyleBySelector('#ryatheory1', 'visibility', 'hidden');
				  changeIEStyleBySelector('#ryatheory1', 'top', '0px');
				  changeIEStyleBySelector('#ryatheory2', 'visibility', 'visible');

				  changeIEStyleBySelector('#copyright', 'top', '418px');
				  changeIEStyleBySelector('#copyright', 'left', '16px');

				  changeIEStyleBySelector('#co', 'top', '210px');
				  changeIEStyleBySelector('#co', 'left', '222px');
				  changeIEStyleBySelector('#bo', 'top', '232px');
				  changeIEStyleBySelector('#bo', 'left', '270px');
				  changeIEStyleBySelector('#qu', 'top', '255px');
				  changeIEStyleBySelector('#qu', 'left', '301px');
				  changeIEStyleBySelector('#con', 'top', '278px');
				  changeIEStyleBySelector('#con', 'left', '324px');
				  changeIEStyleBySelector('#fe', 'top', '301px');
				  changeIEStyleBySelector('#fe', 'left', '341px');
				  changeIEStyleBySelector('#ab', 'top', '324px');
				  changeIEStyleBySelector('#ab', 'left', '352px');
				  changeIEStyleBySelector('#sm', 'top', '347px');
				  changeIEStyleBySelector('#sm', 'left', '360px');
				  changeIEStyleBySelector('#tr', 'top', '370px');
				  changeIEStyleBySelector('#tr', 'left', '364px');
				  changeIEStyleBySelector('#li', 'top', '393px');
				  changeIEStyleBySelector('#li', 'left', '367px');




			      changeIEStyleBySelector('#whole', 'visibility', 'visible');


			}
			




			break;
	}


//alert('UK POSTAL STRIKE INFORMATION - BUSINESS AS USUAL\n\n\nUK Shipments -:\n\nDuring the postal workers dispute we are using a courier service for UK customers, delivery is still free.\n\n\nNon UK Shipments:\n\nShipments to customers outside the UK will be unaffected, packs wil be dispatched from our Continental European Office in Portugal.\n\n');  

	
   
}




function goBlue(id) {


	switch (domType) {


		case '1NN6+':

			changeNNStyleBySelector(id, 'color', '#5761F8');

			break;



		case '1IE5+':

			changeIEStyleBySelector(id, 'color', '#5761F8');

			break;
	} 
}



function goRed(id) {

	switch (domType) {


		case '1NN6+':

			changeNNStyleBySelector(id, 'color', '#C0455E');

			break;



		case '1IE5+':
			changeIEStyleBySelector(id, 'color', '#C0455E');


			break;
	}
}






function nextPage(k) {


	switch(k) {




		case '0':
			location = 'cmoframesetdn.html?' + domType + './courses/html/cmocourses.html';
			break;

		case '1':
			location = 'cmoframesetdn.html?' + domType + './booking/html/cmobooking.html';
			break;

		case '2':
			location = 'cmoframesetdn.html?' + domType + './faq/html/cmofaq.html';
			break;

		case '3':
			location = 'cmoframesetdn.html?' + domType + './contact/html/cmocontact.html';
			break;

		case '4':
			location = 'cmoframesetdn.html?' + domType + './about/html/cmoabout.html';
			break;

		case '5':
			location = 'cmoframesetdn.html?' + domType + './map/html/cmomap.html';
			break;

		case '6':
			location = 'cmoframesetdn.html?' + domType + './courses/html/cmofb.html';
			break;

		case '7':
			location = 'cmoframesetdn.html?' + domType + './trivia/html/cmotrivia.html';
			break;

		case '8':
			location = 'cmoframesetdn.html?' + domType + './links/html/cmolinks.html';
			break;



		case '00':
			location = 'cmoframesetdn.html?' + domType + './courses/html/cmodsk.html';
			break;

		case '01':
			location = 'cmoframesetdn.html?' + domType + './courses/html/cmoyma.html';
			break;

		case '02':
			location = 'cmoframesetdn.html?' + domType + './courses/html/cmocom.html';
			break;

		case '03':
			location = 'cmoframesetdn.html?' + domType + './courses/html/cmoupg.html';
			break;






		case '10':
			location = 'cmoframesetdn.html?' + domType + 'http://www.cmonline.co.uk/cgi-bin-local/cmobko.pl';
			break;


		case '11':
			location = 'cmoframesetdn.html?' + domType + './booking/html/cmobooking.html';
			break;

		case '12':
			location = 'cmoframesetdn.html?' + domType + './booking/html/cmoprices.html';
			break;


		case '30':
			location = 'cmoframesetdn.html?' + domType + './contact/html/cmoonlenq.html';
			break;

		case '31':
			location = 'cmoframesetdn.html?' + domType + './contact/html/cmocontact.html';
			break;

		case '32':
			location = 'cmoframesetdn.html?' + domType + './contact/html/cmomaillist.html';
			break;






		case '80':
			location = 'cmoframesetdn.html?' + domType + './links/html/cmolinks.html';
			break;

		case '81':
			location = 'cmoframesetdn.html?' + domType + './links/html/cmobooks.html';
			break;

		case '82':
			location = 'cmoframesetdn.html?' + domType + './links/html/cmolinks.html';
			break;

	}
}


// END
