// to make back button work in IE when chaging URL # for inpage navigation
var backbuttonfix = false;
//var detect = navigator.userAgent.toLowerCase();
//if (detect.indexOf("msie")>-1) backbuttonfix = true;
var outputMissingShows = false;
var outputMissingShowsEmail = "";
var outputMissingShowsGalleryURL = "";
var debugCnt = 0;
function debugMsg(msg) {
return;
debugCnt++;
var el = document.getElementById("debugdiv");
el.style.display = 'block';
el.style.zIndex = 10000;
var str = el.innerHTML;
str = str.substr(0, 1000);
el.innerHTML = debugCnt + ':' + msg + '
' + str;
}
/* CROSS-BROWSER EVENT HANDLER */
function addEvent(obj, evType, fn){
if (obj.addEventListener){
obj.addEventListener(evType, fn, true);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
return false;
}
}
/**
if (window.dhtmlHistory) {
window.dhtmlHistory.create();
}
***/
var historyChange = function(newLocation, historyInfo) {
//debugMsg('IM2: ' + newLocation);
maybeChangeImage2();
}
var oldImgPerDiv = {};
function maybeChangeImage2() {
tabmatch = /imgtab=([0-9]+)-([0-9]+)/;
//tabmatches = false;
tabmatches = tabmatch.exec(location.hash);
newmatch = 0;
newdiv = 0;
if (tabmatches) {
newmatch = tabmatches[1];
newdiv = tabmatches[2];
}
oldImg = oldImgPerDiv[newdiv];
if (oldImg != newmatch && newmatch > 0) {
selectImg2(newmatch, newdiv);
}
// need to check again ever so often, since browser doesn't have an event when back button is pressed to
}
/**
window.onload = function() {
dhtmlHistory.initialize();
dhtmlHistory.addListener(historyChange);
};
**/
function pageWidth() {
if (window.innerWidth != null) {
return window.innerWidth;
}
else if (document.documentElement && document.documentElement.clientWidth) {
return document.documentElement.clientWidth;
}
else if (document.body != null) {
return document.body.clientWidth;
}
else {
return null;
}
}
function pageHeight() {
if (window.innerHeight != null) {
return window.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight) {
return document.documentElement.clientHeight;
}
else if (document.body != null) {
return document.body.clientHeight;
}
else {
return null;
}
}
function initMenu() {
// check screen resolution, and if too low, make the menu scroll
//alert (pageWidth() + ':' + pageHeight());
if (pageHeight() < 500 || pageWidth() < 800) {
el = document.getElementById('contain-menu');
if (el) {
el.style.position = 'absolute';
}
}
/***
el = document.getElementById('menublock');
if (el) {
// move from position in HTML stream to correct parent where it doesn't scroll
el_parent = el.parentNode;
el_parent.removeChild(el);
el_to = document.getElementById('contain-menu');
if (el_to) {
el_to.appendChild(el);
el.style.display = 'block';
//alert(1);
}
}
***/
}
var initLocationsFunction = function() {};
function afterPageLoad() {
initMenu();
resetForms();
initTip();
maybeDisplayMissingShows();
maybeChangeImage2();
onLoadFlash();
maybeScrollWelcome();
maybeStartInventory();
initLocationsFunction();
startLiveTimes();
loadDelayedImages();
//ajax_containerDiv = document.getElementById('contain-menu');
//dhtmlHistory.initialize();
//dhtmlHistory.addListener(maybeChangeImage2);
}
function loadDelayedImages() {
// load images that aren't need right away, because they might not be visible
var images = document.images;
for (var i = 0; i < images.length; i++) {
var img = images[i];
var delayedSrc = DOM.getAttribute(img, 'delayedSrc');
if (delayedSrc) {
img.src = delayedSrc;
}
}
}
function maybeDisplayMissingShows(siteName) {
if (outputMissingShows) {
el = document.getElementById("missingshows");
if (el) {
var str = "
No Current Exhibition Information Available";
str += "Please help us keep this information current by letting the gallery/museum know that their ";
str += "listing on " + outputMissingShows + " is out-of-date.";
if (outputMissingShowsEmail != "") {
str += " You can drop them a quick note by email: ";
str += '
' + outputMissingShowsEmail + '.
If you are with the gallery, please login to update your shows. If you are not yet a member of our network of galleries, please sign up
here.
';
//For%20your%20gallery%20there%20are%20no%20current%20or%20future%20shows%20listed:%0Ahttp://' +outputMissingShows + outputMissingShowsGalleryURL + '%20%0a%0aPlease%20work%20with%20' + outputMissingShows + '%20to%20update%20this%20valuable%20resource.
//http://chelseaartgalleries.com">' + outputMissingShowsEmail + '.';
}
el.innerHTML = str;
}
}
}
function toggleGeoAddress(val, cnt) {
el = document.getElementById("geoaddress_" + cnt);
if (val == 0) {
el.className = "showAddress";
}
else {
el.className = "hideAddress";
}
return true;
}
function saveToTour(id) {
saveToTourInner('add_gid=' + id);
}
function saveToTourLink(sid, lid) {
el = document.getElementById('link_' + sid);
if (el != null) {
if (el.className == 'tourdelete') {
el.innerHTML = '
';
el.className = 'touradd';
op = 'delete_gid=' + sid;
}
else if (el.className == 'tourgallery') {
op = 'delete_gid=' + lid;
el.className = 'touradd';
el.innerHTML = '
';
}
else {
op = 'add_gid=' + sid;
el.className = 'tourdelete';
el.innerHTML = '
';
}
}
saveToTourInner(op);
}
function closeTourWin() {
el = document.getElementById('toursave');
el.style.display = 'none';
el = document.getElementById('mytour_display');
if (el != null) {
el.innerHTML = "";
}
}
function saveToTourInner(op) {
yd = document.body.scrollTop + document.documentElement.scrollTop;
y = 100 + yd;
el = document.getElementById('toursave');
if (el != null) {
el.style.top = y + 'px';
el.style.display = "block";
el = document.getElementById('toursaveframe');
el.innerHTML = "";
el = document.getElementById('mytour_display');
if (el != null) {
el.innerHTML = "
See Tour Window...";
}
}
}
maybeTimeout = null;
runTrajectory = null;
function maybeRunAdTrajectory(x, y, targetx, targety, speed, step, trajectory, adid) {
if (runTrajectory != null) return;
if (maybeTimeout == null) {
funcall2 = "maybeRunAdTrajectory2(" + x + "," + y + "," + targetx + "," + targety + "," + speed + "," + step + "," + trajectory + "," + adid + ")";
maybeTimeout = setTimeout(funcall2, 800);
}
}
function dontRunAdTrajectory() {
if (maybeTimeout != null) {
clearTimeout(maybeTimeout);
maybeTimeout = null;
}
}
function maybeRunAdTrajectory2(x, y, targetx, targety, speed, step, trajectory, adid) {
maybeTimeout = null;
if (runTrajectory == null) {
runAdTrajectory(x, y, x, y, targetx, targety, speed, step, trajectory, adid);
}
}
function runAdTrajectory(x, y, origx, origy, targetx, targety, speed, step, trajectory, adid) {
runTrajectory = null;
var oldx = x;
var oldy = y;
el = document.getElementById('ad_' + adid);
if (el == null) {
return;
}
el.style.top = y + "px";
el.style.left = x + "px";
if (Math.abs(x - targetx) == 0 && Math.abs(y - targety) == 0) {
// reached target
if (trajectory > 100) {
trajectory--;
funcall = "runAdTrajectory(" + origx + "," + origy + "," + origx + "," + origy + "," + targetx + "," + targety + "," + speed + "," + step + "," + trajectory + "," + adid + ")";
if (runTrajectory == null) {
runTrajectory = setTimeout(funcall, speed);
}
return;
}
}
if (Math.abs(x - targetx) > Math.abs(y - targety)) {
if (x > targetx) x -= step;
else if (x < targety) x += step;
}
else if (Math.abs(y - targety) > Math.abs(x - targetx)) {
if (y > targety) y -= step;
else if (y < targety) y += step;
}
else {
if (x > targetx) x -= step;
else if (x < targetx) x += step;
if (y > targety) y -= step;
else if (y < targety) y += step;
}
var postdiff = Math.abs(x - targetx) + Math.abs(y - targety);
if ((oldx - targetx) * (x - targetx) < 0) {
x = targetx;
}
if ((oldy - targety) * (y - targety) < 0) {
y = targety;
}
if ((x != oldx) || (y != oldy)) {
funcall = "runAdTrajectory(" + x + "," + y + "," + origx + "," + origy + "," + targetx + "," + targety + "," + speed + "," + step + "," + trajectory + "," + adid + ")";
if (runTrajectory == null) {
runTrajectory = setTimeout(funcall, speed);
}
return;
}
}
function youtube(id, url) {
el = document.getElementById('youtube_' + id);
el.innerHTML = "";
}
function selectImg2(img, imgDiv) {
oldImg = oldImgPerDiv[imgDiv];
if (oldImg > 0) {
el = document.getElementById('img_' + oldImg + '_' + imgDiv);
if (el) el.style.display = 'none';
el = document.getElementById('tab_' + oldImg + '_' + imgDiv);
if (el) el.className = 'unselectedimg';
}
el = document.getElementById('img_' + img + '_' + imgDiv);
if (el) el.style.display = 'block';
el = document.getElementById('tab_' + img + '_' + imgDiv);
if (el) el.className = 'selectedimg';
//dhtmlHistory.add("imgtab=" + img + '-' + imgDiv, oldImg + '-' + imgDiv);
oldImgPerDiv[imgDiv] = img;
//debugMsg('HISTORY ADD: ' + img + ':' + oldImg);
/***
location.hash = "#imgtab=" + img;
// to make back button work, update a temporary iframe
if (backbuttonfix) {
el = document.frames['backbuttonframe'];
el.location = '/images/1px.gif?imgtab=' + img;
}
***/
}
function maybeSetImage() {
tabmatch = /imgtab=([0-9]+)/;
//tabmatches = false;
if (backbuttonfix) {
el = document.frames['backbuttonframe'];
if (el) {
m = el.location;
if (m == 'about:blank') {
m = location.hash;
}
tabmatches = tabmatch.exec(m);
}
}
else {
tabmatches = tabmatch.exec(location.hash);
}
newmatch = 0;
if (tabmatches) {
newmatch = tabmatches[1];
}
if (oldImg != newmatch) {
selectImg(newmatch);
}
// need to check again ever so often, since browser doesn't have an event when back button is pressed to
// this page
setTimeout("maybeSetImage()", 300);
}
function edit(name) {
document.location.href = "/index.php?name=" + name + '&edit' + '=1';
}
function morenews() {
el = document.getElementById('news');
el.style.height = '500px;';
}
function resetForms() {
}
function limitSize(field, max) {
if (field.value.length > max) {
field.value = field.value.substring(0, max);
}
}
function setClassById(id, newClass) {
el = document.getElementById(id);
if (el) {
el.className = newClass;
}
}
// place newClass first, not last
function replaceClass(el, oldClass, newClass) {
currentClasses = el.className;
if (currentClasses) {
if (oldClass) {
var i = currentClasses.indexOf(oldClass);
if (i != -1) {
currentClasses = currentClasses.substring(0, i) + newClass + currentClasses.substring(i + oldClass.length);
}
else {
currentClasses = newClass + ' ' + currentClasses;
}
}
else {
currentClasses = newClass + ' ' + currentClasses;
}
}
else {
currentClasses = newClass;
}
el.className = currentClasses;
}
mouse_tab = [];
isover = {};
menu_open_timeout = null;
menu_close_timeout = null;
// Principle:
// when the core functions are invoked they only perform if matching the mouse_tab status
// when over, schedule to add
// - mark isover = true
// SCHEDULE, THEN
// - if already in stack, do nothing
// - if parent is not in stack, do nothing
// - remove all items above parent in stack
// - push to stack and open item
// when out, schedule it to be removed, if:
// - mark isover = false
// SCHEDULE, THEN
// - if in stack, but not top item, do not remove it
// - if top in stack, remove it, and item below until first isover = true is reached
// - if not in stack, error condition?
//
// never clear timeouts
function clearMenuTimeout() {
clearMenuOpenTimeout();
clearMenuCloseTimeout();
}
function clearMenuOpenTimeout() {
if (menu_open_timeout) {
clearTimeout(menu_open_timeout);
menu_open_timeout = null;
}
}
function clearMenuCloseTimeout() {
if (menu_close_timeout) {
clearTimeout(menu_close_timeout);
menu_close_timeout = null;
}
}
function menuMouseOver(parentTab, tab) {
isover[tab] = true;
menu_open_timeout = setTimeout("menuMouseOpen(\"" + parentTab + '\",\"' + tab + "\")", 10);
}
function menuMouseOut(tab, time) {
isover[tab] = false;
menu_open_timeout = setTimeout("menuMouseClose(\"" + tab + "\")", 400);
}
function menuMouseOpen(parentTab, tab) {
if (! isover[tab]) {
return;
}
parentPos = -1;
for (i = (mouse_tab.length - 1); i >= 0; i--) {
if (tab == mouse_tab[i]) {
// already up
return;
}
else if (parentTab == mouse_tab[i]) {
parentPos = i;
break;
}
}
// if parent is not found, close all in stack
while ((mouse_tab.length - 1) > parentPos) {
menuPopTab();
}
mouse_tab.push(tab);
el = document.getElementById('sstab_' + tab);
if (el != null) {
replaceClass(el, 'tabover', 'tabover');
}
el = document.getElementById('detaildiv_' + tab);
if (el != null) {
el.style.zIndex = 100;
// comprressed flipup means the submenu appears above current menu by X %, to save width
// especially important for iPhone
if (pageWidth() < 500) {
replaceClass(el, 'flipup', 'flipup flipupCompressed');
}
else {
//replaceClass(el, 'flipup flipupCompressed', 'flipup');
}
slowOpenDiv('detaildiv_' + tab);
//JSTweener.addTween(el.style, {time: 0.5, transition: 'easeOutQuad', opacity:100, getter:{opacity:0}, setter:{opacity:setOpacity}});
}
}
function menuMouseClose(tab) {
if (isover[tab]) {
return;
}
if (mouse_tab.length > 0 &&
mouse_tab[mouse_tab.length - 1] == tab) {
isover[tab] = false;
while (mouse_tab.length > 0 &&
! isover[mouse_tab[mouse_tab.length - 1]]) {
menuPopTab();
}
}
}
function menuPopTab() {
tab = mouse_tab.pop();
closeTab(tab);
if (mouse_tab.length == 0) {
showFlash();
}
}
function closeTab(tab) {
el = document.getElementById('sstab_' + tab);
if (el != null) {
replaceClass(el, 'tabover', '');
}
el = document.getElementById('detaildiv_' + tab);
if (el != null) {
//cfun = function() {el.style.display = 'none';};
//gfun = function(obj) {return 100;};
//JSTweener.addTween(el.style, {time: 0.5, transition: 'easeOutQuad', opacity:0, getter:{opacity:gfun}, setter:{opacity:setOpacity}, onComplete:cfun});
slowCloseDiv('detaildiv_' + tab, true);
//el.style.display = 'none';
}
}
/**********
el = document.getElementById('sstab_' + tab);
if (el != null) {
replaceClass(el, 'tabover', 'tabover');
}
el = document.getElementById('detaildiv_' + tab);
if (el != null) {
el.style.display = 'block';
el.style.zIndex = 100;
}
function menuMouseOverOld(parentTab, tab) {
console.info('Maybe open:' + parentTab + ',' + tab);
for (i = mouse_tab.length - 1; i >= 0; i--) {
if (tab == mouse_tab[i]) {
// already up
console.info('Found tab:' + tab);
return;
}
else if (parentTab == mouse_tab[i]) {
console.info('Found parent:' + parentTab);
break;
}
// close the tab on top
console.info('Popping:' + mouse_tab[mouse_tab.length - 1]);
menuPopTab();
}
clearMenuTimeout();
console.info('Scheduled mouse open: ' + tab);
menu_open_timeout = setTimeout("menuMouseOpen(\"" + tab + "\")", 400);
}
function menuMouseOpenOld(tab) {
console.info('Opening: ' + tab);
clearMenuTimeout();
console.info('Push: ' + tab);
mouse_tab.push(tab);
el = document.getElementById('sstab_' + tab);
if (el != null) {
replaceClass(el, 'tabover', 'tabover');
}
el = document.getElementById('detaildiv_' + tab);
if (el != null) {
el.style.display = 'block';
el.style.zIndex = 100;
}
}
function menuMouseOutOld() {
clearMenuTimeout();
if (mouse_tab.length > 0) {
console.info('Scheduled mouse out (pop):' + mouse_tab[mouse_tab.length - 1]);
menu_close_timeout = setTimeout("menuMouseOutCore()", 400);
}
}
function menuMouseOutCore() {
while (mouse_tab.length > 0) {
menuPopTab();
}
}
****/
oldmonthdiv = -1;
function setMonthDiv(olddiv, divid) {
if (oldmonthdiv != -1) {
el = document.getElementById('monthdiv_' + oldmonthdiv);
}
else {
el = document.getElementById('monthdiv_' + olddiv);
}
if (el != null) el.style.display = 'none';
el = document.getElementById('monthdiv_' + divid);
if (el != null) el.style.display = 'block';
oldmonthdiv = divid;
}
function setGalleryDiv(divid) {
if (divid == 0) {
setdiv = 'gallerynames';
unsetdiv = 'gallerystreets';
}
else {
unsetdiv = 'gallerynames';
setdiv = 'gallerystreets';
}
el = document.getElementById(unsetdiv);
if (el != null) el.style.display = 'none';
el = document.getElementById(setdiv);
if (el != null) el.style.display = 'block';
}
function setArtistDiv(divid) {
if (divid == 0) {
setdiv = 'artistfirstnames';
unsetdiv = 'artistlastnames';
}
else {
unsetdiv = 'artistfirstnames';
setdiv = 'artistlastnames';
}
el = document.getElementById(unsetdiv);
if (el != null) el.style.display = 'none';
el = document.getElementById(setdiv);
if (el != null) el.style.display = 'block';
}
var selectedSimpleTab = [];
function setSimpleTab(i, newTab) {
oldTab = selectedSimpleTab[i];
if (newTab == oldTab) return;
el = document.getElementById('tab' + i + '_' + oldTab);
if (el) {
el.style.backgroundColor = '#FFFFFF';
el.style.fontWeight = 'normal';
}
el = document.getElementById('tabdiv' + i + '_' + oldTab);
if (el) {
el.style.display = 'none';
}
el = document.getElementById('tab' + i + '_' + newTab);
if (el) {
el.style.backgroundColor = '#DDDDDD';
el.style.fontWeight = 'bold';
}
el = document.getElementById('tabdiv' + i + '_' + newTab);
if (el) {
el.style.display = 'block';
}
selectedSimpleTab[i] = newTab;
}
var selectedLocationTab = 0;
function setLocationTab(newTab, longitude, latitude){
//if (newTab == selectedLocationTab) return;
if (longitude != null && latitude != null) {
moveMap(longitude, latitude);
}
else {
// clear map
el = document.getElementById('mapelement');
if (el) {
el.innerHTML = '';
}
el = document.getElementById('mapaltelement');
if (el) {
el.style.display = 'block';
}
}
// clear map
/***
el = document.getElementById('mapelement');
if (el) {
el.innerHTML = '';
}
el = document.getElementById('mapaltelement');
if (el) {
el.style.display = 'block';
}
//FIX
alert(globalMarkers[0][0] + ':' + globalMarkers[0][1]);
if (globalMarkers != null) {
moveMap(globalMarkers[0][0], globalMarkers[0][1]);
}
****/
oldTab = selectedLocationTab;
el = document.getElementById('locationtab_' + oldTab);
if (el) {
el.style.backgroundColor = '#FFFFFF';
el.style.fontWeight = 'normal';
}
el = document.getElementById('locationdiv_' + oldTab);
if (el) {
el.style.display = 'none';
}
el = document.getElementById('locationtab_' + newTab);
if (el) {
el.style.backgroundColor = '#DDDDDD';
el.style.fontWeight = 'bold';
}
el = document.getElementById('locationdiv_' + newTab);
if (el) {
el.style.display = 'block';
}
selectedLocationTab = newTab;
}
// tooltip code
var ie = document.all;
var tipUp = 0;
function hideDiv(divname) {
el = document.getElementById(divname);
if (el != null) {
el.style.display = "none";
}
}
function expandDiv(divname) {
el = document.getElementById(divname);
if (el != null) {
el.style.height = "";
el.style.overflow = "";
}
}
function expandDiv2(divnameNum) {
el_outer = document.getElementById('co_' + divnameNum);
el = document.getElementById('co_inner_' + divnameNum);
if (el != null && el.offsetHeight) {
if (el_outer) {
var cfun = function() {hideDiv('li_' + divnameNum);};
JSTweener.addTween(el_outer.style, {time: 1, transition: 'easeInOutCubic', height:el.offsetHeight, suffix:{height:'px'}, onComplete:cfun});
//el_outer.style.height = el.offsetHeight + 'px';
return;
}
}
if (el_outer) {
el_outer.style.height = "";
el_ouetr.style.overflow = "";
}
}
function initTip() {
tooltipDiv = document.getElementById("tooltip");
tooltipTable = document.getElementById("tooltiptable");
tooltipCell = document.getElementById("tooltipcell");
if (tooltipDiv) {
tooltipDiv.style.display = "none";
}
}
function openTipEncoded(msg, width) {
if (tooltipDiv == null) return;
msg = unescape(msg);
tooltipDiv.innerHTML = msg;
tooltipDiv.style.display = 'block';
tooltipDiv.style.width = width + 'px';
tipUp = 2;
}
function openTip(msg, width) {
openTipWithType(msg, width, 1, null);
}
function openSimpleTipWithType(msg, width, tipType, e) {
el = document.getElementById('tooltiparrow');
el.style.display = 'none';
openTipWithType(msg, width, tipType, e);
}
function openTipWithType(msg, width, tipType, e) {
openTipWithTypeAndOffset(msg, width, tipType, 0, 0, e, null);
}
tipOffsetX = 0;
tipOffsetY = 0;
coordObjName = null;
function openSimpleTipWithTypeAndOffset(msg, width, tipType, xOffset, yOffset, e, coordObjNameParam) {
el = document.getElementById('tooltiparrow');
el.style.display = 'none';
openTipWithTypeAndOffset(msg, width, tipType, xOffset, yOffset, e, coordObjNameParam);
}
function openTipWithTypeAndOffset(msg, width, tipType, xOffset, yOffset, e, coordObjNameParam) {
if (tooltipDiv == null) return;
coordObjName = coordObjNameParam;
tipOffsetX = xOffset;
tipOffsetY = yOffset;
tooltipDiv.style.left = "-100px";
tooltipDiv.style.top = "-1000px";
tooltipCell.innerHTML = msg;
tooltipDiv.style.display = 'block';
if (tooltipTable) {
tooltipDiv.style.width = (tooltipTable.offsetWidth + 10) + 'px';
}
else {
tooltipDiv.style.width = (width + 10) + 'px';
}
tipUp = tipType;
if (e != null) {
adjustTip(e);
}
}
var Xoffset = 20;
var Yoffset = -15;
var tooltipDiv = null;
var tooltipTable = null;
var tooltipCell = null;
function getTarget(e) {
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
return targ;
}
function adjustTip(e) {
if (tooltipDiv == null) return;
iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
if (! ie) {
x = e.pageX;
}
else {
x = event.x + iebody.scrollLeft;
}
if (! ie) {
y = e.pageY;
}
else {
y = event.y + iebody.scrollTop;
}
if (tipUp == 0) return;
if (tipUp == 3) {
// relative to object
if (coordObjName != null) {
targetElem = document.getElementById(coordObjName);
}
else {
targetElem = getTarget(e);
}
posArray = findPos(targetElem);
tooltipDiv.style.left = posArray[0] + targetElem.offsetWidth + tipOffsetX + 'px';
dy = Math.floor(targetElem.offsetHeight/2);
if (dy > 15) dy = 15;
tooltipDiv.style.top = posArray[1] + (dy - 10) + tipOffsetY + 'px';
//tipOffsetX = 0;
//tipOffsetY = 0;
}
else if (tipUp == 2) {
tooltipDiv.style.left = (x + Xoffset + 100) + 'px';
tooltipDiv.style.top = (y + Yoffset - 230) + 'px';
}
else {
tooltipDiv.style.left = (x + Xoffset) + 'px';
tooltipDiv.style.top = (y + Yoffset) + 'px';
}
//tipUp = 0;
}
function closeSimpleTip() {
el = document.getElementById('tooltiparrow');
el.style.display = 'block';
closeTip();
}
function closeTip() {
if (tooltipDiv != null) {
tooltipDiv.style.display = 'none';
}
tipUp = 0;
}
function eraseHelpText(obj) {
if (obj.value.substring(0,1) == "[") {
obj.value = "";
}
}
function setGeoPreference(name, drop) {
var val = drop.options[drop.selectedIndex].value;
drop.form.elements[name].value = val;
drop.form.elements['refresh'].value = 1;
drop.form.submit();
el = document.getElementById('geoPrefTD');
el.innerHTML = 'Updating... plase wait
';
}
function gotoSelected(drop) {
url = drop.options[drop.selectedIndex].value;
document.location.href = url;
}
function setSearchTab(name) {
//alert('search' + name);
//DOM.get('searchTable').className = 'search' + name;
DOM.setAttribute(DOM.get('searchTable'), CLASSNAME('search' + name));
}
function submitSearchForm(name) {
DOM.get(name).submit();
}
function setSearchDiv(tabDiv) {
el = document.getElementById('genericsearch');
if (el) {
el.className = tabDiv;
}
/****
if (el) {
el.style.backgroundColor = 'white';
}
el = document.getElementById(tabDiv);
if (el) {
el.style.zIndex = 100;
el.style.display = 'block';
}
el = document.getElementById(tabDiv + "_label");
if (el) {
el.style.backgroundColor = '#dddddd';
}
curSearchDiv = tabDiv;
***/
}
function toggleDivs(div1, div2) {
el = document.getElementById(div1);
if (el) {
el.style.zIndex = 100;
el.style.display = 'block';
}
el = document.getElementById(div2);
if (el) {
el.style.zIndex = 0;
el.style.display = 'none';
}
}
var reorderDragger = null;
function reorderLocations(evt, obj, curPos, label, url, baseURL) {
stopPropagation(evt);
var pos = findPos(obj);
reorderDragger = DOM.div([CLASSNAME('reorderDragger'),STYLE.top(pos[1] + 'px'),STYLE.left(pos[0] + 'px')], DOM.text(label));
DOM.appendChild(DOM.get('body'), reorderDragger);
reorderDragger.handleMove = reorderLocationsMove;
reorderDragger.dragEnd = reorderDragEnd;
reorderDragger.offsetY = pos[1] - evt.clientY;
reorderDragger.oldY = evt.clientY;
reorderDragger.curPos = curPos;
reorderDragger.url = url;
reorderDragger.baseURL = baseURL;
}
function reorderLocationsMove(evt) {
stopPropagation(evt);
// only allow move up and down
var top = evt.clientY + reorderDragger.offsetY;
DOM.setAttributes(reorderDragger, [STYLE.top(top + 'px')]);
var foundFirst = false;
for (var i = 0; i < 100; i++) {
el = DOM.getSafe('highlightLoc_' + i);
if (! el) break;
el.style.borderTop = 'none';
if (! foundFirst) {
var pos = findPos(el);
var posTop = pos[1];
if (posTop > top) {
el.style.borderTop = 'solid black 2px';
foundFirst = true;
}
}
}
return false;
}
function reorderDragEnd(evt) {
var top = Number(reorderDragger.style.top.substring(0, reorderDragger.style.top.length - 2));
var noMove = false;
if (Math.abs(reorderDragger.oldY - evt.clientY) < 2) {
noMove = true;
if (reorderDragger.url != '') {
document.location.href = reorderDragger.url;
}
}
for (var i = 0; i < 100; i++) {
el = document.getElementById('dragloc_' + i);
if (! el) break;
var pos = findPos(el);
var posTop = pos[1];
if (posTop > top) {
//el.style.backgroundColor = 'orange';
if (! noMove) {
document.location.href = reorderDragger.baseURL + "&cur_pos=" + reorderDragger.curPos + "&new_pos=" + DOM.getAttribute(el, "locPos");
}
break;
}
}
DOM.removeSelf(reorderDragger);
reorderDragger = null;
}
var dragInProgress = null;
var startX = 0;
var startY = 0;
function stopPropagation(evt) {
if (window.event) {
evt.cancelBubble = true;
evt.returnValue = false;
}
else {
evt.preventDefault();
evt.stopPropagation();
}
}
function dragstart(evt, objName) {
obj = document.getElementById(objName);
if (obj == null) return;
dragInProgress = obj;
startX = evt.clientX;
startY = evt.clientY;
stopPropagation(evt);
}
function dragend(evt) {
// snap
if (reorderDragger) {
return reorderDragger.dragEnd(evt);
}
if (dragInProgress == null) return;
var d = dragInProgress;
dragInProgress = null;
// no snap
return;
d.style.zIndex = 0;
var ctop = Number(d.style.top.substring(0, d.style.top.length - 2));
var cleft = Number(d.style.left.substring(0, d.style.left.length - 2));
stopPropagation(evt);
startX = 0;
startY = 0;
factor = 30;
ctop = Math.floor((ctop + 13)/factor) * factor;
cleft = Math.floor((cleft + 13)/factor) * factor;
d.style.top = ctop + 'px';
d.style.left = cleft + 'px';
}
function dragit(evt) {
if (!evt) evt = window.event;
if (reorderDragger) {
return reorderDragger.handleMove(evt);
}
if (dragInProgress != null) {
stopPropagation(evt);
var dx = evt.clientX - this.startX;
var dy = evt.clientY - this.startY;
this.startX = evt.clientX;
this.startY = evt.clientY;
var d = dragInProgress;
d.style.zIndex = 10;
var oldTop = Number(d.style.top.substring(0, d.style.top.length - 2));
var oldLeft = Number(d.style.left.substring(0, d.style.left.length - 2));
var top = oldTop + dy;
var left = oldLeft + dx;
d.style.top = top + 'px';
d.style.left = left + 'px';
}
else {
adjustTip(evt);
}
return false;
}
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return [curleft,curtop];
}
}
var addthis_pub = 'Jonas Almgren';
function autofill(formname) {
f = document.forms[formname];
if (f.start_date.value == '') {
alert('You must fill in the show start date before using auto fill.');
return;
}
closeTip();
f.reception.value = f.start_date.value + ' 6:00 pm - 8:00 pm';
}
var flashplayer = null;
var flashcovers = null;
function onLoadFlash() {
if (flashplayer != null) {
createplayer(flashplayer);
}
if (flashcovers != null) {
createflashcovers(flashcovers);
}
}
function createplayer(flashplayer) {
theDiv = flashplayer[0];
theFile = flashplayer[1];
theImage = flashplayer[2];
width = flashplayer[3];
height = flashplayer[4];
go = flashplayer[5];
var params = {"allowfullscreen":"true",
"allowscriptaccess":"always",
"wmode":"transparent"};
var flashvars = {"javascriptid":"flashplayer",
"enablejs":"true",
"file":theFile,
"width":width,
"height":height,
"image":theImage,
"displayheight":height,
//s.addVariable("overstretch","fit");
"shuffle":"false"}
//s.addVariable("thumbsinplaylist","true");
if (go) {flashvars["autostart"] = "true";}
var attributes = {"id":theDiv + "swf"};
swfobject.embedSWF("/common/flash/mediaplayer-3-16/mediaplayer.swf",theDiv,width,height,"8",false,flashvars,params,attributes);
}
// transparent: mouse over and mouse move not properly handled, especially in IE 6
// also said to have performance problems in IE
// window: DHTML popups not showing on top of flash
function createflashcovers(flashplayer) {
theDiv = flashplayer[0];
width = flashplayer[1];
height = flashplayer[2];
url = flashplayer[3];
var params = {//"wmode":"transparent",
"wmode":"window",
//"wmode":"opaque",
"menu":"false",
"quality":"high",
"scale":"noscale",
"allowScriptAccess":"always"};
var flashvars = {"xmlURL":url};
var attributes = {"id":theDiv + "swf"};
// modify default with every upgrade
var rand = 3;
if (ie) {
rand = Math.floor(Math.random()*10000)
}
swfobject.embedSWF("/common/flash/cagcoverflow/Coverflow3Core.swf?" + rand,theDiv,width,height,"9",false,flashvars,params,attributes);}
function showFlash() {
var theDiv = null;
if (flashplayer != null) {
theDiv = flashplayer[0];
}
else if (flashcovers != null) {
theDiv = flashcovers[0];
}
if (theDiv != null) {
theDiv += "swf";
var swf = document.getElementById(theDiv);
if (swf) {
swf.className = "";
}
}
}
function hideFlash() {
if (flashplayer != null) {
theDiv = flashplayer[0];
}
else if (flashcovers != null) {
theDiv = flashcovers[0];
}
else {
return;
}
theDiv += "swf";
var swf = document.getElementById(theDiv);
if (swf) {
swf.className = "flashHidden";
}
}
function checkEmailForm() {
el = document.getElementById('emailto');
if (el.value == '') {
alert("You need to enter an email address.");
return false;
}
return true;
}
function forgotPassword() {
el = document.getElementById('cag_email');
if (el.value == '') {
alert("You need to enter an email address for your account.\nWe will email a temporary password to this address.");
return;
}
f = document.getElementById('loginfield');
f.value = 40;
el = document.getElementById('loginForm');
el.submit();
}
function isIE() {
return document.all;
}
function setOpacityIE(el, opacity) {
if (isIE()) {
if (opacity >= 99.5) {
el.removeAttribute('filter');
}
else {
el.zoom = 1;
//el.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+ opacity + ");";
el.filter = "alpha(opacity=" + opacity + ")";
/*
el = document.getElementById('copyrightdiv');
if (el) {
el.innerHTML = el.innerHTML;
}
*/
}
}
setOpacity(el, opacity);
}
//set the opacity for different browsers
function setOpacity(el, opacity) {
opacity = Math.floor(opacity);
el.opacity = (opacity / 100);
el.MozOpacity = (opacity / 100);
el.KhtmlOpacity = (opacity / 100);
// IE not supported, because using filters causes problems, like cropping of submenus
//el.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+ opacity + ");";
//el.filter = "alpha(opacity=" + opacity + ")";
// this nonsense is needed to make it work in IE 7
/*
el = document.getElementById('copyrightdiv');
if (el) {
el.innerHTML = el.innerHTML;
}
*/
}
function slowOpenDiv(divName, duration) {
hideFlash();
if (! duration) duration = 0.5;
el = document.getElementById(divName);
if (! isIE()) {
setOpacityIE(el.style, 0);
el.style.display = "block";
JSTweener.addTween(el.style, {time: 0.5, transition: 'easeOutQuad', opacity:100, getter:{opacity:0}, setter:{opacity:setOpacityIE}});
}
else {
el.style.display = 'block';
}
}
var searchDivIsOpen = false;
function openSearchDiv() {
if (searchDivIsOpen) {
closeSearchDiv();
}
else {
slowOpenDiv('menuSearchDiv');
searchDivIsOpen = true;
}
}
function closeSearchDiv() {
slowCloseDiv('menuSearchDiv');
searchDivIsOpen = false;
}
function openLoginDiv() {
// only works if login is required, else opens email
openSendEmailDiv("Login");
}
function openSendEmailDiv(title) {
yd = document.body.scrollTop + document.documentElement.scrollTop;
y = 100 + yd;
el = document.getElementById('sendemail');
if (title == null) {
title = 'You must be logged in to send emails';
}
if (el != null) {
el.style.top = y + 'px';
elt = document.getElementById('sendemailtitle');
if (elt != null) {
elt.innerHTML = title;
}
slowOpenDiv('sendemail');
}
}
function slowCloseDiv(divName, dontShowFlash) {
el = document.getElementById(divName);
if (el) {
el.style.display = 'none';
//cfun = function() {el.style.display = 'none';};
//gfun = function(obj) {return 100;};
//JSTweener.addTween(el.style, {time: 0.5, transition: 'easeOutQuad', opacity:0, getter:{opacity:gfun}, setter:{opacity:setOpacity}, onComplete:cfun});
}
if (! dontShowFlash) {
showFlash();
}
}
function closeSendEmailDiv() {
slowCloseDiv('sendemail');
}
var currentAdAds = 0;
var currentAdTweenIndex = 0;
var currentAdDivName = null;
var currentAdHeight = null;
var currentAdTweenerTimeout = null;
var adTweenerStopped = false;
function adTweenerStop() {
if (! adTweenerStopped) {
adTweenerStopped = true;
clearTimeout(currentAdTweenerTimeout);
}
}
function startAdTweener() {
if (adTweenerStopped) {
adTweenerStopped = false;
adTweenerInner(currentAdDivName, currentAdTweenIndex, currentAdAds, 20, currentAdHeight);
}
}
function nextAdTweener() {
adTweenerStop();
adTweenerInner(currentAdDivName, currentAdTweenIndex, currentAdAds, 20, currentAdHeight);
}
function adTweener(divName, index, ads, downCount, adHeight) {
if (downCount == 0) return;
if (adTweenerStopped) return;
currentAdDivName = divName;
currentAdAds = ads;
currentAdHeight = adHeight;
currentAdTweenIndex = index;
var f = function() {adTweenerInner(divName, index, ads, downCount, adHeight);};
currentAdTweenerTimeout = setTimeout(f, 3000);
}
function adTweenTo(absPos) {
if (currentAdAds > 0) {
adTweenerStop();
el = document.getElementById('inv_ptr_' + currentAdTweenIndex);
replaceClass(el, 'high', '');
currentAdTweenIndex = absPos;
el = document.getElementById('inv_ptr_' + currentAdTweenIndex);
replaceClass(el, 'high', 'high');
el = document.getElementById(currentAdDivName);
if (el != null) {
JSTweener.addTween(el.style, {time: 1, transition: 'easeOutQuad', top: - (currentAdTweenIndex*currentAdHeight), suffix:{top:'px'}});
}
}
}
function adTweenerInner(divName, index, ads, downCount, adHeight) {
el = document.getElementById('inv_ptr_' + index);
replaceClass(el, 'high', '');
index++;
if (index >= ads) {
index = 0;
}
el = document.getElementById('inv_ptr_' + index);
replaceClass(el, 'high', 'high');
el = document.getElementById(divName);
currentAdTweenIndex = index;
var f = function() {adTweener(divName, index, ads, downCount - 1, adHeight);};
JSTweener.addTween(el.style, {time: 1, transition: 'easeOutQuad', top: - (index*adHeight), suffix:{top:'px'}, onComplete:f});
}
var welcomeInterval = null;
var welcomePosition = 0;
var welcomeSpeed = 0;
var welcomeTurn = 0;
function maybeScrollWelcome() {
if (welcomeSpeed > 0) {
scrollWelcome();
}
}
function scrollWelcome()
{
if (welcomePosition > welcomeTurn) {
welcomePosition -= 1;
el = document.getElementById('welcome_banner');
if (el) {
el.style.left = welcomePosition + 'px';
}
}
else {
welcomePosition = 0;
}
interval = setTimeout("scrollWelcome()", welcomeSpeed);
}
function moveMap(longitude, latitude) {
el = document.getElementById('mapiframe');
if (! el) {
setmaphtmlat(longitude, latitude);
}
if (el) {
el.contentWindow.moveCenter(longitude, latitude, null); // whatever is current zoom
}
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function setGeoFilter(selector) {
v = selector.value;
createCookie("geofilter",v,900);
document.location.href = '/A-withshows/';
}
function deleteGallery() {
form = document.forms["editform"];
if (confirm("Delete?")) {
form.elements["deletegallery"].value = 1;
form.submit();
}
}
function closeExhMgr() {
DOM.replaceClass(DOM.get('pageBodyDiv'), '', 'showExhMgr');
el = document.getElementById('exh_mgr_div');
if (el) {
el.style.display = 'none';
}
el = document.getElementById('exh_mgr_minus');
if (el) {
el.style.display = 'none';
}
el = document.getElementById('exh_mgr_plus');
if (el) {
el.style.display = 'block';
}
createCookie("exhMgrStatus", 0, 900);
}
function openExhMgr() {
DOM.replaceClass(DOM.get('pageBodyDiv'), 'showExhMgr', 'showExhMgr');
el = document.getElementById('exh_mgr_div');
if (el) {
el.style.display = 'block';
}
el = document.getElementById('exh_mgr_plus');
if (el) {
el.style.display = 'none';
}
el = document.getElementById('exh_mgr_minus');
if (el) {
el.style.display = 'block';
}
createCookie("exhMgrStatus", 1, 900);
}
function verifyContactInfo() {
el = document.getElementById('upd_name');
vn = (el?el.value:'');
el = document.getElementById('upd_email');
ve = (el?el.value:'');
el = document.getElementById('upd_phone');
vp = (el?el.value:'');
if (vn == '') {
alert("Your contact name at the top of the form must be filled in. Please provide this information, then click submit again.");
return false;
}
else if (ve == '') {
alert("Your contact email at the top of the form must be filled in. Please provide this information, then click submit again.");
return false;
}
else {
return true;
}
}
function openPrintWindow(url) {
form = document.getElementById('printform');
if (form) {
form.action = url;
form.submit();
}
}
var maxinv = {};
var invRotateStopped = {};
var currentInvPos = {};
// called on home page after load
function maybeStartInventory() {
var i, j;
// at most 10 slide shows in one window
for (j = 0; j < 10; j++) {
if (maxinv[j] == null) {
for (i = 0; i < 50; i++) {
el = document.getElementById('s' + j + '_' + i);
if (! el) break;
}
maxinv[j] = i;
if (maxinv[j] == 0) return;
invRotateStopped[j] = true;
currentInvPos[j] = -1;
inventoryStart(j);
}
}
}
function setInvOpacity(el, opacity) {
setOpacityIE(el, opacity);
}
function inventoryStart(id) {
if (invRotateStopped[id] == false) return;
invRotateStopped[id] = false;
inventoryScheduleNext(id, 0);
}
function inventoryNext(id) {
inventoryStop(id);
var n = currentInvPos[id] + 1;
if (n >= maxinv[id]) n = 0;
inventorySetCurrent(id, n);
}
function inventoryStop(id) {
// stop at current
invRotateStopped[id] = true;
inventoryInCurrent(id);
}
function inventorySetCurrent(id, pos) {
invRotateStopped[id] = true;
el = document.getElementById('s' + id + '_' + currentInvPos[id]);
el.style.display = 'none';
el = document.getElementById('s' + id + '_cap_' + currentInvPos[id]);
el.style.display = 'none';
el = document.getElementById('s' + id + '_ptr_' + currentInvPos[id]);
replaceClass(el, 'high', '');
currentInvPos[id] = pos;
inventoryInCurrent(id);
}
function inventoryOutCurrent(id) {
if (currentInvPos[id] < 0) return;
var el = document.getElementById('s' + id + '_cap_' + currentInvPos[id]);
el.style.display = 'none';
el = document.getElementById('s' + id + '_ptr_' + currentInvPos[id]);
replaceClass(el, 'high', '');
var el = document.getElementById('s' + id + '_' + currentInvPos[id]);
el.style.zIndex = 20;
var gfun = function(obj) {return 100;};
var t = 3;
JSTweener.addTween(el.style, {time: t, opacity:0, getter:{opacity:gfun}, setter:{opacity:setInvOpacity}});
}
function inventoryInCurrent(id) {
var el = document.getElementById('s' + id + '_cap_' + currentInvPos[id]);
el.style.display = 'block';
el = document.getElementById('s' + id + '_ptr_' + currentInvPos[id]);
replaceClass(el, 'high', 'high');
el = document.getElementById('s' + id + '_' + currentInvPos[id]);
setOpacityIE(el.style, 0);
el.style.display = 'block';
el.style.zIndex = 30;
var t = 3; //+ 0.3 + Math.random() * 2;
var gfun = function(obj) {return 0;};
JSTweener.addTween(el.style, {time: t, opacity:100, getter:{opacity:gfun}, setter:{opacity:setOpacityIE}});
}
function transitionInventoryOutIn(id, pos) {
if (invRotateStopped[id]) return;
inventoryOutCurrent(id);
currentInvPos[id] = pos;
inventoryInCurrent(id);
// don't rotate, if only one image
if (maxinv[id] > 1) {
inventoryScheduleNext(id);
}
}
function inventoryScheduleNext(id, t) {
if (t == null) t = 4000;
var n = currentInvPos[id] + 1;
if (n >= maxinv[id]) n = 0;
setTimeout('transitionInventoryOutIn(' + id + ',' + n + ')', t);
}
var currentWelcomeLogo = 0;
var welcomeLogoDelay = 1000;
function startWelcomeLogos() {
setTimeout('executeWelcomeLogo()', welcomeLogoDelay);
}
function executeWelcomeLogo() {
// slide current off, and as complete action, do following
// switch z-index
// change image src (or inner html)
// change href in a
// schedule next
var pos = currentWelcomeLogo % 3;
var ix = (currentWelcomeLogo % 6 <= 2?1:0);
var baseId = 'glogo' + pos + '_' + ix;
el = document.getElementById(baseId);
var f = executeWelcomeComplete;
var d = Math.floor(Math.random()*8); // 0-7
var newTop = 120; //(d > 0 && d < 4 ? -120 : ( d == -4 || d == 0 ? 0 : 120));
var newLeft = 80; //(d == 2 || d == 6 ? 0 : ( d > 2 && d < 6 ? -200 : 200));
JSTweener.addTween(el.style, {time: 0.4, transition: 'easeOutQuad', top:newTop, left:newLeft, suffix:{top:'px',left:'px'}, onComplete:f});
}
function executeWelcomeComplete() {
var pos = currentWelcomeLogo % 3;
var ix = (currentWelcomeLogo % 6 <= 2?1:0);
var newbaseId = 'glogo' + pos + '_' + (1 - ix);
newelDiv = document.getElementById(newbaseId);
newelDiv.style.zIndex = 10;
var baseId = 'glogo' + pos + '_' + ix;
elDiv = document.getElementById(baseId);
elA = document.getElementById(baseId + '_a');
elIm = document.getElementById(baseId + '_im');
elDiv.style.zIndex = 0;
elDiv.style.top = '0px';
elDiv.style.left = '0px';
// add, check for reaching end
if (currentWelcomeLogo + 6 >= welcomeLogos.length) {
currentWelcomeLogo = 0;
}
elIm.src = '/images/welcome/' + welcomeLogos[currentWelcomeLogo + 6][0];
elA.href = welcomeLogos[currentWelcomeLogo + 6][1];
currentWelcomeLogo++;
startWelcomeLogos();
}
function emailPreview() {
el = document.getElementById('emailOuterDiv');
txtEl = document.getElementById('emailbody');
txt = txtEl.value;
el.style.display = 'none';
el = document.getElementById('emailPreview');
elInner = document.getElementById('emailPreviewInner');
el.style.display = 'block';
txt = txt.substring(1);
txt = txt.replace(new RegExp("(\\s|^)(http:\\/\\/[^\\s]*)(\\s|$)", "g"), '$1$2$3');
txt = txt.replace(new RegExp("\n", "g"), '
');
img = '
';
elInner.innerHTML = img + txt;
}
function emailPreviewClose() {
el = document.getElementById('emailPreview');
el.style.display = 'none';
el = document.getElementById('emailOuterDiv');
el.style.display = 'block';
}
function editLocation(cnt) {
DOM.setAttribute(DOM.get(cnt + '_edit'), STYLE.display('block'));
DOM.setAttribute(DOM.get(cnt + '_open'), STYLE.display('none'));
}
var spiderInMotion = false;
var spiderImage = null;
function launchSpider() {
if (false && spiderInMotion) {
clearTimeout(spiderInMotion);
DOM.removeSelf(spiderImage);
return;
}
var im = DOM.img([ATTR.src("/images/spider2.gif"),STYLE.position('absolute'),STYLE.zIndex(99999),STYLE.top('200px'),STYLE.left('500px')],[]);
DOM.appendChild(DOM.get('body'), im);
spiderImage = im;
moveRandom(im, Math.PI * 0.2);
}
function moveRandom(im, direction) {
var top = Number(im.style.top.substring(0, im.style.top.length - 2));
var left = Number(im.style.left.substring(0, im.style.top.length - 2));
direction += (Math.random() - 0.5) / 2;
if (direction > Math.PI * 2) {
direction -= Math.PI * 2;
}
var dy = Math.sin(direction) * 8;
var dx = Math.cos(direction) * 8;
top += dy;
left += dx;
if (top < 100 || left < 100 || top > 1000 || left > 1000) {
spiderInMotion = false;
spiderImage = null;
DOM.removeSelf(im);
}
else {
DOM.setAttribute(im, STYLE.top(top + 'px'));
DOM.setAttribute(im, STYLE.left(left + 'px'));
spiderInMotion = setTimeout(function () {moveRandom(im, direction)}, 100);
}
}
var currentEditImageDiv = null;
function openEditImageDiv(imageID) {
//el = DOM.get('imageDisplay_' + imageID);
//el.style.display = 'none';
if (currentEditImageDiv != null) {
alert("You are already editing an image. Finish or cancel those edits first.");
return;
}
el = DOM.get('imageEdit_' + imageID);
currentEditImageDiv = el;
el.style.display = 'block';
}
function cancelEditImageDiv(imageID) {
el = DOM.get('imageEdit_' + imageID);
el.style.display = 'none';
el = DOM.get('imageDisplay_' + imageID);
el.style.display = 'block';
currentEditImageDiv = null;
}
function saveImageEditForm(formName) {
var yearValue = document.forms[formName]['img_artwork_year'].value;
var reg = /[^0-9]/;
if (yearValue != '' && reg.exec(yearValue)) {
alert('The year field must be a number, like 1965. If you want to express a range, or something like "c. 1960", then leave the field blank and use the caption field to explain the year.');
return;
}
var el = document.getElementById('uploadwait');
el.style.display = 'block';
document.forms[formName].submit();
}
function checkImageEditForm(form) {
alert(form);
return false;
}
function show_addartist(drop, imageID) {
artist = drop.options[drop.selectedIndex].value;
curval = document.forms['imageform_' + imageID].img_artists.value;
if (curval == "") {
document.forms['imageform_' + imageID].img_artists.value = artist;
}
else {
document.forms['imageform_' + imageID].img_artists.value = curval + ", " + artist;
}
}
// help used in image editing
helpImageFileSelect = '- Click \"Browse\" to select your image file.
- If the file is higher resolution (wider or taller than 600 pixels),
and in jpg format, it will be available for detail views. - Acceptable file types are: jpg, gif, png, and bmp
- Note that large files can take several minutes to upload.
';
helpAddArtist = '- This drop-down shows a list of artists in the show for easy access.
- Each artist selected will be ADDED to artist field
- You do not have to use this list, but can type the artist name directly into the artist field.
';
helpArtistField = '- Enter the name of the artist that produced the artwork in the image.
- This field may be empty if the image e.g. is an installation view.
- If the show has only one artist, this field is automatically
filled in with the name of the artist. - If the image includes artwork by multiple artists, you may either
enter all artists separated by comma (to associate the image with each of
the artists), or leave the field blank (to associate the image with the show only).
';
helpArtworkName = '- Enter the name of the artwork.
- This field may be empty if the image e.g. is an installation view.
- Do not include the year of the artwork in the name, since that is
entered in a separate field. - Please do not use all caps (upper case), and do not use
quotes around the name. - If the artwork is a still image from a video, we recommend adding
\"(still)\" after the name. Similarly, the suffixes \"(installation view)\" or
\"(studio view)\" might be added as appropriate.
';
helpArtworkYear = '- Enter the year the artwork was produced.
- This field may be empty if the year is not known exactly.
- If the field is empty, an explanation may be added to the
caption field (e.g. \"Approx. 1920s\") - If the artwork was produced over multiple years, enter the
completion year here, and add an explanation to the caption field.
';
helpImageCaption = '- The caption normally includes the artwork size and
information on materials and media, but may include
any descriptive information. - The caption can be entered over many lines, each
separated with a line feed. - Note that the caption only is displayed on the artist
page, and not on the show or gallery pages.
';
helpImageCourtesy = '- The courtesy line can be anything appropriate but
usally reads as follows: \"Courtesy ABC Gallery\" - The courtesy line may be (and often is) empty.
- The courtesy line should be kept short
- Courtesy information is displayed everywhere a
large or medium sized image is displayed, but it is
not displayed for thumbnails.
';
helpImageCopyright = '- The copyright should name the copyright holder
- The line should NOT include the word \"copyright\"
since the copyright symbol is automatically added. - The copyright line may be (and often is) empty.
- The copyright line should be kept short
- Copyright information is displayed everywhere a
large or medium sized image is displayed, but it is
not displayed for thumbnails.
';
helpImageSalePrice = '- Optional sale price of the artwork, in the currency specified.
- Should be a number (only the charters 0-9 are valid).
- If left empty, marked as Price on Request.
';
helpImageSaleCurrency = '- The currency of the sale price.
';
helpImageSaleStatus = '- The sale status of the artwork: Available or Sold
';
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan
* MIT license
*
* Includes enhancements by Scott Trenda
* and Kris Kowal
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
* The date defaults to the current date/time.
* The mask defaults to dateFormat.masks.default.
*/
var dateFormat = function () {
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
timezoneClip = /[^-+\dA-Z]/g,
pad = function (val, len) {
val = String(val);
len = len || 2;
while (val.length < len) val = "0" + val;
return val;
};
// Regexes and supporting functions are cached through closure
return function (date, mask, utc) {
var dF = dateFormat;
// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
mask = date;
date = undefined;
}
// Passing date through Date applies Date.parse, if necessary
date = date ? new Date(date) : new Date;
if (isNaN(date)) throw SyntaxError("invalid date");
mask = String(dF.masks[mask] || mask || dF.masks["default"]);
// Allow setting the utc argument via the mask
if (mask.slice(0, 4) == "UTC:") {
mask = mask.slice(4);
utc = true;
}
var _ = utc ? "getUTC" : "get",
d = date[_ + "Date"](),
D = date[_ + "Day"](),
m = date[_ + "Month"](),
y = date[_ + "FullYear"](),
H = date[_ + "Hours"](),
M = date[_ + "Minutes"](),
s = date[_ + "Seconds"](),
L = date[_ + "Milliseconds"](),
o = utc ? 0 : date.getTimezoneOffset(),
flags = {
d: d,
dd: pad(d),
ddd: dF.i18n.dayNames[D],
dddd: dF.i18n.dayNames[D + 7],
m: m + 1,
mm: pad(m + 1),
mmm: dF.i18n.monthNames[m],
mmmm: dF.i18n.monthNames[m + 12],
yy: String(y).slice(2),
yyyy: y,
h: H % 12 || 12,
hh: pad(H % 12 || 12),
H: H,
HH: pad(H),
M: M,
MM: pad(M),
s: s,
ss: pad(s),
l: pad(L, 3),
L: pad(L > 99 ? Math.round(L / 10) : L),
t: H < 12 ? "a" : "p",
tt: H < 12 ? "am" : "pm",
T: H < 12 ? "A" : "P",
TT: H < 12 ? "AM" : "PM",
Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
};
return mask.replace(token, function ($0) {
return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
});
};
}();
// Some common format strings
dateFormat.masks = {
"default": "ddd mmm dd yyyy HH:MM:ss",
shortDate: "m/d/yy",
mediumDate: "mmm d, yyyy",
longDate: "mmmm d, yyyy",
fullDate: "dddd, mmmm d, yyyy",
shortTime: "h:MM TT",
mediumTime: "h:MM:ss TT",
longTime: "h:MM:ss TT Z",
isoDate: "yyyy-mm-dd",
isoTime: "HH:MM:ss",
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};
// Internationalization strings
dateFormat.i18n = {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
]
};
// For convenience...
Date.prototype.format = function (mask, utc) {
return dateFormat(this, mask, utc);
};
var liveTimes = new Array();
var timCorr = null;
function startLiveTimes() {
var timerLoader = new SimpleAjax(function() {startLiveTimeLoaded(this);});
timerLoader.run('/currentUTC.php');
}
function startLiveTimeLoaded(ajaxObj) {
var xmlDoc = ajaxObj.responseXML;
//var time = xmlDoc.getAttribute("time");
var times = XMLDOM.getNodes(xmlDoc, ['time']);
var time = times[0].getAttribute("time");
var d = new Date();
var localUTC = Math.floor(d.getTime()/1000);
timeCorr = localUTC - time;
updateLiveTimes();
}
function updateLiveTimes() {
if (liveTimes.length > 0) {
for (var i = 0; i < liveTimes.length; i++) {
var id = liveTimes[i][0];
var offset = liveTimes[i][1];
var el = DOM.get('timeDiv' + id);
var d = new Date();
var t = Math.floor((new Date()).getTime()/1000);
var t = t * 1000 + offset - timeCorr * 1000 + d.getTimezoneOffset() * 60000;;//corr;
d.setTime(t);
var str = d.format("h:MM:ss TT");
el.innerHTML = str;
}
setTimeout(function () {updateLiveTimes()}, 1000);
}
}
// ----------------------------------------------------------------------
function SimpleAjax(resultsCallback) {
this.sack(); // resets callback functions
this.resultsCallback = resultsCallback;
this.onLoading = this.whenLoading;
this.onLoaded = this.whenLoaded;
this.onInteractive = this.whenInteractive;
this.onCompletion = this.whenCompleted;
}
SimpleAjax.prototype = inherit('sack');
SimpleAjax.prototype.inProgress = false;
SimpleAjax.prototype.whenLoading = function(){
}
SimpleAjax.prototype.whenLoaded = function(){
}
SimpleAjax.prototype.whenInteractive = function(){
}
SimpleAjax.prototype.whenCompleted = function(){
if (this.responseStatus){
var s = "Status Code: " + this.responseStatus[0] + "
Status Message: " + this.responseStatus[1] + "
URLString Sent: " + this.URLString + "
";
}
else {
var s = "URLString Sent: " + this.URLString + "
";
}
this.resultsCallback();
this.inProgress = false;
}
SimpleAjax.prototype.run = function(file, args) {
this.requestFile = file;
this.method = 'GET';
this.inProgress = true;
if (args) {
for (key in args) {
this.setVar(key, args[key]);
}
}
this.runAJAX();
}