/* Prototype JavaScript framework, version 1.6.0.2
* (c) 2005-2008 Sam Stephenson
*
* Prototype is freely distributable under the terms of an MIT-style license.
* For details, see the Prototype web site: http://www.prototypejs.org/
*
*--------------------------------------------------------------------------*/
var Prototype = {
Version: '1.6.0.2',
Browser: {
IE: !!(window.attachEvent && !window.opera),
Opera: !!window.opera,
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
},
BrowserFeatures: {
XPath: !!document.evaluate,
ElementExtensions: !!window.HTMLElement,
SpecificElementExtensions:
document.createElement('div').__proto__ &&
document.createElement('div').__proto__ !==
document.createElement('form').__proto__
},
ScriptFragment: '
*
*
*
* Now whenever you trigger a mouseOver on the `trigger` element, the tooltip element will
* be shown. On o mouseOut the tooltip disappears.
*
* Example:
*
*
*
*
*
*
* Detail infos on product 1....
*
*
*
* This is product 1
*
*
*
*
* You can use my_tooltip.destroy() to remove the event observers and thereby the tooltip.
*/
var Tooltip = Class.create();
Tooltip.prototype =
{
initialize: function(element, tool_tip)
{
var options = Object.extend(
{
default_css: false,
margin: "0px",
padding: "5px",
backgroundColor: "#d6d6fc",
min_distance_x: 5,
min_distance_y: 5,
delta_x: 0,
delta_y: 0,
zindex: 9000
}, arguments[2] || {});
this.element = $(element);
this.options = options;
// use the supplied tooltip element or create our own div
if($(tool_tip))
{
this.tool_tip = $(tool_tip);
}
else
{
this.tool_tip = $(document.createElement("div"));
document.body.appendChild(this.tool_tip);
this.tool_tip.addClassName("tooltip");
this.tool_tip.appendChild(document.createTextNode(tool_tip));
}
// hide the tool-tip by default
this.tool_tip.hide();
this.eventMouseOver = this.showTooltip.bindAsEventListener(this);
this.eventMouseOut = this.hideTooltip.bindAsEventListener(this);
this.eventMouseMove = this.moveTooltip.bindAsEventListener(this);
this.registerEvents();
},
destroy: function()
{
Event.stopObserving(this.element, "mouseover", this.eventMouseOver);
Event.stopObserving(this.element, "mouseout", this.eventMouseOut);
Event.stopObserving(this.element, "mousemove", this.eventMouseMove);
},
registerEvents: function()
{
Event.observe(this.element, "mouseover", this.eventMouseOver);
Event.observe(this.element, "mouseout", this.eventMouseOut);
Event.observe(this.element, "mousemove", this.eventMouseMove);
},
moveTooltip: function(event)
{
Event.stop(event);
// get Mouse position
var mouse_x = Event.pointerX(event);
var mouse_y = Event.pointerY(event);
// decide if wee need to switch sides for the tooltip
var dimensions = Element.getDimensions( this.tool_tip );
var element_width = dimensions.width;
var element_height = dimensions.height;
if ( (element_width + mouse_x) >= ( this.getWindowWidth() - this.options.min_distance_x) ) // too big for X
{
mouse_x = mouse_x - element_width;
// apply min_distance to make sure that the mouse is not on the tool-tip
mouse_x = mouse_x - this.options.min_distance_x;
}
else
{
mouse_x = mouse_x + this.options.min_distance_x;
}
if ( (element_height + mouse_y) >= ( this.getWindowHeight() - this.options.min_distance_y) ) // too big for Y
{
mouse_y = mouse_y - element_height;
// apply min_distance to make sure that the mouse is not on the tool-tip
mouse_y = mouse_y - this.options.min_distance_y;
}
else
{
mouse_y = mouse_y + this.options.min_distance_y;
}
// now set the right styles
this.setStyles(mouse_x, mouse_y);
},
showTooltip: function(event)
{
Event.stop(event);
this.moveTooltip(event);
new Element.show(this.tool_tip);
},
setStyles: function(x, y)
{
// set the right styles to position the tool tip
Element.setStyle(this.tool_tip,
{
position:'absolute',
top:y + this.options.delta_y + "px",
zindex:this.options.zindex
});
// apply default theme if wanted
if (this.options.default_css)
{
Element.setStyle(this.tool_tip,
{
margin:this.options.margin,
padding:this.options.padding,
backgroundColor:this.options.backgroundColor,
zindex:this.options.zindex
});
}
},
hideTooltip: function(event)
{
new Element.hide(this.tool_tip);
},
getWindowHeight: function()
{
var innerHeight;
if (navigator.appVersion.indexOf('MSIE')>0)
{
innerHeight = document.body.clientHeight;
}
else
{
innerHeight = window.innerHeight;
}
return innerHeight;
},
getWindowWidth: function()
{
var innerWidth;
if (navigator.appVersion.indexOf('MSIE')>0)
{
innerWidth = document.body.clientWidth;
}
else
{
innerWidth = window.innerWidth;
}
return innerWidth;
}
}
// JavaScript Document
// Duration slide is shown
var duration = 7000;
var timeout = 7000;
// Width of slide images
var slideWidth = 553;
var slideHeight = 300;
// Internal variables
var currentSlide = 0;
var nextSlide = 0;
var previousSlide = 0;
var working = false;
// Tranition to the next slide
function goForward() {
// Make sure previous transition is complete before proceeding
if (!working) {
working = true;
var slides = $$('div.slideContainer');
// Slideshow has just started
if (currentSlide < 1) currentSlide = 1;
// Set next slide, start over if we are at the end
if (currentSlide < slides.length) nextSlide = currentSlide+1;
else nextSlide = 1;
// Transition to next slide
if ($('slide'+currentSlide).hasClassName('fade')) {
// Fade transition
$('slide'+currentSlide).setStyle({left:'0px',
top:'0px',
display:'inline',
zIndex:'2'});
$('slide'+nextSlide).setStyle({left:'0px',
top:'0px',
display:'inline',
zIndex:'1'});
new Effect.Appear('slide'+nextSlide);
new Effect.Fade('slide'+currentSlide, {
afterFinish: function(){
working = false;} });
} else if ($('slide'+currentSlide).hasClassName('slide')) {
// Slide transtion
$('slide'+currentSlide).setStyle({left:'0px',
top:'0px',
display:'inline',
zIndex:'2'});
$('slide'+nextSlide).setStyle({left:slideWidth+'px',
top:'0px',
display:'inline',
zIndex:'1'});
new Effect.Morph('slide'+currentSlide, {
style: {left:'-'+slideWidth+'px'} });
new Effect.Morph('slide'+nextSlide, {
style: {left:'0px'},
afterFinish: function(){
working = false;} });
} else if ($('slide'+currentSlide).hasClassName('blind')) {
// Blind transtion
$('slide'+currentSlide).setStyle({left:'0px',
top:'0px',
display:'inline',
zIndex:'2'});
$('slide'+nextSlide).setStyle({left:'0px',
top:slideHeight+'px',
display:'inline',
zIndex:'1'});
new Effect.Morph('slide'+currentSlide, {
style: {top:'-'+slideHeight+'px'} });
new Effect.Morph('slide'+nextSlide, {
style: {top:'0px'},
afterFinish: function(){
working = false;} });
}
currentSlide = nextSlide;
clearTimeout(duration);
duration = setTimeout('goForward()',timeout);
}
}
// Transition to the previous slide
function goBack() {
// Make sure previous transition is complete before proceeding
if (!working) {
working = true;
var slides = $$('div.slideContainer');
// Slideshow has just started
if (currentSlide < 1) currentSlide = 1;
if (currentSlide == 1) {
previousSlide = slides.length;
} else previousSlide = currentSlide-1;
if ($('slide'+previousSlide).hasClassName('fade')) {
// Fade transition
$('slide'+currentSlide).setStyle({left:'0px',
top:'0px',
zIndex:'2'});
$('slide'+previousSlide).setStyle({left:'0px',
top:'0px',
zIndex:'1'});
new Effect.Fade('slide'+currentSlide);
new Effect.Appear('slide'+previousSlide, {
afterFinish: function(){
working = false;} });
} else if ($('slide'+previousSlide).hasClassName('slide')) {
// Slide transtion
$('slide'+previousSlide).setStyle({left:'-'+slideWidth+'px',
top:'0px',
display:'inline',
zIndex:'1'});
$('slide'+currentSlide).setStyle({left:'0px',
top:'0px',
zIndex:'2'});
new Effect.Morph('slide'+previousSlide, {
style: {left:'0px'} });
new Effect.Morph('slide'+currentSlide, {
style: {left:slideWidth+'px'},
afterFinish: function(){
working = false;} });
} else if ($('slide'+previousSlide).hasClassName('blind')) {
// Blind transtion
$('slide'+previousSlide).setStyle({left:'0px',
top:'-'+slideHeight+'px',
display:'inline',
zIndex:'1'});
$('slide'+currentSlide).setStyle({left:'0px',
top:'0px',
zIndex:'2'});
new Effect.Morph('slide'+previousSlide, {
style: {top:'0px'} });
new Effect.Morph('slide'+currentSlide, {
style: {top:slideHeight+'px'},
afterFinish: function(){
working = false;} });
}
currentSlide = previousSlide;
clearTimeout(duration);
duration = setTimeout('goForward()',timeout);
}
}
// Pause slideshow
function pause() {
clearTimeout(duration);
$('pauseButton').hide();
$('playButton').show();
}
// Start/Resume slideshow
function play() {
if (!$('slide1').visible()) Effect.Appear('slide1');
duration = setTimeout('goForward()',timeout);
$('playButton').hide();
$('pauseButton').show();
}
// accordion.js v2.0b patched version!!!
//
// Copyright (c) 2007 stickmanlabs
// Author: Kevin P Miller | http://www.stickmanlabs.com
//
// Accordion is freely distributable under the terms of an MIT-style license.
//
// I don't care what you think about the file size...
// Be a pro:
// http://www.thinkvitamin.com/features/webapps/serving-javascript-fast
// http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files
//
/*-----------------------------------------------------------------------------------------------*/
if (typeof Effect == 'undefined')
throw("accordion.js requires including script.aculo.us' effects.js library!");
var accordion = Class.create();
accordion.prototype = {
//
// Setup the Variables
//
showAccordion : null,
currentAccordion : null,
duration : null,
effects : [],
animating : false,
AlreadyActivated : [], //Added by Trey
//
// Initialize the accordions
//
initialize: function(container, options) {
if (!$(container)) {
throw(container+" doesn't exist!");
return false;
}
this.options = Object.extend({
resizeSpeed : 8,
classNames : {
toggle : 'accordion_toggle',
toggleActive : 'accordion_toggle_active',
content : 'accordion_content'
},
defaultSize : {
height : null,
width : null
},
direction : 'vertical',
onEvent : 'click' ,
onActivate : null , //Added by Trey: CallBack Function called when Tab is activated, sends elemet.
RepeatActivate : {} //Added by Trey
}, options || {});
this.AlreadyActivated =[]; //Added by Trey
this.duration = ((11-this.options.resizeSpeed)*0.15);
var accordions = $$('#'+container+' .'+this.options.classNames.toggle);
accordions.each(function(accordion) {
Event.observe(accordion, this.options.onEvent, this.activate.bind(this, accordion), false);
if (this.options.onEvent == 'click') {
accordion.onclick = function() {return false;};
}
if (this.options.direction == 'horizontal') {
var options = { width : '0px' };
} else {
var options = { height : '0px' };
}
Object.extend( options , { display : 'none' });
this.currentAccordion = $(accordion.next(0)).setStyle(options);
}.bind(this));
},
//
// Activate an accordion
//
activate : function(accordion) {
if (this.animating) {
return false;
}
this.effects = [];
if(just_moved)
{
updateOrder();
just_moved = false;
return false;
}
this.currentAccordion = $(accordion.next(0));
//If this options container has not been built yet, then do it
if (this.currentAccordion && this.currentAccordion.id != '' && built_hor_accor[this.currentAccordion.id] != 1 && this.currentAccordion.id.substring(0,8) == 'options_')
{
built_hor_accor[this.currentAccordion.id] = 1;
create_options_container(this.currentAccordion);
}
this.effects = [];
this.currentAccordion.setStyle({
display: 'block'
});
this.currentAccordion.previous(0).addClassName(this.options.classNames.toggleActive);
if (this.options.direction == 'horizontal') {
this . scaling = {
scaleX: true,
scaleY: false
};
} else {
this . scaling = {
scaleX: false,
scaleY: true
};
}
if (this.currentAccordion == this.showAccordion) {
this.deactivate();
} else {
//This was added by Trey Aughenbaugh
//Allows calling a function before activating a new Menu
var bolCall = true;
var elementid = $(this.currentAccordion).id
var AA = this.AlreadyActivated.indexOf(elementid);
var RA = this.options.RepeatActivate[elementid];
if (RA != undefined)
{
if ( AA != -1 )
{
if ( RA != undefined )
bolCall = RA;
}
else
{
this.AlreadyActivated.push(elementid);
}
}
if (this.options.onActivate && bolCall)
this.options.onActivate(this.currentAccordion) ;
//My Code Updates End Here.......................Orig Call Below.
this._handleAccordion();
}
},
//
// Deactivate an active accordion
//
deactivate : function() {
var options = {
duration: this.duration,
scaleContent: false,
transition: Effect.Transitions.sinoidal,
queue: {
position: 'end',
scope: 'accordionAnimation'
},
scaleMode: {
originalHeight: this.options.defaultSize.height ? this.options.defaultSize.height : this.currentAccordion.scrollHeight,
originalWidth: this.options.defaultSize.width ? this.options.defaultSize.width : this.currentAccordion.scrollWidth
},
afterFinish: function() {
this.showAccordion.setStyle({
height : '0px' ,
display: 'none'
});
this.showAccordion = null;
this.animating = false;
}.bind(this)
};
Object.extend ( options , this . scaling );
this.showAccordion.previous(0).removeClassName(this.options.classNames.toggleActive);
new Effect.Scale(this.showAccordion, 0, options);
},
//
// Handle the open/close actions of the accordion
//
_handleAccordion : function() {
var options = {
sync: true,
scaleFrom: 0,
scaleContent: false,
transition: Effect.Transitions.sinoidal,
scaleMode: {
originalHeight: this.options.defaultSize.height ? this.options.defaultSize.height : this.currentAccordion.scrollHeight,
originalWidth: this.options.defaultSize.width ? this.options.defaultSize.width : this.currentAccordion.scrollWidth
}
};
Object.extend( options , this . scaling );
this.effects.push(
new Effect.Scale(this.currentAccordion, 100, options)
);
if (this.showAccordion) {
this.showAccordion.previous(0).removeClassName(this.options.classNames.toggleActive);
options = {
sync: true,
scaleContent: false,
transition: Effect.Transitions.sinoidal
};
Object.extend ( options , this . scaling );
this.effects.push(
new Effect.Scale(this.showAccordion, 0, options)
);
}
new Effect.Parallel(this.effects, {
duration: this.duration,
queue: {
position: 'end',
scope: 'accordionAnimation'
},
beforeStart: function() {
this.animating = true;
}.bind(this),
afterFinish: function() {
if (this.showAccordion) {
this.showAccordion.setStyle({
display: 'none'
});
}
$(this.currentAccordion).setStyle({
height: 'auto'
});
this.showAccordion = this.currentAccordion;
this.animating = false;
}.bind(this)
});
}
}
function create_options_container(currentAccordion)
{
var horizontalAccordions = new accordion(currentAccordion.id , {
classNames : {
toggle : 'horizontal_accordion_toggle',
toggleActive : 'horizontal_accordion_toggle_active',
content : 'horizontal_accordion_content'
},
defaultSize : {
width : 550
},
direction : 'horizontal'
});
//Active the proper option
horizontalAccordions.activate($$('#'+currentAccordion.id+' .horizontal_accordion_toggle')[currentAccordion.descendants()[1].id]);
}
/**
* Javascript code to store data as JSON strings in cookies.
* It uses prototype.js 1.5.1 (http://www.prototypejs.org)
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/jsoncookies
* License: Apache Software License 2
* http://www.apache.org/licenses/LICENSE-2.0
* Version: 0.5
* Updated: Jan 26, 2009
*
* Chnage Log:
* v 0.5
* - Changed License from CC to Apache 2
* v 0.4
* - Removed a extra comma in options (was breaking in IE and Opera). (Thanks Jason)
* - Removed the parameter name from the initialize function
* - Changed the way expires date was being calculated. (Thanks David)
* v 0.3
* - Removed dependancy on json.js (http://www.json.org/json.js)
* - empty() function only deletes the cookies set by CookieJar
*/
var CookieJar = Class.create();
CookieJar.prototype = {
/**
* Append before all cookie names to differntiate them.
*/
appendString: "__CJ_",
/**
* Initializes the cookie jar with the options.
*/
initialize: function(options) {
this.options = {
expires: 3600, // seconds (1 hr)
path: '', // cookie path
domain: '', // cookie domain
secure: '' // secure ?
};
Object.extend(this.options, options || {});
if (this.options.expires != '') {
var date = new Date();
date = new Date(date.getTime() + (this.options.expires * 1000));
this.options.expires = '; expires=' + date.toGMTString();
}
if (this.options.path != '') {
this.options.path = '; path=' + escape(this.options.path);
}
if (this.options.domain != '') {
this.options.domain = '; domain=' + escape(this.options.domain);
}
if (this.options.secure == 'secure') {
this.options.secure = '; secure';
} else {
this.options.secure = '';
}
},
/**
* Adds a name values pair.
*/
put: function(name, value) {
name = this.appendString + name;
cookie = this.options;
var type = typeof value;
switch(type) {
case 'undefined':
case 'function' :
case 'unknown' : return false;
case 'boolean' :
case 'string' :
case 'number' : value = String(value.toString());
}
var cookie_str = name + "=" + escape(Object.toJSON(value));
try {
document.cookie = cookie_str + cookie.expires + cookie.path + cookie.domain + cookie.secure;
} catch (e) {
return false;
}
return true;
},
/**
* Removes a particular cookie (name value pair) form the Cookie Jar.
*/
remove: function(name) {
name = this.appendString + name;
cookie = this.options;
try {
var date = new Date();
date.setTime(date.getTime() - (3600 * 1000));
var expires = '; expires=' + date.toGMTString();
document.cookie = name + "=" + expires + cookie.path + cookie.domain + cookie.secure;
} catch (e) {
return false;
}
return true;
},
/**
* Return a particular cookie by name;
*/
get: function(name) {
name = this.appendString + name;
var cookies = document.cookie.match(name + '=(.*?)(;|$)');
if (cookies) {
return (unescape(cookies[1])).evalJSON();
} else {
return null;
}
},
/**
* Empties the Cookie Jar. Deletes all the cookies.
*/
empty: function() {
keys = this.getKeys();
size = keys.size();
for(i=0; i