/*preload_image_object = new Image();
var imageList = new Array("small-line-sqare.gif" , "laydown-line.gif", "laydown-line2.gif", "laydown-line3.gif", "laydown-line4.gif", "laydown-line5.gif", "laydown-line6.gif", 
	"fflaydown-line.gif" , "fflaydown-line1.gif" , "fflaydown-line2.gif" , "fflaydown-line3.gif" , "fflaydown-line4.gif" , "fflaydown-line5.gif" , "fflaydown-line6.gif",
	"small-line-sqare.gif" , "menu_char_kreung_flower.jpg" , "food-img.jpg" , "fish_amok.jpg" , "ginger_flower.jpg" , "staff_Anita_Polly.jpg" , "delivery_bags.jpg" , "lightbox.jpg" )
var noOfImages = imageList.length;
window.onload = function()
{
document.getElementById('menu').style.display="none";
alert("Page is loading");
pItem = document.getElementById('main-p');
pItem.innerHTML="Loading..please wait";
preLoadImages();

}




//preload images

function preLoadImages()
{
	var pageImages = new Array();
	//alert ("no of images is " + noOfImages );
	for (x=0; x<noOfImages; x++)
	{
		preload_image_object = new Image();
		preload_image_object.src = "images/" + imageList[x];
		// if image is loaded skip this for loop
		// wait for the image to load
	/*	var flag = preload_image_object.complete;
		do
		{
			flag  = preload_image_object.complete;
			pItem.innerHTML=preload_image_object.src + " is loading..please wait";

		} while (!flag);
		alert("loading images " + preload_image_object.src);
		
		
	}    
	alert("finished preloading");
	var newNoOfImages = document.images.length;
	alert("no of images is " + newNoOfImages);	
}
*/
function displayDetails(caseItem,link)
{	
		var browserName=navigator.appName;
		//alert(browserName);
		var browserVersion=navigator.appVersion;		
		//alert(browserVersion);
		var versionNumber =  browserVersion.substring(17,25);
		//alert("fulltext " + browserVersion + "substring " + versionNumber);
		//alert("MSIE6:"+versionNumber);
		
		arr = navigator.appVersion.split("Chrome");
		if (arr.length > 1){
			browserName = "Chrome";
		}
		
		if ((browserName =="Microsoft Internet Explorer") &&(versionNumber=="MSIE 6.0")){
			
			var line1 ="laydown-line.gif";
			var line2 ="laydown-line1.gif";
			var line3 ="laydown-line2.gif";
			var line4 ="laydown-line3.gif";
			var line5 ="laydown-line4.gif";
			var line6 ="laydown-line5.gif";
			var line7 ="laydown-line6.gif";
		}else if (browserName == "Chrome"){
			var line1 = "fflaydown-line.gif";
			var line2 = "fflaydown-line1.gif";
			var line3 = "fflaydown-line2.gif";
			var line4 = "fflaydown-line3.gif";
			var line5 = "fflaydown-line4.gif";
			var line6 = "fflaydown-line5.gif";
			var line7 = "fflaydown-line6.gif";
		}else {
			var line1 = "fflaydown-line.gif";
			var line2 = "fflaydown-line1.gif";
			var line3 = "fflaydown-line2.gif";
			var line4 = "fflaydown-line3.gif";
			var line5 = "fflaydown-line4.gif";
			var line6 = "fflaydown-line5.gif";
			var line7 = "fflaydown-line6.gif";
		}					

	clearAllLinkBackgrounds();
	hItem = document.getElementById('main-h');
	pItem = document.getElementById('main-p');
	imgItem = document.getElementById('main-img');
	lineItem = document.getElementById('laydown');
	area = document.getElementById('subcontent');
	listItem = document.getElementById(link);
	listItem.style.background= "url(images/small-line-sqare.gif) no-repeat 70% 10%";
	document.getElementById('subcontent').style.background="url(images/big-line-sqare.gif) no-repeat";
	document.getElementById('main-img').style.display="inline";
	//alert("Link is " + link);
	//area.style.visibility = "visible";
	//alert ("h item is " + hItem);
	switch(caseItem)
	{
		case '1' ://alert("Case Item is " + listItem);						// FOOD
			hItem.innerHTML="Taste is at the root of all of our dishes";
			pItem.innerHTML="A culinary experience like no other, with passionate flavours and inspirational textures"
			document.getElementById('main-img').src="images/index-food.jpg";
			//imgItem.innerHTML="url(images/food-img.jpg)";
			//lineItem.style.background= "url(images/laydown-line.gif)";			
			listItem.style.background= "url(images/small-line-sqare.gif) no-repeat 60% 11%";
			lineItem.style.background= "url(images/"+line1+ ") no-repeat";
			//pItem.innerHTML="Taste is at the root of all of our dishes. ... we aim for satisfaction with every meal.";
			break;
		case '2': //alert("Case Item is " +  );								// VEGAN
			hItem.innerHTML="<span style=\"text-decoration:underline; font-family:verdana, arial, sans-serif; \">You</span> have the same taste buds as everyone else!";
			//lineItem.style.background= "url(images/laydown-line1.gif)";
			listItem.style.background= "url(images/small-line-sqare.gif) no-repeat 65% 10%";
			lineItem.style.background= "url(images/"+line5+ ") no-repeat";
			//listItemTwo.style.background= "url(images/small-line-sqare1.gif) no-repeat 55% 10%";
			document.getElementById('main-img').src="images/index-vegan-cuisine.jpg"; 
			pItem.innerHTML="Absolutely animal-free and absolutely delicious!";
			break;
		case '3': //alert("Case Item is " +  );								// KHMER
			hItem.innerHTML="Cambodian dishes are unique, bold and exciting";
			//lineItem.style.background= "url(images/laydown-line2.gif)";
			listItem.style.background= "url(images/small-line-sqare.gif) no-repeat 65% 10%";
			lineItem.style.background= "url(images/"+line6+ ") no-repeat";
			pItem.innerHTML="In Khmer cooking, vegetables are often the main ingredient, resulting in both delicious and nutritious dishes";
			document.getElementById('main-img').src="images/index-khmer-cuisine.jpg";
			break;
		case '4': //alert("Case Item is " +  );								//GINGER
			hItem.innerHTML="<img src=\"images/knyay_script_home_line.gif\" alt=\"\" style=\"margin-left:55px;\" />";
			//lineItem.style.background= "url(images/laydown-line3.gif)";
			listItem.style.background= "url(images/small-line-sqare.gif) no-repeat 93% 10%";
			lineItem.style.background= "url(images/"+line4+ ") no-repeat";
			pItem.innerHTML="";
			document.getElementById('main-img').src="images/index-ginger.jpg";
			break;
		case '5': //alert("Case Item is " +  );
			hItem.innerHTML="Food with a clear conscience";					// ABOUT
			//lineItem.style.background= "url(images/laydown-line4.gif)";
			listItem.style.background= "url(images/small-line-sqare.gif) no-repeat 63% 10%";
			lineItem.style.background= "url(images/"+line3+ ") no-repeat";
			pItem.innerHTML="Khmer & Vegan cuisine sourced locally and prepared by Cambodian chefs";
			document.getElementById('main-img').src="images/index-about.jpg";
			break;
		case '6': //alert("Case Item is " +  );								// DELIVERIRES
			hItem.innerHTML="<span style=\"position:relative;top:35px; font-family:verdana, arial, sans-serif;\">023 225 225 <br /><span style=\"font-weight:normal; font-size:20px;\"></span> <br />092 665 225</span>";
			listItem.style.background= "url(images/small-line-sqare.gif) no-repeat 68% 10%";
			lineItem.style.background= "url(images/"+line2+ ") no-repeat";
			pItem.innerHTML="";
			document.getElementById('main-img').src="images/index-deliveries.jpg";
			break;
		case '7': //alert("Case Item is " +  );								// CONTACT
			hItem.innerHTML="Search for the <span style=\"font: Times New Roman, Times sans-serif;\">'K'</span> and discover <span class=\"k-style\">K’</span><span class=\"nyay-style\">NYAY</span>!";
			//lineItem.style.background= "url(images/laydown-line6.gif)";
			listItem.style.background= "url(images/small-line-sqare.gif) no-repeat 64% 10%";
			lineItem.style.background= "url(images/"+line7+ ") no-repeat";
			pItem.innerHTML="Tranquility in the heart of Phnom Penh";
			document.getElementById('main-img').src="images/lightbox.jpg";
			break;

		default	:	alert("Reached the default case");
	}
	
}
function clearDetails(caseItem,link)
{
	listItem = document.getElementById(link);
	//hItem.innerHTML="";
	//pItem.innerHTML="";
	//imgItem.style.display = "none";
	//area.style.visibility = "hidden";
	//alert("mouseout already item " + caseItem);
	// - this line works - listItem.style.background= "none";
}
function clearAllLinkBackgrounds()
{
	listItem = document.getElementById('listItemOne');
	listItem.style.background= "none";
	listItem = document.getElementById('listItemTwo');
	listItem.style.background= "none";	
	listItem = document.getElementById('listItemThree');
	listItem.style.background= "none";	
	listItem = document.getElementById('listItemFour');
	listItem.style.background= "none";	
	listItem = document.getElementById('listItemFive');
	listItem.style.background= "none";	
	listItem = document.getElementById('listItemSix');
	listItem.style.background= "none";	
	listItem = document.getElementById('listItemSeven');
	listItem.style.background= "none";	}
	
