var currentId = ""; var currentDirection = ""; var leftPageContent = ""; var rightPageContent = ""; var linkClicked = false; var loadComplete = false; var idStart = "253"; var idEnd = "shop-20,21"; var bookClosed = true; $(document).ready(function(){ $("#leftpage").click( function() { setTimeout('GoDirection("back");', 50); }); $("#rightpage").click( function() { setTimeout('GoDirection("forward");', 50); }); }); function GoDirection(direction) { if (linkClicked) return; currentDirection = direction; if (currentDirection == "back" && currentId == "shop-1") { currentId = "shop"; LoadUrl("http://www.bobgeldof.com/content.asp"); } else if (currentDirection == "back" && currentId == idStart) { CloseBookBackClick(); } else if (currentDirection == "forward" && currentId == idEnd) { CloseBookForwardClick(); } else if (currentId.indexOf("shop") == 0) { LoadUrl("http://www.bobgeldof.com/shop.asp"); } else { LoadUrl("http://www.bobgeldof.com/content.asp"); } } function WindowLoaded(id) { currentId = id; SetLinksAjax(); setTimeout ('OpenBook();', 3500); setTimeout ('SetLinksAjax();', 2000); } function WindowLoadedContent(id) { currentId = id; SetLinksAjax(); setTimeout ('SetLinksAjax();', 2000); loadComplete = true; bookClosed = false; } function OpenBook() { $("#bookcoverext").css("display", "none"); $("#turner").css("display", "block"); $("#flip_cover").css("display", "block"); setTimeout ('$("#flip_cover").css("display", "none");', 200); loadComplete = true; bookClosed = false; } function OpenClosedBook() { $("#bookcoverend").css("display", "none"); $("#turner").css("display", "block"); $("#flip_forward").css("display", "block"); setTimeout ('$("#flip_forward").css("display", "none");', 200); bookClosed = false; } function LoadUrl(url) { var urlGet = url; if (urlGet.indexOf("?") == -1) urlGet += "?ajax=true"; else urlGet += "&ajax=true"; urlGet += "¤tId=" + currentId; urlGet += "¤tDirection=" + currentDirection urlGet += "&buster=" + String(Number(new Date())); //alert(urlGet); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var responseTxt = xmlhttp.responseText; var arrResponse = responseTxt.split(""); if (arrResponse.length == 4) { var returnId = arrResponse[0].replace("\r", "").replace("\n", "").replace(" ", ""); if (returnId.length < 1) return; if (String(returnId) == String(currentId)) return; currentId = returnId; currentDirection = arrResponse[1].replace("\r", "").replace("\n", "").replace(" ", ""); leftPageContent = arrResponse[2]; rightPageContent = arrResponse[3]; if (currentDirection == "back") { $("#flip_forward").css("display", "block"); //$("#rightpage").html(" "); //$("#leftpage").html(leftPageContent); document.getElementById("rightpage").innerHTML = " "; document.getElementById("leftpage").innerHTML = leftPageContent; setTimeout ('SetPages();', 200); } else if (currentDirection == "forward") { $("#flip_back").css("display", "block"); //$("#leftpage").html(" "); //$("#rightpage").html(rightPageContent); document.getElementById("leftpage").innerHTML = " "; document.getElementById("rightpage").innerHTML = rightPageContent; setTimeout ('SetPages();', 200); } } } } xmlhttp.open("GET", urlGet, true); xmlhttp.send(); } function SetLinksAjax() { var lnk1 = "http://www.bobgeldof.com/content.asp"; var lnk2 = "http://www.bobgeldof.com/shop.asp"; var arrLnks = document.getElementsByTagName("a"); for(i=0; i -1) continue; if (arrLnks[i].href.length >= lnk1.length) { if (arrLnks[i].href.substr(0, lnk1.length).toLowerCase() == lnk1.toLowerCase()) { arrLnks[i].href = "javascript:GoToSection('" + arrLnks[i] + "');"; } } else if (arrLnks[i].href.length >= lnk2.length) { if (arrLnks[i].href.substr(0, lnk2.length).toLowerCase() == lnk2.toLowerCase()) { arrLnks[i].href = "javascript:GoToSection('" + arrLnks[i] + "');"; } } else { arrLnks[i].onclick=function() { LinkClick(); } } } } function LinkClick() { linkClicked = true; setTimeout("linkClicked=false;", 2000); } function SetPages() { $("#flip_forward").css("display", "none"); $("#flip_back").css("display", "none"); if (currentDirection == "back") { //$("#rightpage").html(rightPageContent); document.getElementById("rightpage").innerHTML = rightPageContent; } else if (currentDirection == "forward") { //$("#leftpage").html(leftPageContent); document.getElementById("leftpage").innerHTML = leftPageContent; } SetLinksAjax(); } function GoToSection(url) { if (!loadComplete) return; if (bookClosed) { if (currentId == idEnd) OpenClosedBook() else OpenBook(); } var shopUrl = "/shop.asp"; linkClicked = true; currentDirection = ""; if (url.toLowerCase().indexOf(shopUrl) == url.length - shopUrl.length) { if (currentId == "shop-1") return; if (currentId.indexOf("shop") == 0) { currentDirection = "back"; currentId = ""; } } LoadUrl(url); setTimeout("linkClicked=false;", 1000); } function MM_preloadImages() { //v3.0 var d = document; if (d.images) { if (!d.MM_p) d.MM_p = new Array(); var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++) if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } } } function OpenBookForwardClick() { if (!loadComplete) return; currentId = idStart; OpenBook(); } function CloseBookBackClick() { $("#flip_forward").css("display", "block"); $("#rightpage").hide(); $("#leftpage").hide(); setTimeout ('CloseBookBack();', 200); } function CloseBookBack() { $("#turner").hide(); $("#rightpage").show(); $("#leftpage").show(); $("#bookcoverext").show() $("#flip_forward").hide(); bookClosed = true; } function OpenBookBackClick() { currentId = idEnd; OpenClosedBook(); } function CloseBookForwardClick() { $("#flip_back").css("display", "block"); $("#rightpage").hide(); $("#leftpage").hide(); setTimeout ('OpenBookForward();', 200); } function OpenBookForward() { $("#turner").hide(); $("#rightpage").show(); $("#leftpage").show(); $("#bookcoverend").show() $("#flip_back").hide(); bookClosed = true; } function ValidateMailingListSubmit(objForm) { LinkClick(); if (objForm.txtName.value == "") { window.alert("Name is a required field"); objForm.txtName.focus(); return false; } if (objForm.txtSurname.value == "") { window.alert("Surname is a required field"); objForm.txtSurname.focus(); return false; } if (objForm.txtEmail.value == "") { window.alert("Email Address is a required field"); objForm.txtEmail.focus(); return false; } if (objForm.txtDob.value == "") { window.alert("DOB is a required field"); objForm.txtDob.focus(); return false; } if (objForm.txtCity.value == "") { window.alert("City is a required field"); objForm.txtCity.focus(); return false; } if (objForm.txtCountry.value == "") { window.alert("Country is a required field"); objForm.txtCountry.focus(); return false; } if (objForm.txtSecurityCode.value == "") { window.alert("Please enter security code"); objForm.txtSecurityCode.focus(); return false; } return true; } function MailingListConfirmation(msg, success) { window.alert(msg); if (success) { //document.frm_mail.btnSubmitMailingList.disabled = true; document.frm_mail.txtName.value = ""; document.frm_mail.txtSurname.value = ""; document.frm_mail.txtEmail.value = ""; document.frm_mail.txtMobile.value = ""; document.frm_mail.txtDob.value = ""; document.frm_mail.txtCity.value = ""; document.frm_mail.txtCountry.value = ""; document.frm_mail.txtSecurityCode.value = ""; } }