/** <Contains> **

1.  PNG fix (v 1.2)
2.  Cycle (v 2.63)
3.  Image Resizer (v 1.0)
4.  Image Tooltip (v 1.0)
5.  Suckerfish menu (v 0.5)
6.  Thickbox (v 3.1)
7.  Innerfade (v 1.0)
8.  Tooltip (v 1.1)
9.  Ajax form (v 1.0)
10. Color anmations (v 1.0)
11. Accordion (v 0.1)
12. Ajax slideshow (v 0.1)
13. ShoppingCart (v 0.1)
14. LoadSubMenu (v 0.1)
15. Google Maps (v 1.0)

</Contains>
<FunctionSetup>

(function($){
$.fn.extend({
FunctionName: function(Settings) { //ToDo; Applying settings
return this.each(function(){
});
}
});
})(jQuery);

</FunctionSetup>

**/


// PNG Fix

/**
* --------------------------------------------------------------------
* jQuery-Plugin "pngFix"
* Version: 1.2, 09.03.2009
* by Andreas Eberhard, andreas.eberhard@gmail.com
*                      http://jquery.andreaseberhard.de/
*
* Copyright (c) 2007 Andreas Eberhard
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
*
* Changelog:
*    09.03.2009 Version 1.2
*    - Update for jQuery 1.3.x, removed @ from selectors
*    11.09.2007 Version 1.1
*    - removed noConflict
*    - added png-support for input type=image
*    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
*    31.05.2007 initial Version 1.0
* --------------------------------------------------------------------
* @example $(function(){$(document).pngFix();});
* @desc Fixes all PNG's in the document on document.ready
*
* jQuery(function(){jQuery(document).pngFix();});
* @desc Fixes all PNG's in the document on document.ready when using noConflict
*
* @example $(function(){$('div.examples').pngFix();});
* @desc Fixes all PNG's within div with class examples
*
* @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
* @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
* --------------------------------------------------------------------
*/

(function($) {

    jQuery.fn.pngFix = function(settings) {

        // Settings
        settings = jQuery.extend({
            blankgif: 'blank.gif'
        }, settings);

        var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
        var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

        if (jQuery.browser.msie && (ie55 || ie6)) {

            //fix images with png-source
            jQuery(this).find("img[src$=.png]").each(function() {

                jQuery(this).attr('width', jQuery(this).width());
                jQuery(this).attr('height', jQuery(this).height());

                var prevStyle = '';
                var strNewHTML = '';
                var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
                var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
                var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
                var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
                var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
                var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
                if (this.style.border) {
                    prevStyle += 'border:' + this.style.border + ';';
                    this.style.border = '';
                }
                if (this.style.padding) {
                    prevStyle += 'padding:' + this.style.padding + ';';
                    this.style.padding = '';
                }
                if (this.style.margin) {
                    prevStyle += 'margin:' + this.style.margin + ';';
                    this.style.margin = '';
                }
                var imgStyle = (this.style.cssText);

                strNewHTML += '<span ' + imgId + imgClass + imgTitle + imgAlt;
                strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;' + imgAlign + imgHand;
                strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
                strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
                strNewHTML += imgStyle + '"></span>';
                if (prevStyle != '') {
                    strNewHTML = '<span style="position:relative;display:inline-block;' + prevStyle + imgHand + 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;' + '">' + strNewHTML + '</span>';
                }

                jQuery(this).hide();
                jQuery(this).after(strNewHTML);

            });

            // fix css background pngs
            jQuery(this).find("*").each(function() {
                var bgIMG = jQuery(this).css('background-image');
                if (bgIMG.indexOf(".png") != -1) {
                    var iebg = bgIMG.split('url("')[1].split('")')[0];
                    jQuery(this).css('background-image', 'none');
                    jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
                }
            });

            //fix input with png-source
            jQuery(this).find("input[src$=.png]").each(function() {
                var bgIMG = jQuery(this).attr('src');
                jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
                jQuery(this).attr('src', settings.blankgif)
            });

        }

        return jQuery;

    };

})(jQuery);


// Cycle

/*
* jQuery Cycle Plugin (with Transition Definitions)
* Examples and documentation at: http://jquery.malsup.com/cycle/
* Copyright (c) 2007-2009 M. Alsup
* Version: 2.63 (17-MAR-2009)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Requires: jQuery v1.2.6 or later
*
* Originally based on the work of:
*	1) Matt Oakes
*	2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/)
*	3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/)
*/
; (function($) { var ver = "2.63"; if ($.support == undefined) { $.support = { opacity: !($.browser.msie) }; } function log() { if (window.console && window.console.log) { window.console.log("[cycle] " + Array.prototype.join.call(arguments, " ")); } } $.fn.cycle = function(options, arg2) { var o = { s: this.selector, c: this.context }; if (this.length == 0 && options != "stop") { if (!$.isReady && o.s) { log("DOM not ready, queuing slideshow"); $(function() { $(o.s, o.c).cycle(options, arg2); }); return this; } log("terminating; zero elements found by selector" + ($.isReady ? "" : " (DOM not ready)")); return this; } return this.each(function() { options = handleArguments(this, options, arg2); if (options === false) { return; } if (this.cycleTimeout) { clearTimeout(this.cycleTimeout); } this.cycleTimeout = this.cyclePause = 0; var $cont = $(this); var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children(); var els = $slides.get(); if (els.length < 2) { log("terminating; too few slides: " + els.length); return; } var opts = buildOptions($cont, $slides, els, options, o); if (opts === false) { return; } if (opts.timeout || opts.continuous) { this.cycleTimeout = setTimeout(function() { go(els, opts, 0, !opts.rev); }, opts.continuous ? 10 : opts.timeout + (opts.delay || 0)); } }); }; function handleArguments(cont, options, arg2) { if (cont.cycleStop == undefined) { cont.cycleStop = 0; } if (options === undefined || options === null) { options = {}; } if (options.constructor == String) { switch (options) { case "stop": cont.cycleStop++; if (cont.cycleTimeout) { clearTimeout(cont.cycleTimeout); } cont.cycleTimeout = 0; $(cont).removeData("cycle.opts"); return false; case "pause": cont.cyclePause = 1; return false; case "resume": cont.cyclePause = 0; if (arg2 === true) { options = $(cont).data("cycle.opts"); if (!options) { log("options not found, can not resume"); return false; } if (cont.cycleTimeout) { clearTimeout(cont.cycleTimeout); cont.cycleTimeout = 0; } go(options.elements, options, 1, 1); } return false; default: options = { fx: options }; } } else { if (options.constructor == Number) { var num = options; options = $(cont).data("cycle.opts"); if (!options) { log("options not found, can not advance slide"); return false; } if (num < 0 || num >= options.elements.length) { log("invalid slide index: " + num); return false; } options.nextSlide = num; if (cont.cycleTimeout) { clearTimeout(this.cycleTimeout); cont.cycleTimeout = 0; } if (typeof arg2 == "string") { options.oneTimeFx = arg2; } go(options.elements, options, 1, num >= options.currSlide); return false; } } return options; } function removeFilter(el, opts) { if (!$.support.opacity && opts.cleartype && el.style.filter) { try { el.style.removeAttribute("filter"); } catch (smother) { } } } function buildOptions($cont, $slides, els, options, o) { var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); if (opts.autostop) { opts.countdown = opts.autostopCount || els.length; } var cont = $cont[0]; $cont.data("cycle.opts", opts); opts.$cont = $cont; opts.stopCount = cont.cycleStop; opts.elements = els; opts.before = opts.before ? [opts.before] : []; opts.after = opts.after ? [opts.after] : []; opts.after.unshift(function() { opts.busy = 0; }); if (!$.support.opacity && opts.cleartype) { opts.after.push(function() { removeFilter(this, opts); }); } if (opts.continuous) { opts.after.push(function() { go(els, opts, 0, !opts.rev); }); } saveOriginalOpts(opts); if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) { clearTypeFix($slides); } if ($cont.css("position") == "static") { $cont.css("position", "relative"); } if (opts.width) { $cont.width(opts.width); } if (opts.height && opts.height != "auto") { $cont.height(opts.height); } if (opts.startingSlide) { opts.startingSlide = parseInt(opts.startingSlide); } if (opts.random) { opts.randomMap = []; for (var i = 0; i < els.length; i++) { opts.randomMap.push(i); } opts.randomMap.sort(function(a, b) { return Math.random() - 0.5; }); opts.randomIndex = 0; opts.startingSlide = opts.randomMap[0]; } else { if (opts.startingSlide >= els.length) { opts.startingSlide = 0; } } opts.currSlide = opts.startingSlide = opts.startingSlide || 0; var first = opts.startingSlide; $slides.css({ position: "absolute", top: 0, left: 0 }).hide().each(function(i) { var z = first ? i >= first ? els.length - (i - first) : first - i : els.length - i; $(this).css("z-index", z); }); $(els[first]).css("opacity", 1).show(); removeFilter(els[first], opts); if (opts.fit && opts.width) { $slides.width(opts.width); } if (opts.fit && opts.height && opts.height != "auto") { $slides.height(opts.height); } var reshape = opts.containerResize && !$cont.innerHeight(); if (reshape) { var maxw = 0, maxh = 0; for (var i = 0; i < els.length; i++) { var $e = $(els[i]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight(); if (!w) { w = e.offsetWidth; } if (!h) { h = e.offsetHeight; } maxw = w > maxw ? w : maxw; maxh = h > maxh ? h : maxh; } if (maxw > 0 && maxh > 0) { $cont.css({ width: maxw + "px", height: maxh + "px" }); } } if (opts.pause) { $cont.hover(function() { this.cyclePause++; }, function() { this.cyclePause--; }); } if (supportMultiTransitions(opts) === false) { return false; } if (!opts.multiFx) { var init = $.fn.cycle.transitions[opts.fx]; if ($.isFunction(init)) { init($cont, $slides, opts); } else { if (opts.fx != "custom" && !opts.multiFx) { log("unknown transition: " + opts.fx, "; slideshow terminating"); return false; } } } var requeue = false; options.requeueAttempts = options.requeueAttempts || 0; $slides.each(function() { var $el = $(this); this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height(); this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width(); if ($el.is("img")) { var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete); var loadingOp = ($.browser.opera && this.cycleW == 42 && this.cycleH == 19 && !this.complete); var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete); if (loadingIE || loadingOp || loadingOther) { if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { log(options.requeueAttempts, " - img slide not loaded, requeuing slideshow: ", this.src, this.cycleW, this.cycleH); setTimeout(function() { $(o.s, o.c).cycle(options); }, opts.requeueTimeout); requeue = true; return false; } else { log("could not determine size of image: " + this.src, this.cycleW, this.cycleH); } } } return true; }); if (requeue) { return false; } opts.cssBefore = opts.cssBefore || {}; opts.animIn = opts.animIn || {}; opts.animOut = opts.animOut || {}; $slides.not(":eq(" + first + ")").css(opts.cssBefore); if (opts.cssFirst) { $($slides[first]).css(opts.cssFirst); } if (opts.timeout) { opts.timeout = parseInt(opts.timeout); if (opts.speed.constructor == String) { opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed); } if (!opts.sync) { opts.speed = opts.speed / 2; } while ((opts.timeout - opts.speed) < 250) { opts.timeout += opts.speed; } } if (opts.easing) { opts.easeIn = opts.easeOut = opts.easing; } if (!opts.speedIn) { opts.speedIn = opts.speed; } if (!opts.speedOut) { opts.speedOut = opts.speed; } opts.slideCount = els.length; opts.currSlide = opts.lastSlide = first; if (opts.random) { opts.nextSlide = opts.currSlide; if (++opts.randomIndex == els.length) { opts.randomIndex = 0; } opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { opts.nextSlide = opts.startingSlide >= (els.length - 1) ? 0 : opts.startingSlide + 1; } var e0 = $slides[first]; if (opts.before.length) { opts.before[0].apply(e0, [e0, e0, opts, true]); } if (opts.after.length > 1) { opts.after[1].apply(e0, [e0, e0, opts, true]); } if (opts.next) { $(opts.next).click(function() { return advance(opts, opts.rev ? -1 : 1); }); } if (opts.prev) { $(opts.prev).click(function() { return advance(opts, opts.rev ? 1 : -1); }); } if (opts.pager) { buildPager(els, opts); } exposeAddSlide(opts, els); return opts; } function saveOriginalOpts(opts) { opts.original = { before: [], after: [] }; opts.original.cssBefore = $.extend({}, opts.cssBefore); opts.original.cssAfter = $.extend({}, opts.cssAfter); opts.original.animIn = $.extend({}, opts.animIn); opts.original.animOut = $.extend({}, opts.animOut); $.each(opts.before, function() { opts.original.before.push(this); }); $.each(opts.after, function() { opts.original.after.push(this); }); } function supportMultiTransitions(opts) { var txs = $.fn.cycle.transitions; if (opts.fx.indexOf(",") > 0) { opts.multiFx = true; opts.fxs = opts.fx.replace(/\s*/g, "").split(","); for (var i = 0; i < opts.fxs.length; i++) { var fx = opts.fxs[i]; var tx = txs[fx]; if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) { log("discarding unknown transition: ", fx); opts.fxs.splice(i, 1); i--; } } if (!opts.fxs.length) { log("No valid transitions named; slideshow terminating."); return false; } } else { if (opts.fx == "all") { opts.multiFx = true; opts.fxs = []; for (p in txs) { var tx = txs[p]; if (txs.hasOwnProperty(p) && $.isFunction(tx)) { opts.fxs.push(p); } } } } if (opts.multiFx && opts.randomizeEffects) { var r1 = Math.floor(Math.random() * 20) + 30; for (var i = 0; i < r1; i++) { var r2 = Math.floor(Math.random() * opts.fxs.length); opts.fxs.push(opts.fxs.splice(r2, 1)[0]); } log("randomized fx sequence: ", opts.fxs); } return true; } function exposeAddSlide(opts, els) { opts.addSlide = function(newSlide, prepend) { var $s = $(newSlide), s = $s[0]; if (!opts.autostopCount) { opts.countdown++; } els[prepend ? "unshift" : "push"](s); if (opts.els) { opts.els[prepend ? "unshift" : "push"](s); } opts.slideCount = els.length; $s.css("position", "absolute"); $s[prepend ? "prependTo" : "appendTo"](opts.$cont); if (prepend) { opts.currSlide++; opts.nextSlide++; } if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) { clearTypeFix($s); } if (opts.fit && opts.width) { $s.width(opts.width); } if (opts.fit && opts.height && opts.height != "auto") { $slides.height(opts.height); } s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height(); s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width(); $s.css(opts.cssBefore); if (opts.pager) { $.fn.cycle.createPagerAnchor(els.length - 1, s, $(opts.pager), els, opts); } if ($.isFunction(opts.onAddSlide)) { opts.onAddSlide($s); } else { $s.hide(); } }; } $.fn.cycle.resetState = function(opts, fx) { fx = fx || opts.fx; opts.before = []; opts.after = []; opts.cssBefore = $.extend({}, opts.original.cssBefore); opts.cssAfter = $.extend({}, opts.original.cssAfter); opts.animIn = $.extend({}, opts.original.animIn); opts.animOut = $.extend({}, opts.original.animOut); opts.fxFn = null; $.each(opts.original.before, function() { opts.before.push(this); }); $.each(opts.original.after, function() { opts.after.push(this); }); var init = $.fn.cycle.transitions[fx]; if ($.isFunction(init)) { init(opts.$cont, $(opts.elements), opts); } }; function go(els, opts, manual, fwd) { if (manual && opts.busy && opts.manualTrump) { $(els).stop(true, true); opts.busy = false; } if (opts.busy) { return; } var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide]; if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual) { return; } if (!manual && !p.cyclePause && ((opts.autostop && (--opts.countdown <= 0)) || (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) { if (opts.end) { opts.end(opts); } return; } if (manual || !p.cyclePause) { var fx = opts.fx; curr.cycleH = curr.cycleH || $(curr).height(); curr.cycleW = curr.cycleW || $(curr).width(); next.cycleH = next.cycleH || $(next).height(); next.cycleW = next.cycleW || $(next).width(); if (opts.multiFx) { if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length) { opts.lastFx = 0; } fx = opts.fxs[opts.lastFx]; opts.currFx = fx; } if (opts.oneTimeFx) { fx = opts.oneTimeFx; opts.oneTimeFx = null; } $.fn.cycle.resetState(opts, fx); if (opts.before.length) { $.each(opts.before, function(i, o) { if (p.cycleStop != opts.stopCount) { return; } o.apply(next, [curr, next, opts, fwd]); }); } var after = function() { $.each(opts.after, function(i, o) { if (p.cycleStop != opts.stopCount) { return; } o.apply(next, [curr, next, opts, fwd]); }); }; if (opts.nextSlide != opts.currSlide) { opts.busy = 1; if (opts.fxFn) { opts.fxFn(curr, next, opts, after, fwd); } else { if ($.isFunction($.fn.cycle[opts.fx])) { $.fn.cycle[opts.fx](curr, next, opts, after); } else { $.fn.cycle.custom(curr, next, opts, after, manual && opts.fastOnEvent); } } } opts.lastSlide = opts.currSlide; if (opts.random) { opts.currSlide = opts.nextSlide; if (++opts.randomIndex == els.length) { opts.randomIndex = 0; } opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { var roll = (opts.nextSlide + 1) == els.length; opts.nextSlide = roll ? 0 : opts.nextSlide + 1; opts.currSlide = roll ? els.length - 1 : opts.nextSlide - 1; } if (opts.pager) { $.fn.cycle.updateActivePagerLink(opts.pager, opts.currSlide); } } var ms = 0; if (opts.timeout && !opts.continuous) { ms = getTimeout(curr, next, opts, fwd); } else { if (opts.continuous && p.cyclePause) { ms = 10; } } if (ms > 0) { p.cycleTimeout = setTimeout(function() { go(els, opts, 0, !opts.rev); }, ms); } } $.fn.cycle.updateActivePagerLink = function(pager, currSlide) { $(pager).find("a").removeClass("activeSlide").filter("a:eq(" + currSlide + ")").addClass("activeSlide"); }; function getTimeout(curr, next, opts, fwd) { if (opts.timeoutFn) { var t = opts.timeoutFn(curr, next, opts, fwd); if (t !== false) { return t; } } return opts.timeout; } $.fn.cycle.next = function(opts) { advance(opts, opts.rev ? -1 : 1); }; $.fn.cycle.prev = function(opts) { advance(opts, opts.rev ? 1 : -1); }; function advance(opts, val) { var els = opts.elements; var p = opts.$cont[0], timeout = p.cycleTimeout; if (timeout) { clearTimeout(timeout); p.cycleTimeout = 0; } if (opts.random && val < 0) { opts.randomIndex--; if (--opts.randomIndex == -2) { opts.randomIndex = els.length - 2; } else { if (opts.randomIndex == -1) { opts.randomIndex = els.length - 1; } } opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { if (opts.random) { if (++opts.randomIndex == els.length) { opts.randomIndex = 0; } opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { opts.nextSlide = opts.currSlide + val; if (opts.nextSlide < 0) { if (opts.nowrap) { return false; } opts.nextSlide = els.length - 1; } else { if (opts.nextSlide >= els.length) { if (opts.nowrap) { return false; } opts.nextSlide = 0; } } } } if ($.isFunction(opts.prevNextClick)) { opts.prevNextClick(val > 0, opts.nextSlide, els[opts.nextSlide]); } go(els, opts, 1, val >= 0); return false; } function buildPager(els, opts) { var $p = $(opts.pager); $.each(els, function(i, o) { $.fn.cycle.createPagerAnchor(i, o, $p, els, opts); }); $.fn.cycle.updateActivePagerLink(opts.pager, opts.startingSlide); } $.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) { var a = ($.isFunction(opts.pagerAnchorBuilder)) ? opts.pagerAnchorBuilder(i, el) : '<a href="#">' + (i + 1) + "</a>"; if (!a) { return; } var $a = $(a); if ($a.parents("body").length == 0) { $a.appendTo($p); } $a.bind(opts.pagerEvent, function() { opts.nextSlide = i; var p = opts.$cont[0], timeout = p.cycleTimeout; if (timeout) { clearTimeout(timeout); p.cycleTimeout = 0; } if ($.isFunction(opts.pagerClick)) { opts.pagerClick(opts.nextSlide, els[opts.nextSlide]); } go(els, opts, 1, opts.currSlide < i); return false; }); if (opts.pauseOnPagerHover) { $a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; }); } }; $.fn.cycle.hopsFromLast = function(opts, fwd) { var hops, l = opts.lastSlide, c = opts.currSlide; if (fwd) { hops = c > l ? c - l : opts.slideCount - l; } else { hops = c < l ? l - c : l + opts.slideCount - c; } return hops; }; function clearTypeFix($slides) { function hex(s) { s = parseInt(s).toString(16); return s.length < 2 ? "0" + s : s; } function getBg(e) { for (; e && e.nodeName.toLowerCase() != "html"; e = e.parentNode) { var v = $.css(e, "background-color"); if (v.indexOf("rgb") >= 0) { var rgb = v.match(/\d+/g); return "#" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); } if (v && v != "transparent") { return v; } } return "#ffffff"; } $slides.each(function() { $(this).css("background-color", getBg(this)); }); } $.fn.cycle.commonReset = function(curr, next, opts, w, h, rev) { $(opts.elements).not(curr).hide(); opts.cssBefore.opacity = 1; opts.cssBefore.display = "block"; if (w !== false && next.cycleW > 0) { opts.cssBefore.width = next.cycleW; } if (h !== false && next.cycleH > 0) { opts.cssBefore.height = next.cycleH; } opts.cssAfter = opts.cssAfter || {}; opts.cssAfter.display = "none"; $(curr).css("zIndex", opts.slideCount + (rev === true ? 1 : 0)); $(next).css("zIndex", opts.slideCount + (rev === true ? 0 : 1)); }; $.fn.cycle.custom = function(curr, next, opts, cb, speedOverride) { var $l = $(curr), $n = $(next); var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut; $n.css(opts.cssBefore); if (speedOverride) { if (typeof speedOverride == "number") { speedIn = speedOut = speedOverride; } else { speedIn = speedOut = 1; } easeIn = easeOut = null; } var fn = function() { $n.animate(opts.animIn, speedIn, easeIn, cb); }; $l.animate(opts.animOut, speedOut, easeOut, function() { if (opts.cssAfter) { $l.css(opts.cssAfter); } if (!opts.sync) { fn(); } }); if (opts.sync) { fn(); } }; $.fn.cycle.transitions = { fade: function($cont, $slides, opts) { $slides.not(":eq(" + opts.currSlide + ")").css("opacity", 0); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts); opts.cssBefore.opacity = 0; }); opts.animIn = { opacity: 1 }; opts.animOut = { opacity: 0 }; opts.cssBefore = { top: 0, left: 0 }; } }; $.fn.cycle.ver = function() { return ver; }; $.fn.cycle.defaults = { fx: "fade", timeout: 4000, timeoutFn: null, continuous: 0, speed: 1000, speedIn: null, speedOut: null, next: null, prev: null, prevNextClick: null, pager: null, pagerClick: null, pagerEvent: "click", pagerAnchorBuilder: null, before: null, after: null, end: null, easing: null, easeIn: null, easeOut: null, shuffle: null, animIn: null, animOut: null, cssBefore: null, cssAfter: null, fxFn: null, height: "auto", startingSlide: 0, sync: 1, random: 0, fit: 0, containerResize: 1, pause: 0, pauseOnPagerHover: 0, autostop: 0, autostopCount: 0, delay: 0, slideExpr: null, cleartype: !$.support.opacity, nowrap: 0, fastOnEvent: 0, randomizeEffects: 1, rev: 0, manualTrump: true, requeueOnImageNotLoaded: true, requeueTimeout: 250 }; })(jQuery);
/*
* jQuery Cycle Plugin Transition Definitions
* This script is a plugin for the jQuery Cycle Plugin
* Examples and documentation at: http://malsup.com/jquery/cycle/
* Copyright (c) 2007-2008 M. Alsup
* Version:	 2.52
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
; (function($) { $.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) { $cont.css("overflow", "hidden"); opts.before.push($.fn.cycle.commonReset); var h = $cont.height(); opts.cssBefore = { top: h, left: 0 }; opts.cssFirst = { top: 0 }; opts.animIn = { top: 0 }; opts.animOut = { top: -h }; }; $.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) { $cont.css("overflow", "hidden"); opts.before.push($.fn.cycle.commonReset); var h = $cont.height(); opts.cssFirst = { top: 0 }; opts.cssBefore = { top: -h, left: 0 }; opts.animIn = { top: 0 }; opts.animOut = { top: h }; }; $.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) { $cont.css("overflow", "hidden"); opts.before.push($.fn.cycle.commonReset); var w = $cont.width(); opts.cssFirst = { left: 0 }; opts.cssBefore = { left: w, top: 0 }; opts.animIn = { left: 0 }; opts.animOut = { left: 0 - w }; }; $.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) { $cont.css("overflow", "hidden"); opts.before.push($.fn.cycle.commonReset); var w = $cont.width(); opts.cssFirst = { left: 0 }; opts.cssBefore = { left: -w, top: 0 }; opts.animIn = { left: 0 }; opts.animOut = { left: w }; }; $.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) { $cont.css("overflow", "hidden").width(); opts.before.push(function(curr, next, opts, fwd) { $.fn.cycle.commonReset(curr, next, opts); opts.cssBefore.left = fwd ? (next.cycleW - 1) : (1 - next.cycleW); opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW; }); opts.cssFirst = { left: 0 }; opts.cssBefore = { top: 0 }; opts.animIn = { left: 0 }; opts.animOut = { top: 0 }; }; $.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) { $cont.css("overflow", "hidden"); opts.before.push(function(curr, next, opts, fwd) { $.fn.cycle.commonReset(curr, next, opts); opts.cssBefore.top = fwd ? (1 - next.cycleH) : (next.cycleH - 1); opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH; }); opts.cssFirst = { top: 0 }; opts.cssBefore = { left: 0 }; opts.animIn = { top: 0 }; opts.animOut = { left: 0 }; }; $.fn.cycle.transitions.slideX = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $(opts.elements).not(curr).hide(); $.fn.cycle.commonReset(curr, next, opts, false, true); opts.animIn.width = next.cycleW; }); opts.cssBefore = { left: 0, top: 0, width: 0 }; opts.animIn = { width: "show" }; opts.animOut = { width: 0 }; }; $.fn.cycle.transitions.slideY = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $(opts.elements).not(curr).hide(); $.fn.cycle.commonReset(curr, next, opts, true, false); opts.animIn.height = next.cycleH; }); opts.cssBefore = { left: 0, top: 0, height: 0 }; opts.animIn = { height: "show" }; opts.animOut = { height: 0 }; }; $.fn.cycle.transitions.shuffle = function($cont, $slides, opts) { var w = $cont.css("overflow", "visible").width(); $slides.css({ left: 0, top: 0 }); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, true, true, true); }); opts.speed = opts.speed / 2; opts.random = 0; opts.shuffle = opts.shuffle || { left: -w, top: 15 }; opts.els = []; for (var i = 0; i < $slides.length; i++) { opts.els.push($slides[i]); } for (var i = 0; i < opts.currSlide; i++) { opts.els.push(opts.els.shift()); } opts.fxFn = function(curr, next, opts, cb, fwd) { var $el = fwd ? $(curr) : $(next); $(next).css(opts.cssBefore); var count = opts.slideCount; $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() { var hops = $.fn.cycle.hopsFromLast(opts, fwd); for (var k = 0; k < hops; k++) { fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop()); } if (fwd) { for (var i = 0, len = opts.els.length; i < len; i++) { $(opts.els[i]).css("z-index", len - i + count); } } else { var z = $(curr).css("z-index"); $el.css("z-index", parseInt(z) + 1 + count); } $el.animate({ left: 0, top: 0 }, opts.speedOut, opts.easeOut, function() { $(fwd ? this : curr).hide(); if (cb) { cb(); } }); }); }; opts.cssBefore = { display: "block", opacity: 1, top: 0, left: 0 }; }; $.fn.cycle.transitions.turnUp = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, true, false); opts.cssBefore.top = next.cycleH; opts.animIn.height = next.cycleH; }); opts.cssFirst = { top: 0 }; opts.cssBefore = { left: 0, height: 0 }; opts.animIn = { top: 0 }; opts.animOut = { height: 0 }; }; $.fn.cycle.transitions.turnDown = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, true, false); opts.animIn.height = next.cycleH; opts.animOut.top = curr.cycleH; }); opts.cssFirst = { top: 0 }; opts.cssBefore = { left: 0, top: 0, height: 0 }; opts.animOut = { height: 0 }; }; $.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, false, true); opts.cssBefore.left = next.cycleW; opts.animIn.width = next.cycleW; }); opts.cssBefore = { top: 0, width: 0 }; opts.animIn = { left: 0 }; opts.animOut = { width: 0 }; }; $.fn.cycle.transitions.turnRight = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, false, true); opts.animIn.width = next.cycleW; opts.animOut.left = curr.cycleW; }); opts.cssBefore = { top: 0, left: 0, width: 0 }; opts.animIn = { left: 0 }; opts.animOut = { width: 0 }; }; $.fn.cycle.transitions.zoom = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, false, false, true); opts.cssBefore.top = next.cycleH / 2; opts.cssBefore.left = next.cycleW / 2; opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH }; opts.animOut = { width: 0, height: 0, top: curr.cycleH / 2, left: curr.cycleW / 2 }; }); opts.cssFirst = { top: 0, left: 0 }; opts.cssBefore = { width: 0, height: 0 }; }; $.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, false, false); opts.cssBefore.left = next.cycleW / 2; opts.cssBefore.top = next.cycleH / 2; opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH }; }); opts.cssBefore = { width: 0, height: 0 }; opts.animOut = { opacity: 0 }; }; $.fn.cycle.transitions.blindX = function($cont, $slides, opts) { var w = $cont.css("overflow", "hidden").width(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts); opts.animIn.width = next.cycleW; opts.animOut.left = curr.cycleW; }); opts.cssBefore = { left: w, top: 0 }; opts.animIn = { left: 0 }; opts.animOut = { left: w }; }; $.fn.cycle.transitions.blindY = function($cont, $slides, opts) { var h = $cont.css("overflow", "hidden").height(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts); opts.animIn.height = next.cycleH; opts.animOut.top = curr.cycleH; }); opts.cssBefore = { top: h, left: 0 }; opts.animIn = { top: 0 }; opts.animOut = { top: h }; }; $.fn.cycle.transitions.blindZ = function($cont, $slides, opts) { var h = $cont.css("overflow", "hidden").height(); var w = $cont.width(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts); opts.animIn.height = next.cycleH; opts.animOut.top = curr.cycleH; }); opts.cssBefore = { top: h, left: w }; opts.animIn = { top: 0, left: 0 }; opts.animOut = { top: h, left: w }; }; $.fn.cycle.transitions.growX = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, false, true); opts.cssBefore.left = this.cycleW / 2; opts.animIn = { left: 0, width: this.cycleW }; opts.animOut = { left: 0 }; }); opts.cssBefore = { width: 0, top: 0 }; }; $.fn.cycle.transitions.growY = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, true, false); opts.cssBefore.top = this.cycleH / 2; opts.animIn = { top: 0, height: this.cycleH }; opts.animOut = { top: 0 }; }); opts.cssBefore = { height: 0, left: 0 }; }; $.fn.cycle.transitions.curtainX = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, false, true, true); opts.cssBefore.left = next.cycleW / 2; opts.animIn = { left: 0, width: this.cycleW }; opts.animOut = { left: curr.cycleW / 2, width: 0 }; }); opts.cssBefore = { top: 0, width: 0 }; }; $.fn.cycle.transitions.curtainY = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, true, false, true); opts.cssBefore.top = next.cycleH / 2; opts.animIn = { top: 0, height: next.cycleH }; opts.animOut = { top: curr.cycleH / 2, height: 0 }; }); opts.cssBefore = { left: 0, height: 0 }; }; $.fn.cycle.transitions.cover = function($cont, $slides, opts) { var d = opts.direction || "left"; var w = $cont.css("overflow", "hidden").width(); var h = $cont.height(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts); if (d == "right") { opts.cssBefore.left = -w; } else { if (d == "up") { opts.cssBefore.top = h; } else { if (d == "down") { opts.cssBefore.top = -h; } else { opts.cssBefore.left = w; } } } }); opts.animIn = { left: 0, top: 0 }; opts.animOut = { opacity: 1 }; opts.cssBefore = { top: 0, left: 0 }; }; $.fn.cycle.transitions.uncover = function($cont, $slides, opts) { var d = opts.direction || "left"; var w = $cont.css("overflow", "hidden").width(); var h = $cont.height(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, true, true, true); if (d == "right") { opts.animOut.left = w; } else { if (d == "up") { opts.animOut.top = -h; } else { if (d == "down") { opts.animOut.top = h; } else { opts.animOut.left = -w; } } } }); opts.animIn = { left: 0, top: 0 }; opts.animOut = { opacity: 1 }; opts.cssBefore = { top: 0, left: 0 }; }; $.fn.cycle.transitions.toss = function($cont, $slides, opts) { var w = $cont.css("overflow", "visible").width(); var h = $cont.height(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts, true, true, true); if (!opts.animOut.left && !opts.animOut.top) { opts.animOut = { left: w * 2, top: -h / 2, opacity: 0 }; } else { opts.animOut.opacity = 0; } }); opts.cssBefore = { left: 0, top: 0 }; opts.animIn = { left: 0 }; }; $.fn.cycle.transitions.wipe = function($cont, $slides, opts) { var w = $cont.css("overflow", "hidden").width(); var h = $cont.height(); opts.cssBefore = opts.cssBefore || {}; var clip; if (opts.clip) { if (/l2r/.test(opts.clip)) { clip = "rect(0px 0px " + h + "px 0px)"; } else { if (/r2l/.test(opts.clip)) { clip = "rect(0px " + w + "px " + h + "px " + w + "px)"; } else { if (/t2b/.test(opts.clip)) { clip = "rect(0px " + w + "px 0px 0px)"; } else { if (/b2t/.test(opts.clip)) { clip = "rect(" + h + "px " + w + "px " + h + "px 0px)"; } else { if (/zoom/.test(opts.clip)) { var t = parseInt(h / 2); var l = parseInt(w / 2); clip = "rect(" + t + "px " + l + "px " + t + "px " + l + "px)"; } } } } } } opts.cssBefore.clip = opts.cssBefore.clip || clip || "rect(0px 0px 0px 0px)"; var d = opts.cssBefore.clip.match(/(\d+)/g); var t = parseInt(d[0]), r = parseInt(d[1]), b = parseInt(d[2]), l = parseInt(d[3]); opts.before.push(function(curr, next, opts) { if (curr == next) { return; } var $curr = $(curr), $next = $(next); $.fn.cycle.commonReset(curr, next, opts, true, true, false); opts.cssAfter.display = "block"; var step = 1, count = parseInt((opts.speedIn / 13)) - 1; (function f() { var tt = t ? t - parseInt(step * (t / count)) : 0; var ll = l ? l - parseInt(step * (l / count)) : 0; var bb = b < h ? b + parseInt(step * ((h - b) / count || 1)) : h; var rr = r < w ? r + parseInt(step * ((w - r) / count || 1)) : w; $next.css({ clip: "rect(" + tt + "px " + rr + "px " + bb + "px " + ll + "px)" }); (step++ <= count) ? setTimeout(f, 13) : $curr.css("display", "none"); })(); }); opts.cssBefore = { display: "block", opacity: 1, top: 0, left: 0 }; opts.animIn = { left: 0 }; opts.animOut = { left: 0 }; }; })(jQuery);

// Image Resizer

(function($) {
    $.fn.extend({
        ImageResizer: function(i, Settings) { //ToDo; Applying settings
            return this.each(function() {
                //hide image
                $(this).find("img").hide();

                //set additional properties
                $(this).css("overflow", "hidden");
                $(this).find("img").css("-ms-interpolation-mode", "bicubic");

                //get maximal dimensions
                var MaxHeight = $(this).height();
                var MaxWidth = $(this).width();

                //get image dimensions
                var ImageHeight = $(this).find("img").height();
                var ImageWidth = $(this).find("img").width();

                if (MaxHeight < ImageHeight && MaxWidth < ImageWidth) {
                    //xscale image
                    $(this).find("img").width(MaxWidth);

                    //get new image dimension
                    var NewImageHeight = $(this).find("img").height();

                    if (NewImageHeight < MaxHeight) {
                        //reset image dimension
                        $(this).find("img").width("");

                        //yscale image
                        $(this).find("img").height(MaxHeight);
                    }

                    //get the overflow dimensions
                    var xOverflow = $(this).find("img").width() - MaxWidth;
                    var yOverflow = $(this).find("img").height() - MaxHeight;

                    //center image
                    $(this).find("img").css("margin-left", -xOverflow / 2);
                    $(this).find("img").css("margin-top", -yOverflow / 2);

                    NewImageHeight = $(this).find("img").height();
                    NewImageWidth = $(this).find("img").width();
                }
                else {
                    //get the overflow dimensions
                    var xVoid = (MaxWidth - ImageWidth) / 2;
                    var yVoid = (MaxHeight - ImageHeight) / 2;

                    //center image
                    $(this).find("img").css("margin-left", xVoid);
                    $(this).find("img").css("margin-top", yVoid);
                }

                //check if images are loaded
                if (ImageHeight == 0 || ImageWidth == 0) {
                    $(this).ImageResizer(i, Settings);
                }

                //show image
                $(this).find("img").show();
            });
        }
    });
})(jQuery);

// Image Tooltip

(function($) {
    $.fn.extend({
        ImageTooltip: function(Settings) { //ToDo; Applying settings
            return this.each(function() {

                $(this).find(".Picture").hide();

                $(this).hover(function() {
                    $(this).children(".Picture").fadeIn(500);
                });

                $(this).mouseout(function() {
                    $(this).children(".Picture").fadeOut(100);
                });
            });
        }
    });
})(jQuery);

// Suckerfish

/* - css - /
    
ul
{
position:relative;
list-style:none;
margin:0; 
padding:0;
height:26px; 
}
    
ul li
{
float:left; 
height:26px;
}
    
ul li a
{
display:inline-block; <-- VERY IMPORTANT 
line-height:26px;
}
    
/ - predecending level - /
    
ul li ul
{
display:none;
position:absolute;
top:26px;
clear:left;
}

ul li ul li
{
position:relative;
float:none;
}
    
ul li ul li ul
{
display:none;
position:absolute;
top:0;
}

    
    
<---------------------*/

(function($) {
    $.fn.extend({
        Suckerfish: function(Settings) { //ToDo; Applying settings
            return this.each(function() {                
                $(this).find("li").hover(function() {
                    $(this).children("ul").show();
                }, function() {
                    $(this).children("ul").hide();
                })
            });
        }
    });
})(jQuery);

// Thickbox

/*
* Thickbox 3.1 - One Box To Rule Them All.
* By Cody Lindley (http://www.codylindley.com)
* Copyright (c) 2007 cody lindley
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

var tb_pathToImage = "_images/loading.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
$(document).ready(function() {
    tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox
    imgLoader = new Image(); // preload image
    imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk) {
    $(domChunk).click(function() {
        var t = this.title || this.name || null;
        var a = this.href || this.alt;
        var g = this.rel || false;
        tb_show(t, a, g);
        this.blur();
        return false;
    });
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

    try {
        if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
            $("body", "html").css({ height: "100%", width: "100%" });
            $("html").css("overflow", "hidden");
            if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
                $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
                //$("#TB_overlay").click(tb_remove);
            }
        } else {//all others
            if (document.getElementById("TB_overlay") === null) {
                $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
                //$("#TB_overlay").click(tb_remove);
            }
        }

        if (tb_detectMacXFF()) {
            $("#TB_overlay").addClass("TB_overlayMacFFBGHack"); //use png overlay so hide flash
        } else {
            $("#TB_overlay").addClass("TB_overlayBG"); //use background and opacity
        }

        if (caption === null) { caption = ""; }
        //$("body").append("<div id='TB_load'><img src='" + imgLoader.src + "' /></div>"); //add loader to the page
        //$('#TB_load').show(); //show loader

        var baseURL;
        if (url.indexOf("?") !== -1) { //ff there is a query string involved
            baseURL = url.substr(0, url.indexOf("?"));
        } else {
            baseURL = url;
        }

        var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
        var urlType = baseURL.toLowerCase().match(urlString);

        if (urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp') {//code to show images

            TB_PrevCaption = "";
            TB_PrevURL = "";
            TB_PrevHTML = "";
            TB_NextCaption = "";
            TB_NextURL = "";
            TB_NextHTML = "";
            TB_imageCount = "";
            TB_FoundURL = false;
            if (imageGroup) {
                TB_TempArray = $("a[@rel=" + imageGroup + "]").get();
                for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
                    var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
                    if (!(TB_TempArray[TB_Counter].href == url)) {
                        if (TB_FoundURL) {
                            TB_NextCaption = TB_TempArray[TB_Counter].title;
                            TB_NextURL = TB_TempArray[TB_Counter].href;
                            TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
                        } else {
                            TB_PrevCaption = TB_TempArray[TB_Counter].title;
                            TB_PrevURL = TB_TempArray[TB_Counter].href;
                            TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
                        }
                    } else {
                        TB_FoundURL = true;
                        TB_imageCount = "Image " + (TB_Counter + 1) + " of " + (TB_TempArray.length);
                    }
                }
            }

            imgPreloader = new Image();
            imgPreloader.onload = function() {
                imgPreloader.onload = null;

                // Resizing large images - orginal by Christian Montoya edited by me.
                var pagesize = tb_getPageSize();
                var x = pagesize[0] - 150;
                var y = pagesize[1] - 150;
                var imageWidth = imgPreloader.width;
                var imageHeight = imgPreloader.height;
                if (imageWidth > x) {
                    imageHeight = imageHeight * (x / imageWidth);
                    imageWidth = x;
                    if (imageHeight > y) {
                        imageWidth = imageWidth * (y / imageHeight);
                        imageHeight = y;
                    }
                } else if (imageHeight > y) {
                    imageWidth = imageWidth * (y / imageHeight);
                    imageHeight = y;
                    if (imageWidth > x) {
                        imageHeight = imageHeight * (x / imageWidth);
                        imageWidth = x;
                    }
                }
                // End Resizing

                TB_WIDTH = imageWidth + 30;
                TB_HEIGHT = imageHeight + 60;
                $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='" + url + "' width='" + imageWidth + "' height='" + imageHeight + "' alt='" + caption + "'/></a>" + "<div id='TB_caption'>" + caption + "<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>sluiten</a></div>");

                $("#TB_closeWindowButton").click(tb_remove);

                if (!(TB_PrevHTML === "")) {
                    function goPrev() {
                        if ($(document).unbind("click", goPrev)) { $(document).unbind("click", goPrev); }
                        $("#TB_window").remove();
                        $("body").append("<div id='TB_window'></div>");
                        tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
                        return false;
                    }
                    $("#TB_prev").click(goPrev);
                }

                if (!(TB_NextHTML === "")) {
                    function goNext() {
                        $("#TB_window").remove();
                        $("body").append("<div id='TB_window'></div>");
                        tb_show(TB_NextCaption, TB_NextURL, imageGroup);
                        return false;
                    }
                    $("#TB_next").click(goNext);

                }

                document.onkeydown = function(e) {
                    if (e == null) { // ie
                        keycode = event.keyCode;
                    } else { // mozilla
                        keycode = e.which;
                    }
                    if (keycode == 27) { // close
                        tb_remove();
                    } else if (keycode == 190) { // display previous image
                        if (!(TB_NextHTML == "")) {
                            document.onkeydown = "";
                            goNext();
                        }
                    } else if (keycode == 188) { // display next image
                        if (!(TB_PrevHTML == "")) {
                            document.onkeydown = "";
                            goPrev();
                        }
                    }
                };

                tb_position();
                $("#TB_load").remove();
                $("#TB_ImageOff").click(tb_remove);
                $("#TB_window").css({ display: "block" }); //for safari using css instead of show
            };

            imgPreloader.src = url;
        } else {//code to show html

            var queryString = url.replace(/^[^\?]+\??/, '');
            var params = tb_parseQuery(queryString);

            TB_WIDTH = (params['width'] * 1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
            TB_HEIGHT = (params['height'] * 1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
            ajaxContentW = TB_WIDTH - 30;
            ajaxContentH = TB_HEIGHT - 45;

            if (url.indexOf('TB_iframe') != -1) {// either iframe or ajax window		
                urlNoQuery = url.split('TB_');
                $("#TB_iframeContent").remove();
                if (params['modal'] != "true") {//iframe no modal
                    $("#TB_window").append("<div id='TB_title'><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>sluiten</a></div></div><iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;' > </iframe>");
                } else {//iframe modal
                    $("#TB_overlay").unbind();
                    $("#TB_window").append("<iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;'> </iframe>");
                }
            } else {// not an iframe, ajax
                if ($("#TB_window").css("display") != "block") {
                    if (params['modal'] != "true") {//ajax no modal
                        $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + caption + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>sluiten</a></div></div><div id='TB_ajaxContent' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px'></div>");
                    } else {//ajax modal
                        $("#TB_overlay").unbind();
                        $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px;'></div>");
                    }
                } else {//this means the window is already up, we are just loading new content via ajax
                    $("#TB_ajaxContent")[0].style.width = ajaxContentW + "px";
                    $("#TB_ajaxContent")[0].style.height = ajaxContentH + "px";
                    $("#TB_ajaxContent")[0].scrollTop = 0;
                    $("#TB_ajaxWindowTitle").html(caption);
                }
            }

            $("#TB_closeWindowButton").click(tb_remove);

            if (url.indexOf('TB_inline') != -1) {
                $("#TB_ajaxContent").append($('#' + params['inlineId']).children());
                $("#TB_window").unload(function() {
                    $('#' + params['inlineId']).append($("#TB_ajaxContent").children()); // move elements back when you're finished
                });
                tb_position();
                $("#TB_load").remove();
                $("#TB_window").css({ display: "block" });
            } else if (url.indexOf('TB_iframe') != -1) {
                tb_position();
                if ($.browser.safari) {//safari needs help because it will not fire iframe onload
                    $("#TB_load").remove();
                    $("#TB_window").css({ display: "block" });
                }
            } else {
                $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()), function() {//to do a post change this load method
                    tb_position();
                    $("#TB_load").remove();
                    tb_init("#TB_ajaxContent a.thickbox");
                    $("#TB_window").css({ display: "block" });
                });
            }

        }

        if (!params['modal']) {
            document.onkeyup = function(e) {
                if (e == null) { // ie
                    keycode = event.keyCode;
                } else { // mozilla
                    keycode = e.which;
                }
                if (keycode == 27) { // close
                    tb_remove();
                }
            };
        }

    } catch (e) {
        //nothing here
    }
}

//helper functions below
function tb_showIframe() {
    $("#TB_load").remove();
    $("#TB_window").css({ display: "block" });
}

function tb_remove() {
    $("#TB_imageOff").unbind("click");
    $("#TB_closeWindowButton").unbind("click");
    $("#TB_window").fadeOut("fast", function() { $('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove(); });
    $("#TB_load").remove();
    if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
        $("body", "html").css({ height: "auto", width: "auto" });
        $("html").css("overflow", "");
    }
    document.onkeydown = "";
    document.onkeyup = "";

    return false;
}

function shopfurther() {
    var loc = parent.window.location;
    parent.window.location = loc;
}

function tb_position() {
    $("#TB_window").css({ marginLeft: '-' + parseInt((TB_WIDTH / 2), 10) + 'px', width: TB_WIDTH + 'px' });
    if (!(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
        $("#TB_window").css({ marginTop: '-' + parseInt((TB_HEIGHT / 2), 10) + 'px' });
    }
}

function tb_parseQuery(query) {
    var Params = {};
    if (!query) { return Params; } // return empty object
    var Pairs = query.split(/[;&]/);
    for (var i = 0; i < Pairs.length; i++) {
        var KeyVal = Pairs[i].split('=');
        if (!KeyVal || KeyVal.length != 2) { continue; }
        var key = unescape(KeyVal[0]);
        var val = unescape(KeyVal[1]);
        val = val.replace(/\+/g, ' ');
        Params[key] = val;
    }
    return Params;
}

function tb_getPageSize() {
    var de = document.documentElement;
    var w = window.innerWidth || self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
    var h = window.innerHeight || self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
    arrayPageSize = [w, h];
    return arrayPageSize;
}

function tb_detectMacXFF() {
    var userAgent = navigator.userAgent.toLowerCase();
    if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox') != -1) {
        return true;
    }
}

// jquery.innerfade.js

// Datum: 2008-02-14
// Firma: Medienfreunde Hofmann & Baldes GbR
// Author: Torsten Baldes
// Mail: t.baldes@medienfreunde.com
// Web: http://medienfreunde.com

// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/
// and Ralf S. Engelschall http://trainofthoughts.org/

// *
// *  <ul id="news"> 
// *      <li>content 1</li>
// *      <li>content 2</li>
// *      <li>content 3</li>
// *  </ul>
// *  
// *  $('#news').innerfade({ 
// *	  animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'), 
// *	  speed: Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 
// *	  timeout: Time between the fades in milliseconds (Default: '2000'), 
// *	  type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: 'sequence'), 
// * 		containerheight: Height of the containing element in any css-height-value (Default: 'auto'),
// *	  runningclass: CSS-Class which the container get�s applied (Default: 'innerfade'),
// *	  children: optional children selector (Default: null)
// *  }); 
// *

// ========================================================= */


(function($) {

    $.fn.innerfade = function(options) {
        return this.each(function() {
            $.innerfade(this, options);
        });
    };

    $.innerfade = function(container, options) {
        var settings = {
            'animationtype': 'fade',
            'speed': 'normal',
            'type': 'sequence',
            'timeout': 2000,
            'containerheight': 'auto',
            'runningclass': 'innerfade',
            'children': null
        };
        if (options)
            $.extend(settings, options);
        if (settings.children === null)
            var elements = $(container).children();
        else
            var elements = $(container).children(settings.children);
        if (elements.length > 1) {
            $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
            for (var i = 0; i < elements.length; i++) {
                $(elements[i]).css('z-index', String(elements.length - i)).css('position', 'absolute').hide();
            };
            if (settings.type == "sequence") {
                setTimeout(function() {
                    $.innerfade.next(elements, settings, 1, 0);
                }, settings.timeout);
                $(elements[0]).show();
            } else if (settings.type == "random") {
                var last = Math.floor(Math.random() * (elements.length));
                setTimeout(function() {
                    do {
                        current = Math.floor(Math.random() * (elements.length));
                    } while (last == current);
                    $.innerfade.next(elements, settings, current, last);
                }, settings.timeout);
                $(elements[last]).show();
            } else if (settings.type == 'random_start') {
                settings.type = 'sequence';
                var current = Math.floor(Math.random() * (elements.length));
                setTimeout(function() {
                    $.innerfade.next(elements, settings, (current + 1) % elements.length, current);
                }, settings.timeout);
                $(elements[current]).show();
            } else {
                alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
            }
        }
    };

    $.innerfade.next = function(elements, settings, current, last) {
        if (settings.animationtype == 'slide') {
            $(elements[last]).slideUp(settings.speed);
            $(elements[current]).slideDown(settings.speed);
        } else if (settings.animationtype == 'fade') {
            $(elements[last]).fadeOut(settings.speed);
            $(elements[current]).fadeIn(settings.speed, function() {
                removeFilter($(this)[0]);
            });
        } else
            alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
        if (settings.type == "sequence") {
            if ((current + 1) < elements.length) {
                current = current + 1;
                last = current - 1;
            } else {
                current = 0;
                last = elements.length - 1;
            }
        } else if (settings.type == "random") {
            last = current;
            while (current == last)
                current = Math.floor(Math.random() * elements.length);
        } else
            alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
        setTimeout((function() {
            $.innerfade.next(elements, settings, current, last);
        }), settings.timeout);
    };

})(jQuery);

// **** remove Opacity-Filter in ie ****
function removeFilter(element) {
    if (element.style.removeAttribute) {
        element.style.removeAttribute('filter');
    }
}

// Tooltip

(function($) {
    $.fn.extend({
        Tooltip: function(Settings) {
            return this.each(function() {

                $(this).css("cursor", "pointer");

                $(this).hover(function() {

                    // Remove the tip if present
                    if ($(this).find(".Balloon")) {
                        $(this).find(".Balloon").remove();
                    }

                    // Build te tip
                    var Tip = "<div class='Balloon'>";
                    Tip += "<div class='Top'></div>";
                    Tip += "<div class='MainArea'>";
                    Tip += "<div class='LeftSide'></div>";
                    Tip += "<div class='" + Settings.Wrapper + "'>";
                    Tip += $(this).attr("title");
                    Tip += "<a href='" + $(this).attr("href") + "' title='" + $(this).attr("href") + "'>" + Settings.LinkText + "</a>";
                    Tip += "</div>";
                    Tip += "<div class='RightSide'></div>";
                    Tip += "</div>";
                    Tip += "<div class='Bottom'></div>";
                    Tip += "</div>";

                    // Append to element
                    $(this).append(Tip);

                    // Reset/set some css properties
                    $(this).find("." + Settings.Wrapper).css("line-height", Settings.LineHeight + "px");
                    $(this).css("z-index", "9999");

                    // Push up tip 
                    var Height = $(this).find(".TipText").height();

                    $(this).find(".LeftSide").height(Height);
                    $(this).find(".RightSide").height(Height);

                    var TopMargin = $(this).find(".Balloon").css("top").replace("px", "");
                    $(this).find(".Balloon").css("top", parseInt(TopMargin) - Height);

                    // Show tip												
                    $(this).pngFix();
                    if ($.browser.msie) {
                        $(this).find(".Balloon").show();
                    }
                    else {
                        $(this).find(".Balloon").hide().fadeIn(Settings.Speed);
                    }

                }, function() {
                    // Hide tip
                    if ($.browser.msie) {
                        $(this).find(".Balloon").hide();
                    }
                    else {
                        $(this).find(".Balloon").fadeOut(Settings.Speed);
                    }
                });
            });
        }
    });
})(jQuery);

// Ajax form

/*
* Plugin: Ajax form (v1.0)
* Author: Rik Verbeek
* Last change date: 18/09/2009 
*/

(function($) {
    $.fn.extend({
        AjaxForm: function(Settings) { //ToDo; Applying settings
            return this.each(function() {
                // Get settings
                var FormTitle = $(this).attr("title");
                var FormAction = Settings.Action;
                var MailTo = Settings.To;
                var MailFrom = Settings.From;
                var Message = Settings.Message;
                var FalseFromHEX = Settings.FalseFromHEX;
                var FalseToHEX = Settings.FalseToHEX;
                var TrueHEX = Settings.TrueHEX;
                var ConversionID = Settings.ConversionID;
                var ConversionLabel = Settings.ConversionLabel;
                var FalseText = Settings.FalseText;

                // Set Google conversion stuff
                var google_conversion_id = ConversionID;
                var google_conversion_language = "nl";
                var google_conversion_format = "3";
                var google_conversion_color = "ffffff";
                var google_conversion_label = ConversionLabel;

                // Set some vars
                var Form = $(this);
                var Html = Form.html();
                var Objects = new Array();
                var i = 0;
                var UserEmail;

                // Create the loading animation
                var Load = "<div class='AjaxLoader'>";
                Load += "<div class='LoaderImage'></div>";
                Load += "</div>";

                $(Form).children().find(":input", ":select", ":textarea").each(function() {
                    $(this).click(function() {
                        if ($(this).val() == FalseText) {
                            $(this).val("");
                        }
                    });
                });

                $(this).find(".Button, .FormButton").click(function() {
                    // Initialisize some vars
                    var Valid = true;
                    var NameAttr = new Array();

                    // Loop trough elements
                    $(Form).children().find(":input", ":select", ":textarea").each(function() {

                        // Check if the element with this name is already processed
                        if ($.inArray($(this).attr("name"), NameAttr) < 0) {
                            // Get values according to type
                            switch ($(this).attr("type")) {
                                case "radio":
                                    {
                                        var Value = $("input:radio[name=" + $(this).attr("name") + "]:checked").val();
                                        break;
                                    }
                                case "checkbox":
                                    {
                                        var Value = $("input:checkbox[name=" + $(this).attr("name") + "]:checked").val();
                                        break;
                                    }
                                case "text":
                                    {
                                        var Value = $(this).val();
                                        break;
                                    }
                            }

                            // Get values according to element
                            if ($(this).is("select:")) {
                                var Value = $("select:[name=" + $(this).attr("name") + "]option:selected").val();
                            }

                            if ($(this).is("textarea:")) {
                                var Value = $(this).val();
                            }

                            // Check if element is required (class="Required")
                            if ($(this).is(".Required")) {
                                if (!Value || Value == FalseText) {
                                    Valid = false;
                                }

                                // Phone specific validation
                                if ($(this).is(".Phone")) {
                                    Valid = false;
                                    if ($(this).val().length > 9 && $(this).val().length < 15) {
                                        var Regex = new RegExp(/^[0-9]+$/);
                                        if (Regex.exec(Value) != null) {
                                            Valid = true;
                                        }
                                    }
                                }

                                // Email specific validation
                                if ($(this).is(".Email")) {
                                    var Regex = new RegExp(/\w+@[a-zA-Z0-9_]+?\.[a-zA-Z]/);
                                    if (Regex.exec(Value) == null) {
                                        Valid = false;
                                    }
                                    UserEmail = $(this).val();
                                }

                                // Visualize if entry is not valid
                                if (!Valid) {
                                    switch ($(this).attr("type")) {
                                        default:
                                            {
                                                $(this).animate({ backgroundColor: FalseFromHEX }, 200).animate({ backgroundColor: FalseToHEX }, 300).css("color", "#fff");
                                                $(this).val(FalseText);
                                                break;
                                            }
                                        case "radio":
                                        case "checkbox":
                                            {
                                                break;
                                            }
                                    }
                                    return false;
                                }
                            }

                            // Visualize if entry is valid
                            switch ($(this).attr("type")) {
                                default:
                                    {
                                        $(this).animate({ backgroundColor: TrueHEX }, 1000).animate({ backgroundColor: "#ffffff" }, 300).css("color", "#000");
                                        break;
                                    }
                                case "radio":
                                case "checkbox":
                                    {
                                        break;
                                    }
                            }

                            // Build label + value pair                            
                            Object = $(this).attr("title") + ": " + Value;

                            // Add the name attribute to the NameAttr array                       
                            NameAttr[i] = $(this).attr("name");

                            // Add pair to the Objects array
                            if ($.inArray(Object, Objects) < 0) {
                                Objects[i] = Object;
                                i++;
                            }
                        }
                    })

                    if (Valid) {
                        // Hide form and build loading animation			            
                        Form.find("*").hide();
                        Form.append(Load);

                        // Clear form    
                        $(Form).find(":input", ":select", ":textarea").each(function() {
                            var Type = $(this).attr("type");
                            switch (Type) {
                                default:
                                case "text":
                                    {
                                        $(this).val("");
                                        break;
                                    }
                                case "radio":
                                case "checkbox":
                                    {
                                        this.checked = false;
                                        break;
                                    }
                            }
                        })

                        // Send Ajax request
                        $(".Loader").load("/Ajax/FormControl.aspx", { action: FormAction, from: UserEmail, to: MailTo, UserEmail: UserEmail, title: FormTitle, "objects[]": [Objects] }, function() {
                            // Delete loading animation and show form
                            $(".AjaxLoader").fadeOut(600, function() {

                                var LoaderBody = "<p>" + Message + "</p>";
                                //LoaderBody += "<script type='text/javascript' src='http://www.googleadservices.com/pagead/conversion.js'></script>";
                                //LoaderBody += "<noscript><div style='display:inline;'><img height='1' width='1' style='border-style:none;' alt='' src='http://www.googleadservices.com/pagead/conversion/1071358137/?label=" + ConversionLabel + "&amp;guid=ON&amp;script=0' /></div></noscript>";

                                $(this).html(LoaderBody);
                                $(this).fadeIn(100);

                                var Loader = $(this);

                                window.setTimeout(function() {
                                    $(Loader).remove();

                                    $(Form).find("*:not(.Balloon, #__VIEWSTATE)").fadeIn(200);
                                }, 7000);
                            });
                        });
                    }
                });
            });
        }
    });
})(jQuery);

// Color animations

/*
* jQuery Color Animations
* Copyright 2007 John Resig
* Released under the MIT and GPL licenses.
*/

(function(jQuery) {

    // We override the animation for all of these color styles
    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i, attr) {
        jQuery.fx.step[attr] = function(fx) {
            if (fx.state == 0) {
                fx.start = getColor(fx.elem, attr);
                fx.end = getRGB(fx.end);
            }

            fx.elem.style[attr] = "rgb(" + [
				Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
				Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
				Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
			].join(",") + ")";
        }
    });

    // Color Conversion functions from highlightFade
    // By Blair Mitchelmore
    // http://jquery.offput.ca/highlightFade/

    // Parse strings looking for color tuples [255,255,255]
    function getRGB(color) {
        var result;

        // Check if we're already dealing with an array of colors
        if (color && color.constructor == Array && color.length == 3)
            return color;

        // Look for rgb(num,num,num)
        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

        // Look for rgb(num%,num%,num%)
        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
            return [parseFloat(result[1]) * 2.55, parseFloat(result[2]) * 2.55, parseFloat(result[3]) * 2.55];

        // Look for #a0b1c2
        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
            return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)];

        // Look for #fff
        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
            return [parseInt(result[1] + result[1], 16), parseInt(result[2] + result[2], 16), parseInt(result[3] + result[3], 16)];

        // Otherwise, we're most likely dealing with a named color
        return colors[jQuery.trim(color).toLowerCase()];
    }

    function getColor(elem, attr) {
        var color;

        do {
            color = jQuery.curCSS(elem, attr);

            // Keep going until we find an element that has color, or we hit the body
            if (color != '' && color != 'transparent' || jQuery.nodeName(elem, "body"))
                break;

            attr = "backgroundColor";
        } while (elem = elem.parentNode);

        return getRGB(color);
    };

    // Some named colors to work with
    // From Interface by Stefan Petre
    // http://interface.eyecon.ro/

    var colors = {
        aqua: [0, 255, 255],
        azure: [240, 255, 255],
        beige: [245, 245, 220],
        black: [0, 0, 0],
        blue: [0, 0, 255],
        brown: [165, 42, 42],
        cyan: [0, 255, 255],
        darkblue: [0, 0, 139],
        darkcyan: [0, 139, 139],
        darkgrey: [169, 169, 169],
        darkgreen: [0, 100, 0],
        darkkhaki: [189, 183, 107],
        darkmagenta: [139, 0, 139],
        darkolivegreen: [85, 107, 47],
        darkorange: [255, 140, 0],
        darkorchid: [153, 50, 204],
        darkred: [139, 0, 0],
        darksalmon: [233, 150, 122],
        darkviolet: [148, 0, 211],
        fuchsia: [255, 0, 255],
        gold: [255, 215, 0],
        green: [0, 128, 0],
        indigo: [75, 0, 130],
        khaki: [240, 230, 140],
        lightblue: [173, 216, 230],
        lightcyan: [224, 255, 255],
        lightgreen: [144, 238, 144],
        lightgrey: [211, 211, 211],
        lightpink: [255, 182, 193],
        lightyellow: [255, 255, 224],
        lime: [0, 255, 0],
        magenta: [255, 0, 255],
        maroon: [128, 0, 0],
        navy: [0, 0, 128],
        olive: [128, 128, 0],
        orange: [255, 165, 0],
        pink: [255, 192, 203],
        purple: [128, 0, 128],
        violet: [128, 0, 128],
        red: [255, 0, 0],
        silver: [192, 192, 192],
        white: [255, 255, 255],
        yellow: [255, 255, 0]
    };

})(jQuery);

//accordion

(function($) {
    $.fn.extend({
        Accordion: function(Settings) { //ToDo; Applying settings
            return this.each(function() {
                $(this).find("ul").children("li").each(function() {
                    $(this).find("a").hover(function() {
                        $(this).stop();
                        $(this).animate({ width: "150px" }, 700);
                    },
                    function() {
                        $(this).stop();
                        $(this).animate({ width: "110px" }, 700);
                    })
                })
                $(this).mouseout(function() {
                    $(this).stop();
                    $(this).find("ul").children("li").each(function() {
                        $(this).find("a").animate({ width: "105px" }, 200);
                    })
                })
            });
        }
    });
})(jQuery);

//Ajax slideshow

(function($) {
    $.fn.extend({
        AjaxSlideshow: function(Settings) { //ToDo; Applying settings
            return this.each(function() {

                var Preloader = "<img class='PreLoader' src='/_images/Preloaders/slideshow.gif' alt='Loading...' />";

                var Loader = "<div class='AjaxSlides'>";
                Loader += Preloader;
                Loader += "</div>";

                $(this).append(Loader);

                $(".AjaxSlides").load("/AjaxEngine.aspx", { action: "Slideshow", direction: "stay" }, function() {
                });

                //on right click
                $(this).find(".Right").click(function() {
                    $(".AjaxSlides").html(Preloader);
                    $(".AjaxSlides").load("/AjaxEngine.aspx", { action: "Slideshow", direction: "next" }, function() {
                        $(this).find("img").hide().fadeIn(400);
                    });
                })

                //on left click
                $(this).find(".Left").click(function() {
                    $(".AjaxSlides").html(Preloader);
                    $(".AjaxSlides").load("/AjaxEngine.aspx", { action: "Slideshow", direction: "prev" }, function() {
                        $(this).find("img").hide().fadeIn(400);
                    });
                })
            });
        }
    });
})(jQuery);

//gallery

(function($) {
    $.fn.extend({
        Gallery: function(settings) { //ToDo; Applying settings
            return this.each(function() {
                var loadingdiv = settings.Loader;

                $(this).find("img").each(function() {
                    $(this).click(function() {
                        $(loadingdiv).find("img").attr({
                            src: $(this).attr("src")
                        })

                        //prepare and show
                        $(loadingdiv).find("img").hide().fadeIn(1000);
                    });
                });
            });
        }
    });
})(jQuery);

//shoppingcart

(function($) {
    $.fn.extend({
        ShoppingCart: function(Settings) { //ToDo; Applying settings                        
            return this.each(function() {
                var parent = $(this);
                var loader = "<div class='Animation'></div>";
                var errormessage = "verplicht veld";
                var notsamepasswordmessage = "de wachtwoorden komen niet overeen";
                var nosamepassworddiv = "<div class='ErrorNoSamePassword'>de wachtwoorden dienen overeen te komen</div>";

                //add shippingcosts
                //$(parent).find("select[name=shipmentmethod]").live("change", function() {
                //    var method = $(parent).find("select[name=shipmentmethod]").attr("value");
                //    
                //    $(parent).append(loader);
                //    $(parent).load("/Ajax/ShoppingCartControls.aspx", { action: "updatelist", update: "addshipping", method: method });
                //});
                $(parent).find(".SelectShipment").live("click", function() {
                    var method = $(parent).find("select[name=shipmentmethod]").attr("value");

                    $(parent).append(loader);
                    $(parent).load("/Ajax/ShoppingCartControls.aspx", { action: "updatelist", update: "addshipping", method: method });
                });

                //add item
                $(parent).find(".PlusAmount").live("click", function() {
                    var itemid = $(this).attr("id");
                    var shipmethod = $(parent).find("select[name=shipmentmethod]").attr("value");

                    $(parent).append(loader);
                    $(parent).load("/Ajax/ShoppingCartControls.aspx", { action: "updatelist", update: "amount", direction: "plus", "id": itemid, method: shipmethod });
                });

                //substract item
                $(parent).find(".MinusAmount").live("click", function() {
                    var itemid = $(this).attr("id");
                    var shipmethod = $(parent).find("select[name=shipmentmethod]").attr("value");

                    $(parent).append(loader);
                    $(parent).load("/Ajax/ShoppingCartControls.aspx", { action: "updatelist", update: "amount", direction: "minus", "id": itemid, method: shipmethod });
                });

                //delete item
                $(parent).find(".DelOrderItem").live("click", function() {
                    var itemid = $(this).attr("id");
                    var shipmethod = $(parent).find("select[name=shipmentmethod]").attr("value");

                    if (confirm("Weet u zeker dat u dit artikel wilt verwijderen?")) {
                        $(parent).append(loader);
                        $(parent).load("/Ajax/ShoppingCartControls.aspx", { action: "updatelist", update: "delete", "id": itemid, method: shipmethod });
                    }
                });

                //login / signup
                $(parent).find("input").live("click", function() {
                    if ($(this).val() == errormessage) {
                        $(this).val("");
                    }
                });

                $(parent).find(".Login").live("click", function() {
                    var valid = true;

                    $(parent).find("input").each(function() {
                        if ($(this).val() == "" || $(this).val() == errormessage) {
                            $(this).animate({ backgroundColor: "#cb0b0b" }, 300).animate({ backgroundColor: "#ffffff" }, 300, function() {
                                $(this).val(errormessage);
                            });

                            valid = false;
                        }
                    });

                    if (valid) {
                        var email = $(parent).find("input[name=email]").val();
                        var password = $(parent).find("input[name=password]").val();

                        $(parent).append(loader);
                        $(parent).load("/Ajax/ShoppingCartControls.aspx", { action: "login", email: email, password: password });
                    }
                });

                //signup
                $(parent).find(".SignUp").live("click", function() {
                    var valid = true;
                    var password = $(parent).find("input[name=password]").val();
                    var samepassword = $(parent).find("input[name=samepassword]").val();

                    $(parent).find("input").each(function() {
                        //general validation
                        if ($(this).val() == "" || $(this).val() == errormessage) {
                            valid = false;
                        }

                        //validate email
                        if ($(this).attr("name") == "email") {
                            var regex = new RegExp(/\w+@[a-zA-Z0-9_]+?\.[a-zA-Z]/);
                            if (regex.exec($(this).val()) == null) {
                                valid = false;
                            }
                        }

                        //same passwords?
                        if ($(this).attr("name") == "password") {
                            if (password != samepassword) {
                                $(parent).append(nosamepassworddiv);

                                valid = false;
                            }
                        }

                        if (!valid) {
                            $(this).animate({ backgroundColor: "#cb0b0b" }, 300).animate({ backgroundColor: "#ffffff" }, 300, function() {
                                $(this).val(errormessage);
                            });
                        }
                    });

                    if (valid) {
                        var objects;

                        //serialize
                        objects = $(parent).find("input").serialize();

                        $(parent).append(loader);
                        $(parent).load("/Ajax/ShoppingCartControls.aspx?" + objects, { action: "signup" });
                    }
                });

                //edit addresses
                $(parent).find(".EditAddressButton").live("click", function() {
                    $(parent).append(loader);
                    $(parent).load("/Ajax/ShoppingCartControls.aspx", { action: "editaddress" });
                });

                //handle sameaddress button
                $(parent).find("input[name=samedelivery]").live("click", function() {
                    var street = $(parent).find("input[name=street]").val();
                    var housenumber = $(parent).find("input[name=housenumber]").val();
                    var zip = $(parent).find("input[name=zip]").val();
                    var city = $(parent).find("input[name=city]").val();

                    if ($(this).is(":checked")) {
                        $(parent).find("input[name=delstreet]").val(street);
                        $(parent).find("input[name=delhousenumber]").val(housenumber);
                        $(parent).find("input[name=delzip]").val(zip);
                        $(parent).find("input[name=delcity]").val(city);
                    }
                    else {
                        $(parent).find("input[name=delstreet]").val("");
                        $(parent).find("input[name=delhousenumber]").val("");
                        $(parent).find("input[name=delzip]").val("");
                        $(parent).find("input[name=delcity]").val("");
                    }
                });

                $(parent).find(".SaveAddressButton").live("click", function() {
                    var objects;
                    var valid = true;

                    //check values
                    $(parent).find("input").each(function() {
                        if ($(this).val() == "" || $(this).val() == errormessage) {
                            $(this).animate({ backgroundColor: "#cb0b0b" }, 300).animate({ backgroundColor: "#ffffff" }, 300, function() {
                                $(this).val(errormessage);
                            });

                            valid = false;
                        }
                    });

                    if (valid) {
                        //serialize
                        objects = $(parent).find("input").serialize();
                        //alert(objects);

                        $(parent).append(loader);
                        $(parent).load("/Ajax/ShoppingCartControls.aspx?" + objects, { action: "saveaddress" });
                    }
                });

                //finalisation
                $(parent).find(".OrderFinalize").live("click", function() {
                    var paymethod = $(parent).find("select[name=paymethod]").val();

                    $(parent).append(loader);
                    $(parent).load("/Ajax/ShoppingCartControls.aspx", { action: "orderfinalize", gateway: paymethod });
                    $(parent).append(loader);
                });
            });
        }
    });
})(jQuery);

//Google maps

/**
* jquery.googlemap v1.0.0
*
* Copyright David Hong 2009
* http://davidhong.id.au/jquery/google/maps/
*
* Simplified Google Maps API integrated into jQuery
*
* Launched: <TBA>
* Version: v1.0.0 (27/02/2009 15:59 AEDST)
* 
* SIMPLE USAGE:
* 
* $("google-map-canvas").googlemap({
*     controls: false,
*     labels: true,
*     addresses: [
*         "1 ABC St, NSW Australia",
*         "2 XYZ St, NSW Australia"
*     ]
* });

Some remarks:
    
- for custom markers search for 'createMarker'
- doesn't work without an element id
- for maptype search fo 'setMapType'

* 
**/

(function($) {

    // fireEvent(opts, fn, self, arg)
    //     opts:    (json) jQuery options for this plugin
    //     fn:      (function) function to run
    //     self:    (object) this
    //     arg:     (object) argument to feed to function (fn)
    //
    // note: fn should always return true on successful runs, otherwise return
    //       false
    function fireEvent(opts, fn, self, arg) {
        if ($.isFunction(fn)) {
            try {
                return fn.call(self, arg);
            } catch (error) {
                if (opts.debug) {
                    alert("Error calling googlemaps." + fn + ": " + error);
                } else {
                    throw error;
                }
                return false;
            }
        }
        return true;
    }

    var current = null;

    function Googlemap(root, conf) {
        // current instance
        var self = this;
        if (!current) {
            current = self;
        }

        // internal variables
        var map;
        var geo;
        var bounds;
        var markers;
        //var index = 0;

        // configuration (comments show default values)
        var latitude = conf.latitude;    // -35
        var longitude = conf.longitude;   // 150
        var zoom = conf.zoom;        // 4
        var controls = conf.controls;    // true
        var labels = conf.labels;      // true
        var html = conf.html;        // null
        var anchor = conf.anchor;      // null
        var addresses = conf.addresses;   // null
        var debug = conf.debug;       // false
        var maptype = conf.maptype; //1 -> normal
        var controltype = conf.controltype // 1
        var iconImage = conf.iconImage //"",
        var iconShadow = conf.iconShadow //"http://www.google.com/mapfiles/shadow50.png",
        var iconSizeX = conf.iconSizeX //"20, 34",
        var iconShadowSizeX = conf.iconShadowSizeX //"37, 34",
        var iconAnchorX = conf.iconAnchorX //"9, 34",
        var iconSizeY = conf.iconSizeY //"20, 34",
        var iconShadowSizeY = conf.iconShadowSizeY //"37, 34",
        var iconAnchorY = conf.iconAnchorY //"9, 34",        

        // methods
        $.extend(self, {
            // plugin specific
            getVersion: function() { return [1, 0, 0]; },
            getRoot: function() { return root; },
            // google maps specific
            getMap: function() { return map; },
            getGeo: function() { return geo; },
            getAddresses: function() { return addresses; },
            getBounds: function() { return bounds; },
            //getIndex: function() { return index; },
            getMarkers: function() { return markers; },

            // api
            isBrowserCompatible: function() {
                if ($.isFunction(GBrowserIsCompatible))
                    return GBrowserIsCompatible();

                return false;
            },
            initialise: function() {
                self.trace("initialising: " + this);
                if (self.isBrowserCompatible()) {
                    map = map || new GMap2(document.getElementById($(root)[0].id));

                    switch (maptype) {
                        case 1:
                            {
                                map.setMapType(G_NORMAL_MAP);
                                break;
                            }
                        case 2:
                            {
                                map.setMapType(G_SATELLITE_MAP);
                                break;
                            }
                        case 3:
                            {
                                map.setMapType(G_HYBRID_MAP);
                                break;
                            }
                        case 4:
                            {
                                map.setMapType(G_PHYSICAL_MAP);
                                break;
                            }
                    }

                    geo = geo || new GClientGeocoder();
                    bounds = bounds || new GLatLngBounds();
                    markers = markers || new Array();

                    GEvent.addListener(map, "load", function() {
                        self.trace("google map loaded!");
                    });

                    // set the map center
                    map.setCenter(new GLatLng(latitude, longitude), zoom);

                    // mark addresses on the map
                    if (addresses) {
                        if (addresses.length > 0) {
                            var i = 0;
                            while (i < addresses.length) {
                                self.geocode(i++);
                            }
                        }
                    }

                    // add controls
                    if (controls) {
                        switch (controltype) {
                            case 1:
                                {
                                    map.addControl(new GLargeMapControl3D());
                                    break;
                                }
                            case 2:
                                {
                                    map.addControl(new GLargeMapControl());
                                    break;
                                }
                            case 3:
                                {
                                    map.addControl(new GSmallMapControl());
                                    break;
                                }
                            case 4:
                                {
                                    map.addControl(new GSmallZoomControl3D());
                                    break;
                                }
                            case 5:
                                {
                                    map.addControl(new GSmallZoomControl());
                                    break;
                                }
                        }

                        map.addControl(new GMapTypeControl());
                    }
                }
            },

            // geocode(index, address, html, anchor) :
            //     index:     (number) index of the marker (obsolete when label == false)
            //     address:   (string) human readable address to query
            //     html:      [array] what to display on marker's "click" event
            //     anchor:    [array] simulate marker's "click" event outside the map via a link
            geocode: function(index) {
                geo = (geo == null) ? new GClientGeocoder() : geo;
                if (addresses && index >= 0) {
                    self.trace("processing address: [" + addresses[index] + "] (" + index + ")");
                    markers = markers || new Array();

                    // safer way of geocoding - avoids G_GEO_TOO_MANY_QUERIES
                    geo.getLocations(addresses[index], function(response) {
                        var statuscode = response.Status.code;

                        if (statuscode == G_GEO_SUCCESS) {
                            // success!
                            self.trace(response.Placemark);
                            var point = new GLatLng(response.Placemark[0].Point.coordinates[1], response.Placemark[0].Point.coordinates[0], true);

                            // extend bounds
                            bounds = bounds || new GLatLngBounds();
                            bounds.extend(point); self.trace("bounds extended");

                            // marker
                            var marker = self.createMarker(index, point);
                            self.trace(marker); self.trace("marker created");

                            // marker events
                            GEvent.addListener(marker, "click", function() {
                                zoom = 15;
                                map.setCenter(marker.getLatLng(), zoom);
                            });

                            // add marker to array and display
                            markers[index] = marker;
                            map.addOverlay(marker);

                            // onMarkerLoaded
                            if (fireEvent(conf, self.onMarkerLoaded, self, index) === false) {
                                return self;
                            }
                        } else {
                            if (statuscode == G_GEO_TOO_MANY_QUERIES) {
                                // retry again after a short while
                                var delay = 600;
                                self.trace("index " + index + " will begin retry in " + delay + "ms")
                                setTimeout(function() {
                                    self.geocode(index);
                                }, delay);
                            } else {
                                self.trace("unknown error code: " + statuscode);
                                marker[index] = null;
                            }
                        }
                    });
                }
            },

            // onMarkerLoaded(index)
            //     internal function : DO NOT MODIFY
            onMarkerLoaded: function(index) {
                // set map bounds and zoom level to optimal level so all marker can fit
                return self.optimiseZoomLevel();
            },

            // optimiseZoomLevel()
            optimiseZoomLevel: function(index) {
                if (bounds && (addresses.length == markers.length)) {
                    //zoom = map.getBoundsZoomLevel(bounds);
                    map.setZoom(zoom);
                    map.setCenter(bounds.getCenter());
                }

                return true;
            },

            // createMarker(index, point)
            //     index:    (number) index of the marker (also used to generate a letter)
            //     point:    (GLatLng) latitude and longitude of the marker
            createMarker: function(index, point) {
                // create a base icon for all of our markers that specifies the
                // shadow, icon dimensions, etc.
                var baseIcon = new GIcon(G_DEFAULT_ICON);
                baseIcon.image = iconImage;
                baseIcon.shadow = iconShadow;
                baseIcon.iconSize = new GSize(iconSizeX, iconSizeY);
                baseIcon.shadowSize = new GSize(iconShadowSizeX, iconShadowSizeY);
                baseIcon.iconAnchor = new GPoint(iconAnchorX, iconAnchorY);
                baseIcon.infoWindowAnchor = new GPoint(9, 2);

                // lettered marker which starts at "A" and wraps at "Z"
                var range = "Z".charCodeAt(0) - "A".charCodeAt(0) + 1;
                var letter = String.fromCharCode("A".charCodeAt(0) + (index % range));
                var letteredIcon = new GIcon(baseIcon);
                letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";

                var markerOptions = {
                    icon: baseIcon,
                    bouncy: true
                };

                var marker = (labels) ? new GMarker(point, markerOptions) : new GMarker(point);
                return marker;
            },

            // trace(arg, [args...]) : print everything in the arguments array
            trace: function() {
                if (!debug) return;

                var caller = arguments.caller || "self";
                for (i = 0; i < arguments.length; i++) {
                    var argument = arguments[i]; // print object as it is
                    var line = argument;
                    try {
                        // Firefox, Safari, Opera
                        console.debug(line);
                    } catch (error) {
                        // fails gracefully on IE, Chrome
                        alert(line);
                    }
                }
            }
        });

        function load() {
            self.initialise();
            return self;
        }

        load();
    }


    // jQuery plugin implementation
    jQuery.prototype.googlemap = function(conf) {
        // already constructed --> return API
        var api = this.eq(typeof conf == 'number' ? conf : 0).data("googlemap");
        if (api) { return api; }

        var opts = {
            latitude: -23,
            longitude: 133,
            zoom: 4,
            labels: true,
            controls: true,
            html: null,
            anchor: null,
            addresses: null,
            debug: false,
            maptype: 1,
            controltype: 1,
            iconImage: "",
            iconShadow: "http://www.google.com/mapfiles/shadow50.png",
            iconSizeX: 20,
            iconSizeY: 34,
            iconShadowSizeX: 37,
            iconShadowSizeY: 34,
            iconAnchorX: 9,
            iconAnchorY: 34
        };

        $.extend(opts, conf);

        this.each(function() {
            var el = new Googlemap($(this), opts);
            $(this).data("googlemap", el);
        });

        return this;
    };

})(jQuery);

//ajaxform 2 !!!! - take great care, this is not a reusable plugin () - !!!! 

(function($) {
    $.fn.extend({
        Ajaxform2: function(settings) { //ToDo; Applying settings
            return this.each(function() {
                //set defaults
                var options = $.extend({
                    enableanalytics: false,
                    trackercode: "XX-00000000-0",
                    falsecolor: "#ff0000"
                }, settings);

                //settings
                var parent = $(this);
                var emailregex = new RegExp(/\w+@[a-zA-Z0-9_]+?\.[a-zA-Z]/);
                var valid;
                var falsetext = $(this).find("input[name='falsemessage']").val();
                var thnx = $(this).find("input[name='thnxmessage']").val();
                var enableanalytics = options.enableanalytics;
                var trackercode = options.trackercode;
                var falsecolor = options.falsecolor;

                $(this).find(".input").click(function() {
                    if ($(this).val() == falsetext) {
                        $(this).val("");
                    }
                });

                $(this).find(".button").click(function() {
                    var i = 0;
                    var falsefields = new Array();
                    valid = true;

                    $(".thnxmessage").remove();

                    $(parent).find(".input").each(function() {
                        if ($(this).is(".required")) {

                            //email spec
                            if ($(this).is(".email")) {
                                if (emailregex.exec($(this).val()) == null) {
                                    valid = false;
                                }
                            }
                            else { //other cases
                                if ($(this).val() == "" || $(this).val() == falsetext) {
                                    valid = false;
                                }
                            }

                            //add to falsefields array
                            if (!valid) {
                                falsefields[i] = $(this).attr("name");
                                i++;
                            }
                        }
                    });

                    $.each(falsefields, function(index) {
                        $(parent).find(".input[name= " + falsefields[index] + "]").each(function() {
                            var currentclass = $(this).attr("class");

                            if ($(this).val() == "") {
                                $(this).val(falsetext);
                            }
                            else {
                                $(this).css("color", falsecolor);
                            }

                            $(this).attr({
                                Class: currentclass + " false"
                            });
                        });
                    });

                    if (valid) {
                        $(parent).fadeOut(100);

                        var formvalues = $(parent).find(".input").serialize();

                        $(parent).find(".input").each(function() {
                            var currentclass = $(this).attr("class");
                            var newclass = currentclass.replace("false", "#353436");

                            $(this).css("color", "");
                            $(this).attr({
                                Class: newclass
                            });

                            if ($(this).is("select")) {
                                var initval = $(this).find("option:first-child").val();

                                $(this + ":selected").each(function() {
                                    $(this).removeAttr("selected");
                                });
                                $(this).val(initval);
                            }
                            else if ($(this).is("[type=checkbox]") || $(this).is("[type=radio]")) {
                                $(this).removeAttr("checked");
                            }
                            else {
                                $(this).val("");
                            }

                        });

                        $(parent).parent("*").find(".loader").show();

                        $.post("/Ajax/signup.aspx?" + formvalues, function() {
                            window.setTimeout(function() {

                                if (enableanalytics) {
                                    $(".googlecode").remove();

                                    //google stuff
                                    var analytics = "<span class='googlecode'>";
                                    analytics += "<script type=\"text/javascript\">";
                                    analytics += "var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");";
                                    analytics += "document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));";
                                    analytics += "</script>";
                                    analytics += "<script type=\"text/javascript\">";
                                    analytics += "try {";
                                    analytics += "var pageTracker = _gat._getTracker(\"" + trackercode + "\");";
                                    analytics += "pageTracker._trackPageview();";
                                    analytics += "} catch(err) {}</script>";
                                    analytics += "</span>";

                                    $(parent).prepend(analytics);
                                }

                                $(".loader").hide();
                                $(parent).fadeIn(100);
                                $(parent).prepend("<p class='thnxmessage'>" + thnx + "</p>");
                            }, 1000);
                        });
                    }
                });
            });
        }
    });
})(jQuery);

//ajaxform 3: this is also not reusable getting kind of messy, i know

(function($) {
    $.fn.extend({
        Ajaxform3: function(settings) { //ToDo; Applying settings
            return this.each(function() {
                //set defaults
                var options = $.extend({
                    enableanalytics: false,
                    trackercode: "XX-00000000-0",
                    falsecolor: "#ff0000",
                    executionpath: false,
                    refresh: false
                }, settings);

                //settings
                var parent = $(this);
                var emailregex = new RegExp(/\w+@[a-zA-Z0-9_]+?\.[a-zA-Z]/);
                var valid;
                var falsetext = $(this).find("input[name='falsemessage']").val();
                var thnx = $(this).find("input[name='thnxmessage']").val();
                var enableanalytics = options.enableanalytics;
                var trackercode = options.trackercode;
                var falsecolor = options.falsecolor;
                var executionpath = options.executionpath;
                var refresh = options.refresh;

                if (!executionpath) {
                    alert("please specify an executionpath (setting: executionpath)");
                }

                if (!falsetext) {
                    alert("please specify a empty field error notification (hidden field [name=falsemessage])");
                }

                if (!thnx) {
                    alert("please specify thanx message (hidden field [name=thnxmessage])");
                }

                $(this).find(".input").click(function() {
                    if ($(this).val() == falsetext) {
                        $(this).val("");
                    }
                });

                $(this).find(".Button").click(function() {
                    var i = 0;
                    var falsefields = new Array();
                    valid = true;

                    $(".thnxmessage").remove();

                    $(parent).find(".Input").each(function() {
                        if ($(this).is(".Required")) {

                            //email spec
                            if ($(this).is(".Email")) {
                                if (emailregex.exec($(this).val()) == null) {
                                    valid = false;
                                }
                            }
                            else if ($(this).is(".double")) {
                                var valtext = $(parent).find(".input[name=" + $(this).attr("name").replace("-d", "") + "]:first").val();

                                if ($(this).val() != valtext) {
                                    valid = false;
                                }
                            }
                            else { //other cases
                                if ($(this).val() == "" || $(this).val() == falsetext) {
                                    valid = false;
                                }
                            }

                            //add to falsefields array
                            if (!valid) {
                                falsefields[i] = $(this).attr("name");
                                i++;
                            }
                        }
                    });

                    $.each(falsefields, function(index) {
                        $(parent).find(".Input[name= " + falsefields[index] + "]").each(function() {
                            var currentclass = $(this).attr("class");

                            if ($(this).val() == "") {
                                $(this).val(falsetext);
                            }
                            else {
                                $(this).css("color", falsecolor);
                            }

                            $(this).attr({
                                Class: currentclass + " false"
                            });
                        });
                    });

                    if (valid) {
                        $(parent).fadeOut(100);

                        var formvalues = $(parent).find(".Input, .hiddenvalue").serialize();
                        $(parent).find(".Input").each(function() {
                            var currentclass = $(this).attr("class");
                            var newclass = currentclass.replace("false", "#353436");

                            $(this).css("color", "");
                            $(this).attr({
                                Class: newclass
                            });

                            if ($(this).is("select")) {
                                var initval = $(this).find("option:first-child").val();

                                $(this + ":selected").each(function() {
                                    $(this).removeAttr("selected");
                                });
                                $(this).val(initval);
                            }
                            else if ($(this).is("[type='checkbox']") || $(this).is("[type=radio]")) {
                                $(this).removeAttr("checked");
                            }
                            else {
                                $(this).val("");
                            }

                        });

                        //$(parent).hide();
                        $(".Loader").show();

                        $.post(executionpath + "?" + formvalues, function() {
                            window.setTimeout(function() {

                                if (enableanalytics) {
                                    $(".googlecode").remove();

                                    //google stuff
                                    var analytics = "<span class='googlecode'>";
                                    analytics += "<script type=\"text/javascript\">";
                                    analytics += "var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");";
                                    analytics += "document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));";
                                    analytics += "</script>";
                                    analytics += "<script type=\"text/javascript\">";
                                    analytics += "try {";
                                    analytics += "var pageTracker = _gat._getTracker(\"" + trackercode + "\");";
                                    analytics += "pageTracker._trackPageview();";
                                    analytics += "} catch(err) {}</script>";
                                    analytics += "</span>";

                                    $(parent).prepend(analytics);
                                }

                                $(".Loader").hide();

                                if (refresh) {
                                    window.location.reload(true);
                                }
                                else {
                                    $(parent).fadeIn(100);
                                    $(parent).prepend("<p class='thnxmessage'>" + thnx + "</p>");
                                }
                            }, 1000);
                        });
                    }
                });
            });
        }
    });
})(jQuery);


