﻿var Slimbox = (function () { var F = window, n = Browser.Engine.trident4, u, g, G = -1, o, w, E, v, y, M, s, m = {}, t = new Image(), K = new Image(), I, a, h, q, J, e, H, c, A, L, x, i, d, C; F.addEvent("domready", function () { $(document.body).adopt($$(I = new Element("div", { id: "lbOverlay", events: { click: D} }), a = new Element("div", { id: "lbCenter" }), H = new Element("div", { id: "lbBottomContainer" })).setStyle("display", "none")); h = new Element("div", { id: "lbImage" }).injectInside(a).adopt(q = new Element("div", { styles: { position: "relative"} }).adopt(J = new Element("a", { id: "lbPrevLink", href: "#", events: { click: B} }), e = new Element("a", { id: "lbNextLink", href: "#", events: { click: f} }))); c = new Element("div", { id: "lbBottom" }).injectInside(H).adopt(new Element("a", { id: "lbCloseLink", href: "#", events: { click: D} }), A = new Element("div", { id: "lbCaption" }), L = new Element("div", { id: "lbNumber" }), new Element("div", { styles: { clear: "both"} })) }); function z() { var N = F.getScroll(), O = F.getSize(); $$(a, H).setStyle("left", N.x + (O.x / 2)); if (v) { I.setStyles({ left: N.x, top: N.y, width: O.x, height: O.y }) } } function l(N) { ["object", n ? "select" : "embed"].forEach(function (P) { Array.forEach(document.getElementsByTagName(P), function (Q) { if (N) { Q._slimbox = Q.style.visibility } Q.style.visibility = N ? "hidden" : Q._slimbox }) }); I.style.display = N ? "" : "none"; var O = N ? "addEvent" : "removeEvent"; F[O]("scroll", z)[O]("resize", z); document[O]("keydown", p) } function p(O) { var N = O.code; return u.closeKeys.contains(N) ? D() : u.nextKeys.contains(N) ? f() : u.previousKeys.contains(N) ? B() : false } function B() { return b(w) } function f() { return b(E) } function b(N) { if (N >= 0) { G = N; o = g[N][0]; w = (G || (u.loop ? g.length : 0)) - 1; E = ((G + 1) % g.length) || (u.loop ? 0 : -1); r(); a.className = "lbLoading"; m = new Image(); m.onload = k; m.src = o } return false } function k() { a.className = ""; d.set(0); h.setStyles({ backgroundImage: "url(" + o + ")", display: "" }); q.setStyle("width", m.width); $$(q, J, e).setStyle("height", m.height); A.set("html", g[G][1] || ""); L.set("html", (((g.length > 1) && u.counterText) || "").replace(/{x}/, G + 1).replace(/{y}/, g.length)); if (w >= 0) { t.src = g[w][0] } if (E >= 0) { K.src = g[E][0] } M = h.offsetWidth; s = h.offsetHeight; a.setStyles({ top: Math.max(0, y - (s / 2)), width: M, height: s, marginLeft: -M / 2, display: "" }); var P = Math.max(0, y - (s / 2)), N = 0, O; if (a.offsetHeight != s) { N = i.start({ height: s, top: P }) } if (a.offsetWidth != M) { N = i.start({ width: M, marginLeft: -M / 2 }) } O = function () { H.setStyles({ width: M, top: P + s, marginLeft: -M / 2, visibility: "hidden", display: "" }); d.start(1) }; if (N) { i.chain(O) } else { O() } } function j() { if (w >= 0) { J.style.display = "" } if (E >= 0) { e.style.display = "" } C.set(-c.offsetHeight).start(0); H.style.visibility = "" } function r() { m.onload = $empty; m.src = t.src = K.src = o; i.cancel(); d.cancel(); C.cancel(); $$(J, e, h, H).setStyle("display", "none") } function D() { if (G >= 0) { r(); G = w = E = -1; a.style.display = "none"; x.cancel().chain(l).start(0) } return false } Element.implement({ slimbox: function (N, O) { $$(this).slimbox(N, O); return this } }); Elements.implement({ slimbox: function (N, Q, P) { Q = Q || function (R) { return [R.href, R.title] }; P = P || function () { return true }; var O = this; O.removeEvents("click").addEvent("click", function () { var R = O.filter(P, this); return Slimbox.open(R.map(Q), R.indexOf(this), N) }); return O } }); return { open: function (P, O, N) { u = $extend({ loop: false, overlayOpacity: 0.8, overlayFadeDuration: 400, resizeDuration: 400, resizeTransition: false, initialWidth: 250, initialHeight: 250, imageFadeDuration: 400, captionAnimationDuration: 400, counterText: "Image {x} of {y}", closeKeys: [27, 88, 67], previousKeys: [37, 80], nextKeys: [39, 78] }, N || {}); x = new Fx.Tween(I, { property: "opacity", duration: u.overlayFadeDuration }); i = new Fx.Morph(a, $extend({ duration: u.resizeDuration, link: "chain" }, u.resizeTransition ? { transition: u.resizeTransition} : {})); d = new Fx.Tween(h, { property: "opacity", duration: u.imageFadeDuration, onComplete: j }); C = new Fx.Tween(c, { property: "margin-top", duration: u.captionAnimationDuration }); if (typeof P == "string") { P = [[P, O]]; O = 0 } y = F.getScrollTop() + (F.getHeight() / 2); M = u.initialWidth; s = u.initialHeight; a.setStyles({ top: Math.max(0, y - (s / 2)), width: M, height: s, marginLeft: -M / 2, display: "" }); v = n || (I.currentStyle && (I.currentStyle.position != "fixed")); if (v) { I.style.position = "absolute" } x.set(0).start(u.overlayOpacity); z(); l(1); g = P; u.loop = u.loop && (g.length > 1); return b(O) } } })(); Slimbox.scanPage = function () { $$("a").filter(function (el) { return el.rel && el.rel.test(/^lightbox/i); }).slimbox({}, null, function (el) { return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel)); }); }; if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) { window.addEvent("domready", Slimbox.scanPage); }
var TINY = {}; function T$(i) { return document.getElementById(i) } TINY.box = function () { var p, m, b, fn, ic, iu, iw, ih, ia, f = 0; return { show: function (c, u, w, h, a, t) { if (!f) { p = document.createElement('div'); p.id = 'tinybox'; m = document.createElement('div'); m.id = 'tinymask'; b = document.createElement('div'); b.id = 'tinycontent'; document.body.appendChild(m); document.body.appendChild(p); p.appendChild(b); m.onclick = TINY.box.hide; window.onresize = TINY.box.resize; f = 1 } if (!a && !u) { p.style.width = w ? w + 'px' : 'auto'; p.style.height = h ? h + 'px' : 'auto'; p.style.backgroundImage = 'none'; b.innerHTML = c } else { b.style.display = 'none'; p.style.width = p.style.height = '100px' } this.mask(); ic = c; iu = u; iw = w; ih = h; ia = a; this.alpha(m, 1, 80, 3); if (t) { setTimeout(function () { TINY.box.hide() }, 1000 * t) } }, fill: function (c, u, w, h, a) { if (u) { p.style.backgroundImage = ''; var x = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); x.onreadystatechange = function () { if (x.readyState == 4 && x.status == 200) { TINY.box.psh(x.responseText, w, h, a) } }; x.open('GET', c, 1); x.send(null) } else { this.psh(c, w, h, a) } }, psh: function (c, w, h, a) { if (a) { if (!w || !h) { var x = p.style.width, y = p.style.height; b.innerHTML = c; p.style.width = w ? w + 'px' : ''; p.style.height = h ? h + 'px' : ''; b.style.display = ''; w = parseInt(b.offsetWidth); h = parseInt(b.offsetHeight); b.style.display = 'none'; p.style.width = x; p.style.height = y } else { b.innerHTML = c } this.size(p, w, h, 4) } else { p.style.backgroundImage = 'none' } }, hide: function () { TINY.box.alpha(p, -1, 0, 3) }, resize: function () { TINY.box.pos(); TINY.box.mask() }, mask: function () { m.style.height = TINY.page.theight() + 'px'; m.style.width = ''; m.style.width = TINY.page.twidth() + 'px' }, pos: function () { var t = (TINY.page.height() / 2) - (p.offsetHeight / 2); t = t < 10 ? 10 : t; p.style.top = (t + TINY.page.top()) + 'px'; p.style.left = (TINY.page.width() / 2) - (p.offsetWidth / 2) + 'px' }, alpha: function (e, d, a, s) { clearInterval(e.ai); if (d == 1) { e.style.opacity = 0; e.style.filter = 'alpha(opacity=0)'; e.style.display = 'block'; this.pos() } e.ai = setInterval(function () { TINY.box.twalpha(e, a, d, s) }, 20) }, twalpha: function (e, a, d, s) { var o = Math.round(e.style.opacity * 100); if (o == a) { clearInterval(e.ai); if (d == -1) { e.style.display = 'none'; e == p ? TINY.box.alpha(m, -1, 0, 2) : b.innerHTML = p.style.backgroundImage = '' } else { e == m ? this.alpha(p, 1, 100, 5) : TINY.box.fill(ic, iu, iw, ih, ia) } } else { var n = o + Math.ceil(Math.abs(a - o) / s) * d; e.style.opacity = n / 100; e.style.filter = 'alpha(opacity=' + n + ')' } }, size: function (e, w, h, s) { e = typeof e == 'object' ? e : T$(e); clearInterval(e.si); var ow = e.offsetWidth, oh = e.offsetHeight, wo = ow - parseInt(e.style.width), ho = oh - parseInt(e.style.height); var wd = ow - wo > w ? -1 : 1, hd = (oh - ho > h) ? -1 : 1; e.si = setInterval(function () { TINY.box.twsize(e, w, wo, wd, h, ho, hd, s) }, 20) }, twsize: function (e, w, wo, wd, h, ho, hd, s) { var ow = e.offsetWidth - wo, oh = e.offsetHeight - ho; if (ow == w && oh == h) { clearInterval(e.si); p.style.backgroundImage = 'none'; b.style.display = 'block' } else { if (ow != w) { e.style.width = ow + (Math.ceil(Math.abs(w - ow) / s) * wd) + 'px' } if (oh != h) { e.style.height = oh + (Math.ceil(Math.abs(h - oh) / s) * hd) + 'px' } this.pos() } } } } (); TINY.page = function () { return { top: function () { return document.body.scrollTop || document.documentElement.scrollTop }, width: function () { return self.innerWidth || document.documentElement.clientWidth }, height: function () { return self.innerHeight || document.documentElement.clientHeight }, theight: function () { var d = document, b = d.body, e = d.documentElement; return Math.max(Math.max(b.scrollHeight, e.scrollHeight), Math.max(b.clientHeight, e.clientHeight)) }, twidth: function () { var d = document, b = d.body, e = d.documentElement; return Math.max(Math.max(b.scrollWidth, e.scrollWidth), Math.max(b.clientWidth, e.clientWidth)) } } } (); formcheckLanguage = { required: "This field is required.", alpha: "This field accepts alphabetic characters only.", alphanum: "This field accepts alphanumeric characters only.", nodigit: "No digits are accepted.", digit: "Please enter a valid integer.", digitmin: "The number must be at least %0", digitltd: "The value must be between %0 and %1", number: "Please enter a valid number.", email: "Please enter a valid email: <br /><span>E.g. yourname@domain.com</span>", phone: "Please enter a valid phone.", url: "Please enter a valid url: <br /><span>E.g. http://www.domain.com</span>", confirm: "This field is different from %0", differs: "This value must be different of %0", length_str: "The length is incorrect, it must be between %0 and %1", length_fix: "The length is incorrect, it must be exactly %0 characters", lengthmax: "The length is incorrect, it must be at max %0", lengthmin: "The length is incorrect, it must be at least %0", checkbox: "Please check the box", radios: "Please select a radio", select: "Please choose a value" }
/*
---
description:     Overlay

authors:
- David Walsh (http://davidwalsh.name)

license:
- MIT-style license

requires:
core/1.2.1:   '*'

provides:
- Overlay
...
*/
var Overlay = new Class({ Implements: [Options, Events], options: { id: "overlay", color: "#000", duration: 500, opacity: 0.5, zIndex: 5000 }, initialize: function (a, b) { this.setOptions(b); this.container = document.id(a); if (Browser.Engine.trident && Browser.Engine.version <= 6) { this.ie6 = true; } this.overlay = new Element("div", { id: this.options.id, opacity: 0, styles: { position: (this.ie6) ? "absolute" : "fixed", background: this.options.color, left: 0, top: 0, "z-index": this.options.zIndex }, events: { click: function () { this.fireEvent("click"); } .bind(this)} }).inject(this.container); this.tween = new Fx.Tween(this.overlay, { duration: this.options.duration, link: "cancel", property: "opacity", onStart: function () { this.overlay.setStyles({ width: "100%", height: this.container.getScrollSize().y }); } .bind(this), onComplete: function () { this.fireEvent(this.overlay.get("opacity") == this.options.opacity ? "show" : "hide"); } .bind(this) }); window.addEvents({ resize: function () { this.resize(); } .bind(this), scroll: function () { this.scroll(); } .bind(this) }); }, open: function () { this.fireEvent("open"); this.tween.start(this.options.opacity); return this; }, close: function () { this.fireEvent("close"); this.tween.start(0); return this; }, resize: function () { this.fireEvent("resize"); this.overlay.setStyle("height", this.container.getScrollSize().y); return this; }, scroll: function () { this.fireEvent("scroll"); if (this.ie6) { this.overlay.setStyle("left", window.getScroll().x); } return this; } });


window.addEvent('domready', function () {
	if (document.getElementById("messagePanelPopup")) {
		$('messagePanelPopup').addEvent('click', function () {
			new Fx.Reveal($('messagePanelPopup')).dissolve();
		});
	}

	if ($(document.body).getElement('.homepagePropertiesOfTheWeek')) {
		startBanner();
	}

	$$('.textField').each(function (item) {
		item.addEvent("focus", function () { if (this.value == this.defaultValue) this.set('value', ''); });
		item.addEvent("blur", function () { if (this.value == '') this.set('value', this.defaultValue); });
		return false;
	});
});

function startBanner() {
	/* Banner settings */
	var showDuration = 6000;
	var images = $$('.homepagePropertyOfTheWeek');
	var currentIndex = 0;
	var interval;
	/* opacity and fade */
	images.each(function (img, i) {
		if (i > 0) {
			img.set('opacity', 0);
		}
	});
	/* worker */
	var show = function () {
		images[currentIndex].set('tween', { duration: '1000' }).fade('out');
		images[currentIndex = currentIndex < images.length - 1 ? currentIndex + 1 : 0].set('tween', { duration: '1000' }).fade('in');
	};
	/* start once the page is finished loading */
	window.addEvent('load', function () {
		interval = show.periodical(showDuration);
	});
}

function googleTranslateElementInit() {
	new google.translate.TranslateElement({
		pageLanguage: 'en',
		autoDisplay: true
	}, 'google_translate_element');
}


function load() {
	Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}

function EndRequestHandler()
{
	if ($(document.body).getElement('.loadModalBool')) {
		if ($(document.body).getElement('.loadModalBool').get('value') == "true") {
			$find('modalExtend').show();
		}
	};
}
