var CurGalleryImage = 0; function LaunchGallery(ImageID,ImageSource,width,height,animate) { CurGalleryImage = ImageID; if (animate==1) { $("#DialogOverlay").css("opacity", 0.6); $("#DialogOverlay").fadeIn(300, function() { SetGalleryLayout() }); document.getElementById("GalleryLayout").style.width = (width+6)+'px'; document.getElementById("GalleryLayout").style.height = (height+65)+'px'; } else { $("#GalleryLayout").animate({ width:(width+6)+'px', height:(height+65)+'px' }, 400); } document.getElementById("GalleryContent").style.height = (height+33)+'px'; $("#GalleryContentData").load(ImageSource); document.onkeyup = function(event) { var keycode = window.event ? window.event.keyCode : event.which; if (keycode == 27) { GalleryUnload(); } if (keycode == 39) { AnimateGalleryControl("R"); GalleryNext(); } if (keycode == 37) { AnimateGalleryControl("L"); GalleryPrev(); } } } function SetGalleryLayout() { if (navigator.userAgent.indexOf("MSIE 7")!=-1 || navigator.userAgent.indexOf("MSIE 6")!=-1) { document.getElementById("GalleryContainer").style.display = "block"; document.getElementById("GalleryContainer").style.marginTop = "100px"; } else { document.getElementById("GalleryContainer").style.display = "table"; } } function GalleryNext() { if (CurGalleryImage+1==GALLERY.length) { CurGalleryImage=0; } else { CurGalleryImage++; } LaunchGallery(CurGalleryImage,"/gallery.php?VehicleID="+GALLERY[CurGalleryImage]["VehicleID"]+"&ImageID="+GALLERY[CurGalleryImage]["ImageID"],GALLERY[CurGalleryImage]["Width"],GALLERY[CurGalleryImage]["Height"],0); } function GalleryPrev() { if (CurGalleryImage==0) { CurGalleryImage=GALLERY.length-1; } else { CurGalleryImage--; } LaunchGallery(CurGalleryImage,"/gallery.php?VehicleID="+GALLERY[CurGalleryImage]["VehicleID"]+"&ImageID="+GALLERY[CurGalleryImage]["ImageID"],GALLERY[CurGalleryImage]["Width"],GALLERY[CurGalleryImage]["Height"],0); } function AnimateGalleryControl(id) { document.getElementById("GalleryArrow"+id).style.marginTop = '-30px'; setTimeout("document.getElementById('GalleryArrow"+id+"').style.marginTop = '0px';",400); } function GalleryImageOver(obj,id) { obj.style.cursor = "pointer"; document.getElementById("THUMB"+id).style.backgroundColor = "#0066CC"; document.getElementById("THUMB"+id).style.borderTop = "solid 1px #0044AA"; document.getElementById("THUMB"+id).style.borderBottom = "solid 1px #0044AA"; document.getElementById("THUMB"+id).style.borderRight = "solid 1px #0044AA"; document.getElementById("THUMB"+id).style.borderLeft = "solid 1px #0044AA"; } function GalleryImageOut(obj,id) { obj.style.cursor = ""; document.getElementById("THUMB"+id).style.backgroundColor = "#FFFFFF"; document.getElementById("THUMB"+id).style.borderTop = "solid 1px #DDDDDD"; document.getElementById("THUMB"+id).style.borderBottom = "solid 1px #DDDDDD"; document.getElementById("THUMB"+id).style.borderRight = "solid 1px #DDDDDD"; document.getElementById("THUMB"+id).style.borderLeft = "solid 1px #DDDDDD"; } function GalleryUnload() { $("#DialogOverlay").fadeOut(200); Lib_ClearElement(document.getElementById("GalleryContentData")); document.getElementById("GalleryContainer").style.display = "none"; } function System_GalleryCloseOver() { document.getElementById("GalleryCloseButton").style.backgroundPosition = '0px -18px'; } function System_GalleryCloseOut() { document.getElementById("GalleryCloseButton").style.backgroundPosition = '0px 0px'; } function Lib_ClearElement(obj) { if (obj) { while(obj.firstChild) obj.removeChild(obj.firstChild); } }