var timeout = 3000; var timeout_count = 0; var timeout_lastcall = 0; var timeout_jobs = []; // register further jobs function img_act(imgName) { if (document.images != null) { imgOn = eval(imgName + "on.src"); document[imgName].src = imgOn; } } function img_inact(imgName) { if (document.images != null) { imgOff = eval(imgName + "off.src"); document[imgName].src = imgOff; } } var content_top_offset = 0; var content_topright_offset = 0; var content_offset = 0; var content_numdisplay = 0; function Content(id, file, url, title) { this.id = id; this.file = file; this.url = url; this.image = null; this.title = title; } var content_top = null; var content_topright = null; var allContent = null; function content_open (pos) { if(allContent != null) { var myContent = allContent[(pos + content_offset) % allContent.length]; if(myContent.url != '') window.open(myContent.url); // if(myContent.url != '') document.location=myContent.url; } } function content_change () { var now = new Date(); if((now.getTime() - timeout_lastcall) * 2 < timeout) return; timeout_lastcall = now.getTime(); timeout_count++; if(content_top != null && (timeout_count % 3) == 0) { if(++content_top_offset >= content_top.length) content_top_offset = 0; if(document['content_top'] != null) document['content_top'].src = content_top[content_top_offset].image.src; } if(content_topright != null && (timeout_count % 4) == 0) { if(++content_topright_offset >= content_topright.length) content_topright_offset = 0; if(document['content_topright'] != null) document['content_topright'].src = content_topright[content_topright_offset].image.src; } if(allContent != null && (timeout_count % 3) == 0) { if(++content_offset >= allContent.length) content_offset = 0; var foo=0 for(var i=0; i < content_numdisplay; i++) { if(document['myContent'+i] != null) { document['myContent'+i].src = allContent[(i + content_offset) % allContent.length].image.src; document['myContent'+i].title = allContent[(i + content_offset) % allContent.length].title; } } } for(var i = 0; i < timeout_jobs.length; i++) if(0 == (timeout_count % timeout_jobs[i].period)) { timeout_jobs[i].action(timeout_jobs[i]); } } function print_open (url) { if(url != '') open(url, '_blank', 'width=530,resizable=yes,scrollbars=yes'); } function create_image(src) { rslt = new Image(); rslt.src = src; return rslt; } var preload_hooks = new Array(); var preload_flag = false; function loaded() { if(document.images != null) { for(var i=0; content_top != null && i < content_top.length; i++) { content_top[i].image = create_image(content_top[i].file); if(i == 0 && document['content_top'] != null) document['content_top'].src = content_top[i].image.src; } for(var i=0; content_topright != null && i < content_topright.length; i++) { content_topright[i].image = create_image(content_topright[i].file); if(i == 0 && document['content_topright'] != null) document['content_topright'].src = content_topright[i].image.src; } if(allContent != null) { for(var i=0; i < allContent.length; i++) { allContent[i].image = create_image(allContent[i].file); if(i < content_numdisplay && document['myContent' + i] != null) { document['myContent'+i].src = allContent[i].image.src; document['myContent'+i].title = allContent[i].title; } } for(var i=allContent.length; i < content_numdisplay; i++) { if(document['myContent'+i] != null) document['myContent'+i].src = allContent[i % allContent.length].image.src; } } if(preload_hooks.length > 0) { for(var i=0; i < preload_hooks.length; i++) preload_hooks[i](); } preload_flag = true; window.setInterval('content_change()', timeout); } } function open_eatsleep_popup(url) { var popup = true; var cookie_name = 'eatsleep'; if(document.cookie) { var cookie = document.cookie; while (cookie.length > 0) { var index_start = cookie.indexOf("="); if(index_start > 0) { var name = cookie.substring(0, index_start); var index_end = cookie.indexOf(";"); if(index_end == -1) index_end = cookie.length; if(name == 'display_' + cookie_name) { value = cookie.substring(index_start + 1, index_end); if(cookie.substring(index_start + 1, index_end) == '1') popup = false; break; } else { cookie = cookie.substring(index_end + 1, cookie.length); while(cookie.length > 0 && cookie.indexOf(' ') == 0) cookie = cookie.substring(1, cookie.length); } } else break; } } if(popup) { var now = new Date(); var timeout = new Date(now.getTime() + 1000*60*60*24*120); var win = window.open(url, '_blank', 'width=360,height=360,scrollbars=no'); if(win) document.cookie = "display_" + cookie_name + "=1;expires=" + timeout.toGMTString() + ";path=/"; } } content_numdisplay=5; var myContent0=new Image(151, 93); var myContent1=new Image(151, 93); var myContent2=new Image(151, 93); var myContent3=new Image(151, 93); var myContent4=new Image(151, 93); allContent=new Array( new Content(11, "client/client_131.jpg", "http://whitehotmagazine.com/articles/follow-whitehot-magazine/2918","Follow"), new Content(11, "client/client_133.jpg", "http://whitehotmagazine.com/articles/join-our-mailing-list/2941","mailing list"), new Content(11, "client/client_138.jpg", "http://whitney.org","Whitney"), new Content(11, "client/client_139.jpg", "http://www.brooklynmuseum.org","Brooklyn Museum"), new Content(11, "client/client_137.jpg", "http://www.moma.org","moma") );