// JULY 18 CODE

	var playORstay = '';//ADDED 18 JULY

// NEW MARCH CODE

var PAGETYPE // stops LinkPos() erroring on corp pages


	function btnon(btnNme,pType){

		if(btnNme != ''){

		PAGETYPE = btnNme;
		
		oMenuORIGINAL(pType + 'Menu');//shows horiz links

		var TABCOLOR;

		if(btnNme == 'COSTADELSOL')	{TABCOLOR = '#333399';}
		if(btnNme == 'COSTADEALMERIA')	{TABCOLOR = '#3399FF';}
		if(btnNme == 'COSTADELALUZ')	{TABCOLOR = '#45B509';}
		if(btnNme == 'COSTABLANCA')	{TABCOLOR = '#6666CC';}
		if(btnNme == 'MAJORCA')		{TABCOLOR = '#CC0000';}
		if(btnNme == 'TENERIFE')	{TABCOLOR = '#996633';}
		if(btnNme == 'LISBON')		{TABCOLOR = '#FFCC00';}
		if(btnNme == 'PORTUGAL')		{TABCOLOR = '#FF0000';}
		if(btnNme == 'ALGARVE')		{TABCOLOR = '#FF0000';}
		if(btnNme == 'MADEIRA')		{TABCOLOR = '#ff6600';}
		if(btnNme == 'CYPRUS')		{TABCOLOR = '#FF9933';}

		if(btnNme == 'CORPORATE')	{TABCOLOR = '#003399';}
		if(btnNme == 'ALGARVE') {btnNme = 'PORTUGAL';}

		window.document.getElementById(pType + btnNme).style.display = 'block';		//reveals links for page

		window.document.getElementById('TBLresortColor').style.backgroundColor = TABCOLOR;		//page banner
		window.document.getElementById('TBLresortColor' + 'RNV').style.backgroundColor = TABCOLOR;	//right nav links
		window.document.getElementById('headingName').src = 'hdng' + btnNme + '.gif';			//shows banner heading

		window.document.getElementById('TAB' + pType + btnNme).style.backgroundColor = TABCOLOR;	//resort button
		window.document.getElementById('TAB' + pType + btnNme).style.color = '#fff';			//resort button

		window.document.getElementById(pType + 'menuLINK').style.background = '';

		linkPos();

		}else	{

	//what to do if var not passed
		
		window.document.getElementById('TBLresortColor').style.background = '#6CB6FF url(bannerbg.gif) repeat-x';
		window.document.getElementById('TBLresortColor' + 'RNV').style.background = '#6CB6FF url(bannerbg.gif) repeat-x';
		window.document.getElementById('headingName').src = 'hdngHOME.gif';
		window.document.getElementById('CORPORATEcorporate').style.display = 'block';	

			}

	//IF HOMEPAGE

		if(window.document.getElementById('homeimg')){
			homeImage();
			}


		} 

// OPENS PAGE =======================

	function ow(wNme){
		window.location.href = wNme;
		}

// PREV AND NEXT =============================================================================

var CurPage = '';

linkCounter = 0;

var alllinks = '';

function linkPos(){		

		CurPage = window.location.href;

		var CounterEnabled = 'Y';

		alllinks = document.links.length;
		
		for (var i = 0; i < document.links.length; i++)
		{
		if (document.links[i].href == CurPage)
			{
			//alert('found one')
			document.links[i].style.backgroundColor = '#fff';
			document.links[i].style.color = '#333';
			CounterEnabled = 'N';
			}else{
				if(CounterEnabled == 'Y')	
				{
				linkCounter = parseInt(linkCounter+1);	
				}
			}
		//alert(CurPage);
		}
	//SHOWS PREV/NEXT
		
		if(PAGETYPE !='CORPORATE' && document.links[linkCounter-1].target != '')
			{
			window.document.getElementById('prevLink').style.display = 'block';
			}
		if(PAGETYPE !='CORPORATE' && document.links[linkCounter+1].target != '')
			{
			window.document.getElementById('nextLink').style.display = 'block';
			}
		}


// PREv and NEXT=====================

function gtpP(){
	if(document.links[linkCounter-1].target)
		{
		window.location.href = document.links[linkCounter-1].href;
		}else{
		window.location.href = document.links[linkCounter-2].href;
		}
	}

function gtpN(){
	if(document.links[linkCounter+1].target)
		{
		window.location.href = document.links[linkCounter+1].href;
		}else{
		window.location.href = document.links[linkCounter+2].href;
		}
	}

// END MARCH 2007===============================

	function bbmaps(){
		window.open('maps.html','bbmps1','scrollbars=yes,status=no,location=no,directories=no,width=764,height=800')
 		}

function shwMnu(mNme){
	if (window.document.getElementById(mNme).style.display == 'none'){
		window.document.getElementById(mNme).style.display = 'block';
		}else{
		window.document.getElementById(mNme).style.display = 'none';
		}
	}

//HIGHLIGHTS INPUT AND TEXT FIELDS
function meON(obj){
obj.style.backgroundColor = '#ffffff';
obj.style.borderColor = '#000000';
obj.style.borderWidth = '1px';
}

function meOFF(obj){
obj.style.backgroundColor = '#f6f6f6';
obj.style.borderColor = '#aaaaaa';
}

//============================================

var lstOmenu = 'corporateMenu';

function oMenu(menuID){
		
		if (!window.document.getElementById('homeimg') && pType != ''){

			if(pType != menuID.substring(0,7) && pType == 'playing'){

				window.location.href = 'STAYING' + btnNme.toLowerCase() + ".html";

				}else if(pType != menuID.substring(0,7) && pType == 'staying'){

				window.location.href = 'PLAYING' + btnNme.toLowerCase() + ".html";

				}

			}else{
		oMenuORIGINAL(menuID);
		}
	}

function oMenuORIGINAL(menuID){

	window.document.getElementById(lstOmenu).style.display = 'none';
	window.document.getElementById(menuID).style.display = 'block';
	lstOmenu = menuID;
	}

// MAPS =======================================

	function bbmaps(){
		window.open('maps.html','bbmps1','scrollbars=yes,status=no,location=no,directories=no,width=764,height=728')
 		}

//CALLBACK PANEL

	function callback(){
      	        var event = callback.caller.arguments[0] || window.event ;
		window.document.getElementById('callbackdiv').style.left = event.clientX + 'px';
		window.document.getElementById('callbackdiv').style.top = parseInt(document.body.scrollTop+event.clientY + 10)+'px';
		window.document.getElementById('callbackdiv').style.display = 'block';
		}

	function closecallback(){
		window.document.getElementById('callbackdiv').style.display = 'none';
		}

// POP UP CALLBACK

function sendcallback()
	{
	if(window.document.getElementById('cName').value != '' && window.document.getElementById('DaytimePhone').value != '')
		{
		window.document.getElementById('timetocallback').value = window.document.getElementById('timetocall').options[document.forms['callbackform'].timetocall.selectedIndex].value;
		window.document.getElementById('ThisPage').value = window.location.href;
		window.document.forms['callbackform'].submit();
		//document.callbackform.submit();
		//closecallback();
		alert('Thank you - a Blue Bay Golf advisor will contact you shortly.')
		}
		else
		{
		if(window.document.getElementById('cName').value == '')
			{
			alert('Please fill in your name')
			}
		if(window.document.getElementById('DaytimePhone').value == '')
			{
			alert('Please fill in your phone number')
			}
		}
	}

// CHANGING HOMEPIC
// HOMEPAGE IMAGE STUFF===================================



var chngeImg = Math.round(Math.random() * 5);
	function homeImage(){	
		hmimg = document.getElementById('homeimg');
		imgurl = '/HM200' + chngeImg +'.jpg';
		hmimg.style.background = "url('imgurl') no-repeat";

		}

	function ldpg(){
		if(chngeImg == '0'){window.location.href = 'SC_Lamangas.html'};		//costa blanca la manga club 1
		if(chngeImg == '1'){window.location.href = 'SC_Lamangas.html'};		//costa blanca la manga 
		if(chngeImg == '2'){window.location.href = 'PC_Vilasol.html'};		//algarve vila sol
		if(chngeImg == '3'){window.location.href = 'PC_Vilasol.html'};		//algarve vila sol
		if(chngeImg == '4'){window.location.href = 'PC_Vilasol.html'};		//algarve vila sol
		if(chngeImg == '5'){window.location.href = 'SC_LaCala.html'};		//costa del sol la cala
		if(chngeImg == '6'){window.location.href = 'SC_Mijas.html'};		//costa del sol mijas
		if(chngeImg == '7'){window.location.href = 'SC_GuadalminaS.html'};	//costa del sol guadalmina
			}