
	function GC_MouseOut(itmRef){
		itmRef.className="navitm";
		window.document.prev_left_bracket.src  = BraketLeft.src;
		window.document.prev_right_bracket.src = BraketRight.src;
		window.document.next_left_bracket.src  = BraketLeft.src;
		window.document.next_right_bracket.src = BraketRight.src
		window.document.PrevButton.src = PrevButton.src;
		window.document.NextButton.src = NextButton.src;
	}

	function GC_Prev_MouseOver(itmRef){
		itmRef.className="navitmhover";
		window.document.prev_right_bracket.src = BraketRightHover.src;
		window.document.PrevButton.src = PrevButtonHover.src;
		window.document.prev_left_bracket.src  = BraketLeftHover.src;
	}
	
	function GC_Next_MouseOver(itmRef){
		itmRef.className="navitmhover";
		window.document.next_right_bracket.src = BraketRightHover.src;
		window.document.NextButton.src = NextButtonHover.src;
		window.document.next_left_bracket.src  = BraketLeftHover.src;
	}

	function GC_LargeImg_MouseOver(itmRef){
		window.document.LargeImageButton.src = LargeImageButtonHover.src;
	}

	function GC_LargeImg_MouseOut(itmRef){
		window.document.LargeImageButton.src = LargeImageButton.src;
	}

	function GC_Wallpaper_MouseOver(itmRef){
		window.document.WallpaperButton.src = WallpaperButtonHover.src;
	}

	function GC_Wallpaper_MouseOut(itmRef){
		window.document.WallpaperButton.src = WallpaperButton.src;
	}

		<!-- Generate Buttons for Gallery Controller-->
		<!-- / Generate Buttons for Gallery Controller-->


		function replace(string){
			var pattern = /_600x800/g;
			var newString = string.replace(pattern, "");
			return newString;
		}

		for(var intCounter=0; intCounter < ImageGallery_image800.length; intCounter++){
			ImageGallery_imageDown[intCounter] = replace(ImageGallery_image800[intCounter]);
		}

		var popEnlargeImg;
		var chosen;	

		var PrintLinkUnselected 			= new Image();
		PrintLinkUnselected.src 			= "/images/print_icon.gif";
		var PrintLinkSelected 				= new Image();
		PrintLinkSelected.src 				= "/images/print_icon_hover.gif";

		var printlink				= new Image();
		printlink.src 				= "/images/print_icon.gif";
		var printhover 				= new Image();
		printhover.src 				= "/images/print_icon_hover.gif";

	//detect screenresolution for PopUp size
	var PopScrnSize = "";
	var popWidth = 0;
	var popHeight= 0;
	PopScrnSize = screen.width + " x " + screen.height;
	switch(PopScrnSize) {
		case "800 x 600": 
		popWidth=669;
		popHeight=570;
		break;
		case "1024 x 768":
		popWidth=669;
		popHeight=570;
		break;
		case "1280 x 1024":
		popWidth=1094;
		popHeight=846;
		break;
		case "1600 x 1200":
		popWidth=1400;
		popHeight=1030;
		break;
		default:
		popWidth=669;
		popHeight=570;
		break;
	}
		
	function writeScreenSize(){
		document.getElementById("screensize").innerHTML = PopScrnSize;
	}
		  
	
	var intLastpressed = 1;
	
function popupImage(){if(popEnlargeImg!=null && !popEnlargeImg.closed){popEnlargeImg.close();}var URL = '/uk/en/xk/gallery/photography.htm?func=1&picno=' + intLastpressed + '&popwidth=' + popWidth +  '&popheight=' + popHeight;var windowName = 'BigImageWindow';var features = 'width=' + popWidth + ',height=' + popHeight + ', status=yes';popEnlargeImg = window.open (URL, windowName, features);popEnlargeImg.focus();}



	function swaplink_print_over()
	{
		swaplink('printimageid', PrintLinkSelected,'printanchorid','texthover');
	}

	function swaplink_print_out()
	{
		swaplink('printimageid', PrintLinkUnselected,'printanchorid','textlink');
	}

	function print_window_open()
	{

		var strUrl = "/uk/en/xk/gallery/photography.htm" + "?printPage=" + intLastpressed;
		window.open(strUrl,'Print','height=580,width=760,menubar=yes,resizable=yes,scrollbars=yes,titlebar=0,toolbar=no');

	}

	function DownloadWallpaper()
	{
		var strPath = "/uk/en/xk/gallery/photography.htm";
		var strName = "photography";
		var strImage = strPath.substring(0,strPath.length - strName.length - 4) + ImageGallery_imageDown[intLastpressed - 1];
		OpenDownloadWallpaperPopup('/uk/en/_misc/JLR_DownloadWallpaperPopup.htm',strImage,'760','520',PopScrnSize)
	}
	function doNextPrev(intNumber)
	{
		if((intLastpressed + intNumber) > (ImageGallery_image50.length)){
			doNormal(intLastpressed);
			intLastpressed = 1;
			switchPicture(intLastpressed);
			switchText(intLastpressed);
			doSelected(intLastpressed);
		} else if((intLastpressed + intNumber) < 1){
				doNormal(intLastpressed);
				intLastpressed = ImageGallery_image50.length;
				switchPicture(intLastpressed);
				switchText(intLastpressed);
				doHighlight(intLastpressed);
		} else {
			doNormal(intLastpressed);
			intLastpressed = intLastpressed + intNumber;
			switchPicture(intLastpressed);
			switchText(intLastpressed);
			doSelected(intLastpressed);
		}
//		switchCarousel();		
	}
	
	function writeThumbnailBlock(i)
	{
		document.write('<table border="0" cellspacing="0" cellpadding="0" width="67">');
		document.write('<tr>');
		document.write('<td colspan="5" width="67" height="3" id="td_' + i + '_1"><img src="/images/1px.gif" alt="" height="3" width="67" border="0" /></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td rowspan="3" width="3" id="td_' + i + '_4"><img src="/images/1px.gif" alt="" height="1" width="3" border="0" /></td>');
		document.write('<td colspan="3" width="61" id="tdw_' + i + '_1"><img src="/images/1px.gif" alt="" height="1" width="61" border="0" /></td>');
		document.write('<td rowspan="3" width="3" id="td_' + i + '_2"><img src="/images/1px.gif" alt="" height="1" width="3" border="0" /></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td width="1" id="tdw_' + i + '_4"><img src="/images/1px.gif" alt="" height="1" width="1" border="0" /></td>');
		document.write('<td width="59"><a href="javascript:switchPicture(' + i + ');" onmouseover="doHighlight(' + i + ');"  onmouseout="doNormal(' + i + ');"><img src="/pictures/gallery/' + ImageGallery_image89[i - 1] + '" width="59" border="0"/></a></td>');
		document.write('<td width="1" id="tdw_' + i + '_2"><img src="/images/1px.gif" alt="" height="1" width="1" border="0" /></td>');		
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td colspan="3" width="61" id="tdw_' + i + '_3"><img src="/images/1px.gif" alt="" height="1" width="61" border="0" /></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td colspan="5" width="67" height="3" id="td_' + i + '_3"><img src="/images/1px.gif" alt="" height="3" width="67" border="0" /></td>');
		document.write('</tr>');
		document.write('</table>');
	}
	
	function writeEmptyThumbnailBlock()
	{
		document.write('<table border="0" cellspacing="0" cellpadding="0" width="67">');
		document.write('<tr>');
		document.write('<td colspan="5" width="67" height="3"><img src="/images/1px.gif" alt="" height="2" width="67" border="0" /></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td rowspan="3" width="1"><img src="/images/1px.gif" alt="" height="1" width="1" border="0" /></td>');
		document.write('<td colspan="3" width="61"><img src="/images/1px.gif" alt="" height="1" width="61" border="0" /></td>');
		document.write('<td rowspan="3" width="1"><img src="/images/1px.gif" alt="" height="1" width="1" border="0" /></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td width="1"><img src="/images/1px.gif" alt="" height="1" width="1" border="0" /></td>');
		document.write('<td width="59"><img src="/images/1px.gif" alt="" height="1" width="59" border="0" /></td>');
		document.write('<td width="1"><img src="/images/1px.gif" alt="" height="1" width="1" border="0" /></td>');		
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td colspan="3" width="61"><img src="/images/1px.gif" alt="" height="1" width="61" border="0" /></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td colspan="5" width="67" height="3"><img src="/images/1px.gif" alt="" height="3" width="67" border="0" /></td>');
		document.write('</tr>');
		document.write('</table>');
	}
	
	function generateGallery()
	{
		var introws = ImageGallery_image89.length / 6;

		if(introws<=1) {
			introws = 1;
		} else {
			if(introws<=2) {
				introws = 2;
			} else {
				if(introws<=3) {
					introws = 3;
				}
			}
		}


		var intStart =1;
		var intEnd = 7;

		document.write('<table border="0" cellspacing="0" cellpadding="0" width="402">');
		document.write('<tr><td colspan="11" height="4"></td></tr>');

		for(var j=1; j<=introws; j++)
		{
//			document.write('<tr><td colspan="11" height="2"></td></tr>');

			
			document.write('<tr>');
			document.write('<td width="0"></td>');
			for(var i=intStart; i<intEnd; i++)
			{
				if(i<=ImageGallery_image89.length){
					if (i<intEnd){
						document.write('<td width="67">');
						writeThumbnailBlock(i);
						document.write('</td>');
//						document.write('<td width="0"><img src="/images/1px.gif" alt="" width="0" border="0" /></td>');
				} else {
						document.write('<td width="67">');
						writeThumbnailBlock(i);
						document.write('</td>');
					}
				} else {
					if (i<intEnd){
						document.write('<td width="67">');
						writeEmptyThumbnailBlock();
						document.write('</td>');
//						document.write('<td width="2"><img src="/images/1px.gif" alt="" width="0" border="0" /></td>');
					} else {
						document.write('<td width="67">');
						writeEmptyThumbnailBlock();
						document.write('</td>');
					}
				}
			}

			document.write('<td width="11"></td>');
			document.write('</tr>');

//			document.write('<tr><td colspan="11" height="0"></td></tr>');
			intStart= intStart + 6;
			intEnd= intEnd + 6;
		}
//		document.write('<tr><td colspan="11" height="0"></td></tr>');
		document.write('</table>');
	}

	function doDefaultColor()
	{
		for(var i=1; i<=ImageGallery_image89.length; i++){
			doNormal(i);
		}
	}

	function doHighlight(intNumber)
	{
		if(intLastpressed != intNumber){
			for (var i = 1; i<=4; i++){
				document.getElementById("td_" + intNumber + "_" + i).className = "td_green";
				document.getElementById("tdw_" + intNumber + "_" + i).className = "td_white";
			}
		}
	}

	function doNormal(intNumber)
	{	
		if(intLastpressed != intNumber){
			for (var i = 1; i<=4; i++){
				document.getElementById("td_" + intNumber + "_" + i).className = "td_gray_gal";
				document.getElementById("td_" + intNumber + "_" + i).className = "td_gray_gal";
			}
		}
	}

	function doSelected(intNumber)
	{
		for (var i = 1; i<=4; i++){
			document.getElementById("td_" + intNumber + "_" + i).className = "td_black";
			document.getElementById("tdw_" + intNumber + "_" + i).className = "td_white";
		}
	}

	function switchPicture(intNumber)
	{
		if (document.getElementById){
			document.img_big.src = "/pictures/gallery/"+ImageGallery_image452[intNumber - 1];
			if (ImageGallery_image1024[intNumber - 1] != '') {
				document.getElementById("download_wallpaper").style.visibility = "visible";
			}
			else {
				document.getElementById("download_wallpaper").style.visibility = "hidden";
			}
			switchText(intNumber);
			doSelected(intNumber);
		}
		intLastpressed = intNumber;
		doDefaultColor();
//		switchCarousel();
	}

	function switchText(intNumber)
	{
		if (document.getElementById){
			document.getElementById("imagetext").innerHTML = ImageGallery_textArray[intNumber - 1];
		}
	}

	function createImageUtilBlock()
	{
		var arrSizes = new Array('800 x 600','1024 x 768','1280 x 1024','1600 x 1200');

		document.write('<table border="0" cellspacing="0" cellpadding="0" width="131">');
		for (var i=1; i<5; i++){
			if(arrSizes[i-1]!=PopScrnSize){
				document.write('<tr>');
				document.write('<td width="15" height="9"><a class="ImageUtilityLink" onmouseover="swaplinkover(' + i + ', ScreenSizeImageSelected,' + i + ');" onmouseout="swaplinkout(' + i + ', ScreenSizeImageUnselected,' + i + ');" href="javascript:DownloadWallpaper();"><img id="screensizeimgid_' + i + '" src="/images/open_window.gif" alt="" width="15" height="9" border="0"/></a></td>');
				document.write('<td width="116" height="9"><a class="ImageUtilityLink" onmouseover="swaplinkover(' + i + ',ScreenSizeImageSelected,' + i + ');" onmouseout="swaplinkout(' + i + ',ScreenSizeImageUnselected,' + i + ');" href="javascript:DownloadWallpaper();" id="screensizetextid_' + i + '">' + arrSizes[i-1] + '</a></td>');
				document.write('</tr>');
			} else {
				document.write('<tr>');
				document.write('<td width="15" height="9"><a class="ImageUtilityLinkBold" href="javascript:DownloadWallpaper();"><img id="screensizeimgid_' + i + '" src="/images/open_window.gif" alt="" width="15" height="9" border="0"/></a></td>');
				document.write('<td width="116" height="9"><a class="ImageUtilityLinkBold" href="javascript:DownloadWallpaper();" id="screensizetextid_' + i + '">' + arrSizes[i-1] + '</a></td>');
				document.write('</tr>');
			}
		}
		document.write ('</table>');
	}

		function swaplink(imageid, imageobject, textid, stylename)
		{
			document.getElementById(imageid).src = imageobject.src;
			if( (textid) != 0) document.getElementById(textid).className = stylename; 
		}

		function swaplinkover(imageid, imageobject, textid, stylename) 
		{
			document.getElementById("screensizeimgid_" + imageid).src = imageobject.src;
			if( ("screensizetextid_" + textid) != 0) {
					document.getElementById("screensizetextid_" + textid).className = "ImageUtilityTextLinkHover"; 
					document.getElementById("screensizetextid_" + textid).style.color = "#0F5F5C";
			}
			//document.getElementById(textid).className = stylename; 
		}

		function swaplinkout(imageid, imageobject, textid, stylename) 
		{
			document.getElementById("screensizeimgid_" + imageid).src = imageobject.src;
			if("screensizetextid_" + textid != 0) {
					document.getElementById("screensizetextid_" + textid).className = "ImageUtilityTextLink"; 
					document.getElementById("screensizetextid_" + textid).style.color = "#000000";
			}
			//document.getElementById(textid).className = stylename;
		}
	function writeImageImageCarousel()
	{
		var intPrevImage;
		var intNextImage;
		if (intLastpressed <=  1)
		{
			intPrevImage = ImageGallery_image50.length;
		} else {
			intPrevImage = intLastpressed - 1;
		}

		if (intLastpressed >= ImageGallery_image50.length)
		{
			intNextImage = ImageGallery_image50.length - 1;
		} else {
			intNextImage = intLastpressed;
		}	

		if (ImageGallery_image50.length > 2){

			var strHtml = ''
			strHtml =  '<table width="110" height="30" align="center" border="0" cellspacing="0" cellpadding="0">';
			strHtml += '<tr>';
//			strHtml += '<td width="9"><img src="/images/1px.gif" width="9" height="1" border="0" alt="" /></td>';
			strHtml += '<td width="50" height="30"><img src="/pictures/gallery/' + ImageGallery_image50[intPrevImage - 1] + '" alt="" width="50" height="30" border="0" id="img_prev" name="img_prev"></td>';
			strHtml += '<td width="10"><img id="prev_image" src="/images/1px.gif" width="1" height="1" border="0" alt="" /></td>';
			strHtml += '<td width="50" height="30"><img src="/pictures/gallery/' + ImageGallery_image50[intNextImage] + '" alt="" width="50" height="30" border="0" id="img_next" name="img_next"></td>';
//			strHtml += '<td width="9"><img  src="/images/1px.gif" width="9" height="1" border="0" alt="" /></td>';
			strHtml += '</tr>';
			strHtml += '<tr>';
			strHtml += '<td width="128" height="3" colspan="3"></td>';
			strHtml += '</tr>';
			strHtml += '</table>';
			document.getElementById("Images").innerHTML = strHtml;

			strHtml =  '<table width="110" height="30" align="center" border="0" cellspacing="0" cellpadding="0">';
			strHtml += '<tr>';
//			strHtml += '<td width="9"><img src="/images/1px.gif" width="9" height="1" border="0" alt="" /></td>';
			strHtml += '<td width="50"><div class="navNextBefore" id="navNextBefore01"><div class="navitm" onmouseover="Nav_MouseOver(this);" onmouseout="Nav_MouseOut(this);" id="prev" onclick="doNextPrev(-1)">< Prev</div></div></td>';
			strHtml += '<td width="10"><img src="/images/1px.gif" width="10" height="1" border="0" alt="" /></td>';
			strHtml += '<td width="50"><div class="navNextBefore" id="navNextBefore02"><div class="navitm" onmouseover="Nav_MouseOver(this);" onmouseout="Nav_MouseOut(this);" id="next" onclick="doNextPrev(1)">Next ></div></div></td>';
//			strHtml += '<td width="9"><img src="/images/1px.gif" width="9" height="1" border="0" alt="" /></td>';
			strHtml += '</tr>';
			strHtml += '</table>';
			document.getElementById("Carousel").innerHTML = strHtml;
		}	
	}

	function GC_MouseOver(itmRef){
		itmRef.className="navitmhover";
	}
	
	var BraketLeft = new Image();
	BraketLeft.src = "/BrandsCommon/img/1px.gif";
	var BraketLeftHover = new Image();
	BraketLeftHover.src = "/images/gallerynavbracket_left.gif";
	var BraketRight = new Image();
	BraketRight.src = "/BrandsCommon/img/1px.gif";
	var BraketRightHover = new Image();
	BraketRightHover.src = "/images/gallerynavbracket_right.gif";

	var PrevButton = new Image();
	PrevButton.src = 't2g_navigation01_1_photography_D22CB975-D834-4035-9B08-B62923E36734.jpg';
	var PrevButtonHover = new Image();
	PrevButtonHover.src = 't2g_navigation01_on_5_photography_D22CB975-D834-4035-9B08-B62923E36734.jpg';
	var NextButton = new Image();
	NextButton.src = 't2g_navigation01_2_photography_D22CB975-D834-4035-9B08-B62923E36734.jpg';
	var NextButtonHover = new Image();
	NextButtonHover.src = 't2g_navigation01_on_6_photography_D22CB975-D834-4035-9B08-B62923E36734.jpg';

	var LargeImageButton = new Image();
	LargeImageButton.src = 't2g_navigation01_3_photography_D22CB975-D834-4035-9B08-B62923E36734.jpg';
	var LargeImageButtonHover = new Image();
	LargeImageButtonHover.src = 't2g_navigation01_on_7_photography_D22CB975-D834-4035-9B08-B62923E36734.jpg';
	var WallpaperButton = new Image();
	WallpaperButton.src = 't2g_navigation01_4_photography_D22CB975-D834-4035-9B08-B62923E36734.jpg';
	var WallpaperButtonHover = new Image();
	WallpaperButtonHover.src = 't2g_navigation01_on_8_photography_D22CB975-D834-4035-9B08-B62923E36734.jpg';


