var container = ""; var content = ""; var scrolltimer = ""; var list_width = 0; function init() { container = document.getElementById('scroll_container'); content = document.getElementById('scroll_content'); var list = content.getElementsByTagName('ul'); var items = list[0].getElementsByTagName('li'); var i = 0; while (i < items.length) { list_width += items[i].offsetWidth; i+=1; } content.style.width = (list_width+(container.offsetWidth/2)+items[(items.length-1)].offsetWidth)+'px'; container.scrollLeft = (list_width/2)+40; } function scrollToLeft() { if (scrolltimer == "") { scrolltimer = setInterval("scrollLeft()", 25); } } function scrollLeft() { container.scrollLeft+=10; } function scrollToRight() { if (scrolltimer == "") { scrolltimer = setInterval("scrollRight()", 25); } } function scrollRight() { container.scrollLeft-=10; } function stopMe() { clearInterval(scrolltimer); scrolltimer = ""; } function scrollTo(id) { stopMe(); var menu = document.getElementById('menu'); menu.style.left = '40px'; scrolltimer = setInterval("scrollToArtistId('"+id+"')", 25); } function scrollToArtistId(id) { var item = document.getElementById(id); var iLeft = item.offsetLeft-container.scrollLeft; var checkLeft = (item.offsetWidth/2)-(item.offsetWidth+5)+(container.offsetWidth/2); var checkRight = (item.offsetWidth/2)-(item.offsetWidth-5)+(container.offsetWidth/2); if (iLeft < checkLeft) { if ((checkLeft-iLeft) > 600) { container.scrollLeft-=(80); } else if ((checkLeft-iLeft) > 400) { container.scrollLeft-=(60); } else if ((checkLeft-iLeft) > 200) { container.scrollLeft-=(40); } else { container.scrollLeft-=(20); } iLeft = item.offsetLeft-container.scrollLeft; checkLeft = (item.offsetWidth/2)-(item.offsetWidth+5)+(container.offsetWidth/2); if (iLeft > checkLeft) { stopMe(); } } if (iLeft > checkRight) { if ((iLeft-checkRight) > 600) { container.scrollLeft+=(80); } else if ((iLeft-checkRight) > 400) { container.scrollLeft+=(60); } else if ((iLeft-checkRight) > 200) { container.scrollLeft+=(40); } else { container.scrollLeft+=(20); } iLeft = item.offsetLeft-container.scrollLeft; checkRight = (item.offsetWidth/2)-(item.offsetWidth-5)+(container.offsetWidth/2); if (iLeft < checkRight) { stopMe(); } } } function scrollMenu() { var menu = document.getElementById('menu'); mLeft = parseInt(menu.style.left); if (mLeft < 10) { mLeft +=20; menu.style.left = mLeft+'px'; } else { stopMe(); } if (scrolltimer == "" && mLeft < 10) { scrolltimer = setInterval("scrollMenu()", 25); } } function unScrollMenu() { var menu = document.getElementById('menu'); mLeft = parseInt(menu.style.left); if (mLeft > -335) { mLeft -=20; menu.style.left = mLeft+'px'; } else { stopMe(); } if (scrolltimer == "" && mLeft > -335) { scrolltimer = setInterval("unScrollMenu()", 25); } } var xmlhttp; function showDescription(url) { document.getElementById('inline_popup').style.display = 'none'; document.getElementById('inline_popup').innerHTML = ''; xmlhttp=null; if (window.XMLHttpRequest) { // code for all new browsers xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE5 and IE6 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } if (xmlhttp!=null) { xmlhttp.onreadystatechange=popLoaded; xmlhttp.open("GET",url,true); xmlhttp.send(null); } } function popLoaded() { if (xmlhttp.readyState==4) { if (xmlhttp.status==200) { document.getElementById('inline_popup').innerHTML = xmlhttp.responseText; document.getElementById('inline_popup').style.display = 'block'; } } } function hideDescription() { var description = document.getElementById('inline_popup'); description.style.display = 'none'; description.innerHTML = ''; } function hideNews() { var description = document.getElementById('news_popup'); description.style.display = 'none'; description.innerHTML = ''; } var map; var gdir; var address; var mapsUrl; var mapsLocale; var geocoder = null; var addressMarker; function initMaps(targetaddress, url, locale) { address = targetaddress; mapsUrl = url; mapsLocale = locale; if (GBrowserIsCompatible()) { geocoder = new GClientGeocoder(); map = new GMap2(document.getElementById("map")); showAddress(address); gdir = new GDirections(map, document.getElementById("directions")); GEvent.addListener(gdir, "error", handleErrors); } } function showAddress(address) { geocoder.getLatLng(address, function(point) { if (!point) { alert(address + " not found"); } else { map.setCenter(point, 13); addressMarker = new GMarker(point); map.addOverlay(addressMarker); xmlhttp=null; if (window.XMLHttpRequest) { // code for all new browsers xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE5 and IE6 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } if (xmlhttp!=null) { xmlhttp.onreadystatechange=addressLoaded; xmlhttp.open("GET",mapsUrl,true); xmlhttp.send(null); } } }); } function addressLoaded() { if (xmlhttp.readyState==4) { if (xmlhttp.status==200) { addressMarker.openInfoWindowHtml(xmlhttp.responseText); } } } function setDirections(fromAddress) { gdir.load("from: " + fromAddress + " to: " + address,{ "locale": mapsLocale }); } function handleErrors() { if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS) { alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code); } else if (gdir.getStatus().code == G_GEO_SERVER_ERROR) { alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code); } else if (gdir.getStatus().code == G_GEO_MISSING_QUERY) { alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code); } else if (gdir.getStatus().code == G_GEO_BAD_KEY) { alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code); } else if (gdir.getStatus().code == G_GEO_BAD_REQUEST) { alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code); } else { alert("An unknown error occurred."); } }