\
";
return this.openDialog(content, parameters)
},
openDialog: function(content, parameters) {
// remove old dialog
if (this.win)
this.win.destroy();
var windowParam = parameters ? parameters.windowParameters : {};
windowParam.resizable = windowParam.resizable || false;
windowParam.effectOptions = {duration: 1};
this.win = new Window('modal_dialog', windowParam);
this.win.getContent().innerHTML = content;
this.win.showCenter(true);
this.win.cancelCallback = parameters.cancel;
this.win.okCallback = parameters.ok;
this.eventResize = this.recenter.bindAsEventListener(this);
Event.observe(window, "resize", this.eventResize);
Event.observe(window, "scroll", this.eventResize);
return this.win;
},
okCallback: function() {
this.win.hide();
Event.stopObserving(window, "resize", this.eventResize);
Event.stopObserving(window, "scroll", this.eventResize);
if (this.win.okCallback)
this.win.okCallback(this.win);
},
cancelCallback: function() {
this.win.hide();
Event.stopObserving(window, "resize", this.eventResize);
Event.stopObserving(window, "scroll", this.eventResize);
if (this.win.cancelCallback)
this.win.cancelCallback(win);
},
recenter: function(event) {
var arrayPageSize = WindowUtilities.getPageSize();
// set height of Overlay to take up whole page and show
$('overlay_modal').style.height = (arrayPageSize[1] + 'px');
this.win.center();
}
}
Prototype_Dialog = Dialog;
/*
Based on Lightbox JS: Fullsize Image Overlays
by Lokesh Dhakar - http://www.huddletogether.com
For more information on this script, visit:
http://huddletogether.com/projects/lightbox/
Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
(basically, do anything you want, just leave my name and link)
*/
var isIE = navigator.appVersion.match(/MSIE/) == "MSIE";
//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
var WindowUtilities = {
getPageScroll :function() {
var yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
}
arrayPageScroll = new Array('',yScroll)
return arrayPageScroll;
},
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
getPageSize: function(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
},
disableScreen: function(className) {
WindowUtilities.initLightbox(className);
var objBody = document.getElementsByTagName("body").item(0);
// prep objects
var objOverlay = $('overlay_modal');
var arrayPageSize = WindowUtilities.getPageSize();
// Hide select boxes as they will 'peek' through the image in IE
if (isIE) {
selects = document.getElementsByTagName("select");
for (var i = 0; i != selects.length; i++) {
selects[i].style.visibility = "hidden";
}
}
// set height of Overlay to take up whole page and show
objOverlay.style.height = (arrayPageSize[1] + 'px');
objOverlay.style.display = 'block';
},
enableScreen: function() {
var objOverlay = $('overlay_modal');
if (objOverlay) {
// hide lightbox and overlay
objOverlay.style.display = 'none';
// make select boxes visible
if (isIE) {
selects = document.getElementsByTagName("select");
for (var i = 0; i != selects.length; i++) {
selects[i].style.visibility = "visible";
}
}
objOverlay.parentNode.removeChild(objOverlay);
}
},
// initLightbox()
// Function runs on window load, going through link tags looking for rel="lightbox".
// These links receive onclick events that enable the lightbox display for their targets.
// The function also inserts html markup at the top of the page which will be used as a
// container for the overlay pattern and the inline image.
initLightbox: function(className) {
// Already done, just update zIndex
if ($('overlay_modal')) {
Element.setStyle('overlay_modal', {zIndex: Windows.maxZIndex + 10});
}
// create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
else {
var objBody = document.getElementsByTagName("body").item(0);
var objOverlay = document.createElement("div");
objOverlay.setAttribute('id', 'overlay_modal');
objOverlay.className = "overlay_" + className
objOverlay.style.display = 'none';
objOverlay.style.position = 'absolute';
objOverlay.style.top = '0';
objOverlay.style.left = '0';
objOverlay.style.zIndex = Windows.maxZIndex + 10;
objOverlay.style.width = '100%';
objBody.insertBefore(objOverlay, objBody.firstChild);
}
},
setCookie: function(value, parameters) {
document.cookie= parameters[0] + "=" + escape(value) +
((parameters[1]) ? "; expires=" + parameters[1].toGMTString() : "") +
((parameters[2]) ? "; path=" + parameters[2] : "") +
((parameters[3]) ? "; domain=" + parameters[3] : "") +
((parameters[4]) ? "; secure" : "");
},
getCookie: function(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
}