//Current page is used to prevent the submenu from collapsing if the currently viewed section is the same as the 
//section that is being clicked.
var currentPage = 0;

var quotesArray = new Array();
quotesArray[1] = "<p>The ideal venue for every event, offering a unique personal service.</p>";
quotesArray[2] = "<p>Take a look at our events calendar for upcoming offers !</p>";
quotesArray[3] = "<p>Great deals available for special occasions.</p>";
quotesArray[4] = "<p>Gift Vouchers Available.</p>";
quotesArray[5] = "<p>Largs, central to the great Scottish golf courses.</p>";

/*
pagesArray: Called when user clicks menus within the navigation pane. Targets "content" div and pulls
in the relevant page from the array.
pagesArray[x][0] is the main heading that should be displayed on the navigation pane.
pagesArray[x][1-n] are the sub-headings that should be displayed below the main headings within the navigation pane.
*/

//When additional subpages are to be added update the array of links
var pagesArray = new Array();
pagesArray[0] = "Home";
pagesArray[0] = new Array();
pagesArray[0][0] = "home.html";
pagesArray[1] = new Array();
pagesArray[1][0] ="offers.html";
pagesArray[1][1] ="dogs.html";
pagesArray[2] = new Array();
pagesArray[2][0] = "events.html";
pagesArray[3] = new Array();
pagesArray[3][0] = "restaurant.html";
pagesArray[3][1] = "starters.html";
pagesArray[3][2] = "burgers.html";
pagesArray[3][3] = "seafood.html";
pagesArray[3][4] = "pasta.html";
pagesArray[3][5] = "steaks.html";
pagesArray[3][6] = "favourites.html";
pagesArray[3][7] = "vegetarian.html";
pagesArray[3][8] = "sides.html";
pagesArray[3][9] = "desserts.html";
pagesArray[4] = new Array();
pagesArray[4][0] = "accomodation.html";
pagesArray[4][1] = "rooms.html";
pagesArray[4][2] = "booking.php";
pagesArray[5] = new Array();
pagesArray[5][0] = "woodysbar.html";
pagesArray[6] = new Array();
pagesArray[6][0] = "business.html";
pagesArray[6] = new Array();
pagesArray[6][0] = "occasions.html";
pagesArray[7] = new Array();
pagesArray[7][0] = "whattodo.html";
pagesArray[7][1] = "golf.html";
pagesArray[7][2] = "whisky.html";
pagesArray[7][3] = "sailing.html";
pagesArray[7][4] = "island_hopping.html";
pagesArray[7][5] = "boat_hire.html";
pagesArray[7][6] = "boat_trips.html";
pagesArray[7][7] = "walking_cycling.html";
pagesArray[7][8] = "fishing_angling.html";
pagesArray[7][9] = "shopping.html";
pagesArray[8] = new Array();
pagesArray[8][0] = "whattosee.html";
pagesArray[8][1] = "littlecumbrae.html";
pagesArray[9] = new Array();
pagesArray[9][0] = "contact.html";

/*
 * Images Array: Contains src location for looping images
 */
 
var imagesArray = new Array();
imagesArray[0] = "images/heading-woodhouse.png";
imagesArray[1] = "images/venu.png";
imagesArray[2] = "images/heading-service.png";
imagesArray[3] = "images/heading-offers.png";
imagesArray[4] = "images/heading-vouchers.png";
imagesArray[5] = "images/heading-woodhouse.png";

 
//document.getElementById('quotesImages').src = "images/heading-golf.png";

//ajaxFunction called each time a navigation link is clicked within the navigation pane.
function ajaxFunction( af_section, af_subsection ){
	currentPage = af_section;
	//alert(currentPage);
	
	var xmlHttp;
	try{
		//firefox, opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch(e){
		//Internet explorer
		try{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}

	//each time a link is clicked we have to find out which page to then display within the content div
	xmlHttp.open("GET",pagesArray[af_section][af_subsection],true);
	xmlHttp.send(null);
	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			//get the data from the server's response
			document.getElementById('content').innerHTML = xmlHttp.responseText;
			//document.location = "#content";

		}
	}
}


//javaScriptFunction is called each time the flash object changes images to affect the quote at the top of the page.
function javaScriptFunction( jsf_current_image ){
	setTimeout('document.getElementById("quotesImages").src = imagesArray['+jsf_current_image+']', 150);
	Effect.Appear('quotesImages', {from: 0.0-1.0}, {duration: 0.3});
	
	//setTimeout('document.getElementById("quotes").innerHTML = quotesArray['+jsf_current_image+']', 100);
	//Effect.Appear('quotes', {from: 0.0-1.0}, {duration: 0.1});
	//document.getElementById('quotes').style.display = '';
}