/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.3
 * Requires jQuery 1.1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */

(function($) {
	
$.extend($.fn, {
	livequery: function(type, fn, fn2) {
		var self = this, q;
		
		// Handle different call patterns
		if ($.isFunction(type))
			fn2 = fn, fn = type, type = undefined;
			
		// See if Live Query already exists
		$.each( $.livequery.queries, function(i, query) {
			if ( self.selector == query.selector && self.context == query.context &&
				type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
					// Found the query, exit the each loop
					return (q = query) && false;
		});
		
		// Create new Live Query if it wasn't found
		q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
		
		// Make sure it is running
		q.stopped = false;
		
		// Run it immediately for the first time
		q.run();
		
		// Contnue the chain
		return this;
	},
	
	expire: function(type, fn, fn2) {
		var self = this;
		
		// Handle different call patterns
		if ($.isFunction(type))
			fn2 = fn, fn = type, type = undefined;
			
		// Find the Live Query based on arguments and stop it
		$.each( $.livequery.queries, function(i, query) {
			if ( self.selector == query.selector && self.context == query.context && 
				(!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
					$.livequery.stop(query.id);
		});
		
		// Continue the chain
		return this;
	}
});

$.livequery = function(selector, context, type, fn, fn2) {
	this.selector = selector;
	this.context  = context || document;
	this.type     = type;
	this.fn       = fn;
	this.fn2      = fn2;
	this.elements = [];
	this.stopped  = false;
	
	// The id is the index of the Live Query in $.livequery.queries
	this.id = $.livequery.queries.push(this)-1;
	
	// Mark the functions for matching later on
	fn.$lqguid = fn.$lqguid || $.livequery.guid++;
	if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
	
	// Return the Live Query
	return this;
};

$.livequery.prototype = {
	stop: function() {
		var query = this;
		
		if ( this.type )
			// Unbind all bound events
			this.elements.unbind(this.type, this.fn);
		else if (this.fn2)
			// Call the second function for all matched elements
			this.elements.each(function(i, el) {
				query.fn2.apply(el);
			});
			
		// Clear out matched elements
		this.elements = [];
		
		// Stop the Live Query from running until restarted
		this.stopped = true;
	},
	
	run: function() {
		// Short-circuit if stopped
		if ( this.stopped ) return;
		var query = this;
		
		var oEls = this.elements,
			els  = $(this.selector, this.context),
			nEls = els.not(oEls);
		
		// Set elements to the latest set of matched elements
		this.elements = els;
		
		if (this.type) {
			// Bind events to newly matched elements
			nEls.bind(this.type, this.fn);
			
			// Unbind events to elements no longer matched
			if (oEls.length > 0)
				$.each(oEls, function(i, el) {
					if ( $.inArray(el, els) < 0 )
						$.event.remove(el, query.type, query.fn);
				});
		}
		else {
			// Call the first function for newly matched elements
			nEls.each(function() {
				query.fn.apply(this);
			});
			
			// Call the second function for elements no longer matched
			if ( this.fn2 && oEls.length > 0 )
				$.each(oEls, function(i, el) {
					if ( $.inArray(el, els) < 0 )
						query.fn2.apply(el);
				});
		}
	}
};

$.extend($.livequery, {
	guid: 0,
	queries: [],
	queue: [],
	running: false,
	timeout: null,
	
	checkQueue: function() {
		if ( $.livequery.running && $.livequery.queue.length ) {
			var length = $.livequery.queue.length;
			// Run each Live Query currently in the queue
			while ( length-- )
				$.livequery.queries[ $.livequery.queue.shift() ].run();
		}
	},
	
	pause: function() {
		// Don't run anymore Live Queries until restarted
		$.livequery.running = false;
	},
	
	play: function() {
		// Restart Live Queries
		$.livequery.running = true;
		// Request a run of the Live Queries
		$.livequery.run();
	},
	
	registerPlugin: function() {
		$.each( arguments, function(i,n) {
			// Short-circuit if the method doesn't exist
			if (!$.fn[n]) return;
			
			// Save a reference to the original method
			var old = $.fn[n];
			
			// Create a new method
			$.fn[n] = function() {
				// Call the original method
				var r = old.apply(this, arguments);
				
				// Request a run of the Live Queries
				$.livequery.run();
				
				// Return the original methods result
				return r;
			}
		});
	},
	
	run: function(id) {
		if (id != undefined) {
			// Put the particular Live Query in the queue if it doesn't already exist
			if ( $.inArray(id, $.livequery.queue) < 0 )
				$.livequery.queue.push( id );
		}
		else
			// Put each Live Query in the queue if it doesn't already exist
			$.each( $.livequery.queries, function(id) {
				if ( $.inArray(id, $.livequery.queue) < 0 )
					$.livequery.queue.push( id );
			});
		
		// Clear timeout if it already exists
		if ($.livequery.timeout) clearTimeout($.livequery.timeout);
		// Create a timeout to check the queue and actually run the Live Queries
		$.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
	},
	
	stop: function(id) {
		if (id != undefined)
			// Stop are particular Live Query
			$.livequery.queries[ id ].stop();
		else
			// Stop all Live Queries
			$.each( $.livequery.queries, function(id) {
				$.livequery.queries[ id ].stop();
			});
	}
});

// Register core DOM manipulation methods
$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');

// Run Live Queries when the Document is ready
$(function() { $.livequery.play(); });


// Save a reference to the original init method
var init = $.prototype.init;

// Create a new init method that exposes two new properties: selector and context
$.prototype.init = function(a,c) {
	// Call the original init and save the result
	var r = init.apply(this, arguments);
	
	// Copy over properties if they exist already
	if (a && a.selector)
		r.context = a.context, r.selector = a.selector;
		
	// Set properties
	if ( typeof a == 'string' )
		r.context = c || document, r.selector = a;
	
	// Return the result
	return r;
};

// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
$.prototype.init.prototype = $.prototype;
	
})(jQuery);;
/**
 * jquery.dump.js
 * @author Torkild Dyvik Olsen
 * @version 1.0
 * 
 * A simple debug function to gather information about an object.
 * Returns a nested tree with information.
 * 
 */
(function($) {

    $.fn.dump = function() {
       return $.dump(this);
    };
    
    $.dump = function(object) {
       var recursion = function(obj, level) {
          if(!level) level = 0;
          var dump = '', p = '';
          for(i = 0; i < level; i++) p += "\t";
          
          t = type(obj);
          switch(t) {
             case "string":
                return '"' + obj + '"';
                break;
             case "number":
                return obj.toString();
                break;
             case "boolean":
                return obj ? 'true' : 'false';
             case "date":
                return "Date: " + obj.toLocaleString();
             case "array":
                dump += 'Array ( \n';
                $.each(obj, function(k,v) {
                   dump += p +'\t' + k + ' => ' + recursion(v, level + 1) + '\n';
                });
                dump += p + ')';
                break;
             case "object":
                dump += 'Object { \n';
                $.each(obj, function(k,v) {
                   dump += p + '\t' + k + ': ' + recursion(v, level + 1) + '\n';
                });
                dump += p + '}';
                break;
             case "jquery":
                dump += 'jQuery Object { \n';
                $.each(obj, function(k,v) {
                   dump += p + '\t' + k + ' = ' + recursion(v, level + 1) + '\n';
                });
                dump += p + '}';
                break;
             case "regexp":
                return "RegExp: " + obj.toString();
             case "error":
                return obj.toString();
             case "document":
             case "domelement":
                dump += 'DOMElement [ \n'
                      + p + '\tnodeName: ' + obj.nodeName + '\n'
                      + p + '\tnodeValue: ' + obj.nodeValue + '\n'
                      + p + '\tinnerHTML: [ \n';
                $.each(obj.childNodes, function(k,v) {
                   if(k < 1) var r = 0;
                   if(type(v) == "string") {
                      if(v.textContent.match(/[^\s]/)) {
                         dump += p + '\t\t' + (k - (r||0)) + ' = String: ' + trim(v.textContent) + '\n';
                      } else {
                         r--;
                      }
                   } else {
                      dump += p + '\t\t' + (k - (r||0)) + ' = ' + recursion(v, level + 2) + '\n';
                   }
                });
                dump += p + '\t]\n'
                      + p + ']';
                break;
             case "function":
                var match = obj.toString().match(/^(.*)\(([^\)]*)\)/im);
                match[1] = trim(match[1].replace(new RegExp("[\\s]+", "g"), " "));
                match[2] = trim(match[2].replace(new RegExp("[\\s]+", "g"), " "));
                return match[1] + "(" + match[2] + ")";
             case "window":
             default:
                dump += 'N/A: ' + t;
                break;
          }
          
          return dump;
       };
       
       var type = function(obj) {
          var type = typeof(obj);
          
          if(type != "object") {
             return type;
          }
          
          switch(obj) {
             case null:
                return 'null';
             case window:
                return 'window';
             case document:
                return 'document';
             case window.event:
                return 'event';
             default:
                break;
          }
          
          if(obj.jquery) {
             return 'jquery';
          }
          
          switch(obj.constructor) {
             case Array:
                return 'array';
             case Boolean:
                return 'boolean';
             case Date:
                return 'date';
             case Object:
                return 'object';
             case RegExp:
                return 'regexp';
             case ReferenceError:
             case Error:
                return 'error';
             case null:
             default:
                break;
          }
          
          switch(obj.nodeType) {
             case 1:
                return 'domelement';
             case 3:
                return 'string';
             case null:
             default:
                break;
          }
          
          return 'Unknown';
       };
       
       return recursion(object);
    };
    
    function trim(str) {
       return ltrim(rtrim(str));
    }
    
    function ltrim(str) {
       return str.replace(new RegExp("^[\\s]+", "g"), "");
    }
    
    function rtrim(str) {
       return str.replace(new RegExp("[\\s]+$", "g"), "");
    }

})(jQuery);;
/**
 * Firebug-Artige Consolen Imitation hauptsaechlich fuer IE > 8, aber auch 
 * fuer den Firefox bei abgeschaltetem Firebug.
 * 
 * <code>
 *  $.log('Text');
 *  $.log($('#resizeGrip'));
 * </code>
 * 
 * TODO: Da es gerade fuer den IE ist, sollte das Erstellen der Elemente 
 *       ueber pures JS geloest werden. Wurde nur schnell runter getippt.
 * TODO: Bei der Ausgabe des JS Elements, den "Begin" des HTML Elements 
 *       ausgeben (<div class="blubs">)
 * TODO: Hover einbauen (Firebug-Like)
 * TODO: Alles etwas Quick&Dirty... Besser machen...
 * TODO: Es kann passieren, dass durch die Ausgabe bzw. des Benutzens ein
 *       Rueckgabewert an das momentane JS zurueckgegeben wird, was dazu 
 *       fuehrt, dass etwas mit true ausgewertet wird obwohl es false ist!
 * 
 * @param {Mixed}   element  Das Element welches geloggt werden soll.
 * @param {Object}  options  Moegliche Parameter.
 *                              
 * @author David Winkel <d.winkel@hvssd.de>
 * @since  07.01.2011
 */
(function($) {
    $.log = function(element, options) {
        var settings = {
            "type" : "log"
        };

        if ( options ) { 
            $.extend( settings, options );
        }

        if(typeof(window.console) != "undefined") {
            // TODO: Evtl etwas besseres ausdenken, aber console.type() -> 
            //       wobei type der string ist (warn) geht nicht.
            switch(settings.type) {
                case 'log':
                    console.log(element);
                    break;
                case 'info':
                    console.info(element);
                    break;
                case 'warn':
                    console.warn(element);
                    break;
                case 'error':
                    console.error(element);
                    break;
            }
        } else {
            switch(settings.type) {
                case 'log':
                    var iconSrc = undefined;
                    break;
                case 'info':
                    var iconSrc = 'view/Html/img/log/infoIcon.png';
                    break;
                case 'warn':
                    var iconSrc = 'view/Html/img/log/warningIcon.png';
                    break;
                case 'error':
                    var iconSrc = 'view/Html/img/log/errorIcon.png';
                    break;
            }

            var topBody = top.document.body;

            var c = top.document.getElementById("hvssdConsole");

            if(typeof(c) == "undefined" || c == null) {
                var c = top.document.createElement('div');
                c.id = 'hvssdConsole';

                top.document.body.appendChild(c);
            }

            var itemCount   = c.getElementsByTagName('div').length;

            var elementType = '';
            
            if(typeof(element) != "undefined" && element  != null) {
                if(typeof(element.jquery) != "undefined") {
                    elementType = 'jQuery ';
                } else if(typeof(element) == "object") {
                    elementType = 'JS ';
                }
            }
            elementType += typeof(element);
            var oddEvenCss  = (itemCount % 2 == 0 ? 'odd' : 'even');

            var elementOut = element;

            var cItem = top.document.createElement('div');
            cItem.className = "hvssdConosleItem " + oddEvenCss;

            // Item Icon
            var cItemIcon = top.document.createElement('span');
            cItemIcon.className = "hvssdConosleItemIcon";
            
            if(typeof(iconSrc) != "undefined") {
                var cItemIconImg = top.document.createElement('img');
                cItemIconImg.src = iconSrc;
                cItemIconImg.alt = 'alt';
                cItemIcon.appendChild(cItemIconImg);
            }

            // Item Count
            var cItemCount = top.document.createElement('span');
            cItemCount.className = "hvssdConosleItemCount";
            var cItemCountText = top.document.createTextNode('#' + itemCount);
            cItemCount.appendChild(cItemCountText);

            // Item Type
            var cItemType = top.document.createElement('span');
            cItemType.className = "hvssdConosleElementType";
            var cItemTypeText = top.document.createTextNode('{' + elementType + '}');
            cItemType.appendChild(cItemTypeText);

            // Item Text / Object / mit Hover und Co
            var cItemText = top.document.createElement('span');
            var cItemTextText = top.document.createTextNode(elementOut);
            cItemText.appendChild(cItemTextText);

            // Alles Zusammenfuehren
            cItem.appendChild(cItemIcon);
            cItem.appendChild(cItemCount);
            cItem.appendChild(cItemType);
            cItem.appendChild(cItemText);

            // Item in die Console schreiben
            if(typeof(c.childNodes[0]) == "undefined") {
                c.appendChild(cItem);
            } else {
                c.insertBefore(cItem,c.childNodes[0]);
            }
        }
    };

    /**
     * Shortcuts
     */
    $.warn = function(element) {
        $.log(element, {"type" : "warn"});
    };

    $.info = function(element) {
        $.log(element, {"type" : "info"});
    };

    // Aufgrund der eigenen jQuery.error Methode funktioniert das nicht mehr.
//    $.error = function(element) {
//        $.log(element, {"type" : "error"});
//    };

    jQuery.fn.log = function() {
        $.log(this);
    };
    jQuery.fn.info = function() {
        $.log(this, {"type" : "info"});
    };
    jQuery.fn.warn = function() {
        $.log(this, {"type" : "warn"});
    };
    jQuery.fn.error = function() {
        $.log(this, {"type" : "error"});
    };
})(jQuery);;
/*
 * jQuery Animate To Class
 * Copyright 2008 Igor Frias Vieira
 * http://igorvieira.com/blog/animate-to-class/
 *
 * Released under the MIT and GPL licenses.
 */

(function($)
{
    $.fn.extend({
        animateToClass : function(to, duration, easing, callback)
        {
            if(!to){ return this; }
            
            styles = selectStyle(to);
            
            if(!styles) return this;
            
            return this.animate(styles, duration, easing, callback);
        }
    });
    
    function selectStyle(sel)
    {
        if(sel.substr(0,1) != ".")
        {
            sel = "." + sel;
        }
        
        $(document.styleSheets).each(function(i,v)
        {
            if(attrClassTest = selectAttr(sel, v))
            {
                attrClass = attrClassTest;
            }
        });
        
        if(!attrClass)
        {
            attrClass = Array();
        }
        
        objStyle = {}
        
        if(attrClass == "")
        {
            return false;
        }
        
        if(attrClass.match(";"))
        {
            attrClass = attrClass.split(";");
        }
        else
        {
            attrClass = [attrClass];
        }
        
        $(attrClass).each(function(i,v){
            if(v != ""){
                v = v.split(":");
                v[0] = toCamelCase(v[0]);
                
                objStyle[v[0]] = $.trim(v[1]);
            }
        });
        return objStyle;
    }
    
    function selectAttr(sel, v)
    {
        attrClass = false;  
            
        if($.browser.msie)
        {
            if(v.rules.length > 0)
            {
                $(v.rules).each(function(i2,v2){
                    if(sel == v2.selectorText)
                    {
                        attrClass = v2.style.cssText;
                    }
                });
            }
            else if(v.imports.length > 0)
            {
                $(v.imports).each(function(i2,v2){
                                           
                    if(sel == v2.selectorText)
                    {
                        attrClass = v2.style.cssText;
                    }
                    else if(v2 == "[object]" || v2 == "[Object CSSStyleSheet]" || v2 == "[object CSSImportRule]")
                    {
                        return selectAttr(sel, v2);
                    }
                });
            }
        }
        else
        {
            $(v.cssRules).each(function(i2,v2){
                if(sel == v2.selectorText)
                {
                    attrClass = v2.style.cssText;
                }
                else if(v2 == "[object CSSImportRule]")
                {
                    return selectAttr(sel, v2.styleSheet);
                }
            });
        }
        
        return attrClass;
    }
    
    function toCamelCase(str)
    {
        str = $.trim(str);
        str = str.replace(/-/g, " ");
        str = str.toLowerCase();
        
        strArr = str.split(" ");
        
        var nStr = "";
        $(strArr).each(function(i,v){
            if(i == 0){
                nStr += v;
            }else{
                /*
                v = v.split("");
                v[0] = v[0].toUpperCase();
                nStr += v.join();
                */
                
                //There was a bug in older version, this correction was sugested by Simon Shepard.
                nStr += v.substr(0,1).toUpperCase();
                nStr += v.substr(1,v.length);
            }
        });
            
        return nStr;
    }
})(jQuery);;
/**!
 * @preserve Shadow animation jQuery-plugin 1.7
 * http://www.bitstorm.org/jquery/shadow-animation/
 * Copyright 2011 Edwin Martin <edwin@bitstorm.org>
 * Contributors: Mark Carver, Xavier Lepretre
 * Released under the MIT and GPL licenses.
 */

jQuery(function($, undefined) {
    /**
     * Check whether the browser supports RGBA color mode.
     *
     * Author Mehdi Kabab <http://pioupioum.fr>
     * @return {boolean} True if the browser support RGBA. False otherwise.
     */
    function isRGBACapable() {
        var $script = $('script:first'),
                color = $script.css('color'),
                result = false;
        if (/^rgba/.test(color)) {
            result = true;
        } else {
            try {
                result = ( color != $script.css('color', 'rgba(0, 0, 0, 0.5)').css('color') );
                $script.css('color', color);
            } catch (e) {
            }
        }

        return result;
    }

    $.extend(true, $, {
        support: {
            'rgba': isRGBACapable()
        }
    });

    /*************************************/

    // First define which property to use
    var boxShadowProperty;
    $.each(['boxShadow', 'MozBoxShadow', 'WebkitBoxShadow'], function(i, property) {
        var val = $('html').css(property);
        if (typeof val == 'string' && val != '') {
            boxShadowProperty = property;
            return false;
        }
    });

    // Extend the animate-function
    if (boxShadowProperty) {
        $.fx.step['boxShadow'] = function(fx) {
            if (!fx.init) {
                fx.begin = parseShadow($(fx.elem).get(0).style[boxShadowProperty] || $(fx.elem).css(boxShadowProperty));
                fx.end = $.extend({}, fx.begin, parseShadow(fx.end));
                if (fx.begin.color == undefined) {
                    fx.begin.color = fx.end.color || [0, 0, 0];
                }
                fx.init = true;
            }
            fx.elem.style[boxShadowProperty] = calculateShadow(fx.begin, fx.end, fx.pos);
        }
    }

    // Calculate an in-between shadow.
    function calculateShadow(begin, end, pos) {
        var parts = [];
        if (begin.inset) {
            parts.push('inset');
        }
        if (typeof end.left != 'undefined') {
            parts.push(parseInt(begin.left + pos * (end.left - begin.left), 10) + 'px '
                    + parseInt(begin.top + pos * (end.top - begin.top), 10) + 'px');
        }
        if (typeof end.blur != 'undefined') {
            parts.push(parseInt(begin.blur + pos * (end.blur - begin.blur), 10) + 'px');
        }
        if (typeof end.spread != 'undefined') {
            parts.push(parseInt(begin.spread + pos * (end.spread - begin.spread), 10) + 'px');
        }
        if (typeof end.color != 'undefined') {
            var color = 'rgb' + ($.support['rgba'] ? 'a' : '') + '('
                    + parseInt((begin.color[0] + pos * (end.color[0] - begin.color[0])), 10) + ','
                    + parseInt((begin.color[1] + pos * (end.color[1] - begin.color[1])), 10) + ','
                    + parseInt((begin.color[2] + pos * (end.color[2] - begin.color[2])), 10);
            if ($.support['rgba']) {
                color += ',' + parseFloat(begin.color[3] + pos * (end.color[3] - begin.color[3]));
            }
            color += ')';
            parts.push(color);
        }
        return parts.join(' ');
    }

    // Parse the shadow value and extract the values.
    function parseShadow(shadow) {
        var match, color, parsedShadow = {};

        // Parse an CSS-syntax color. Outputs an array [r, g, b]
        // Match #aabbcc
        if (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(shadow)) {
            color = [parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16), 1];

            // Match #abc
        } else if (match = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(shadow)) {
            color = [parseInt(match[1], 16) * 17, parseInt(match[2], 16) * 17, parseInt(match[3], 16) * 17, 1];

            // Match rgb(n, n, n)
        } else if (match = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(shadow)) {
            color = [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10), 1];

            // Match rgba(n, n, n, n)
        } else if (match = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(shadow)) {
            color = [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10),parseFloat(match[4])];

            // No browser returns rgb(n%, n%, n%), so little reason to support this format.
        }

        // Parse offset, blur and radius
        if (match = /(-?[0-9]+)(?:px)?\s+(-?[0-9]+)(?:px)?(?:\s+(-?[0-9]+)(?:px)?)?(?:\s+(-?[0-9]+)(?:px)?)?/.exec(shadow)) {
            parsedShadow = {left: parseInt(match[1], 10), top: parseInt(match[2], 10), blur: match[3] ? parseInt(match[3], 10) : 0, spread: match[4] ? parseInt(match[4], 10) : 0};
        } else {
            parsedShadow = {left: 0, top: 0, blur: 0, spread: 0};
        }

        // Inset or not
        parsedShadow.inset = /inset/.test(shadow);

        parsedShadow.color = color;

        return parsedShadow;
    }
});;
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.4
 * 
 * Requires: 1.2.2+
 */

(function($) {

var types = ['DOMMouseScroll', 'mousewheel'];

$.event.special.mousewheel = {
    setup: function() {
        if ( this.addEventListener ) {
            for ( var i=types.length; i; ) {
                this.addEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = handler;
        }
    },
    
    teardown: function() {
        if ( this.removeEventListener ) {
            for ( var i=types.length; i; ) {
                this.removeEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = null;
        }
    }
};

$.fn.extend({
    mousewheel: function(fn) {
        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
    },
    
    unmousewheel: function(fn) {
        return this.unbind("mousewheel", fn);
    }
});


function handler(event) {
    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
    event = $.event.fix(orgEvent);
    event.type = "mousewheel";
    
    // Old school scrollwheel delta
    if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
    if ( event.detail     ) { delta = -event.detail/3; }
    
    // New school multidimensional scroll (touchpads) deltas
    deltaY = delta;
    
    // Gecko
    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
        deltaY = 0;
        deltaX = -1*delta;
    }
    
    // Webkit
    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
    
    // Add event and delta to the front of the arguments
    args.unshift(event, delta, deltaX, deltaY);
    
    return $.event.handle.apply(this, args);
}

})(jQuery);;
/*
 * jScrollPane - v2.0.0beta11 - 2011-07-04
 * http://jscrollpane.kelvinluck.com/
 *
 * Copyright (c) 2010 Kelvin Luck
 * Dual licensed under the MIT and GPL licenses.
 */
(function(b,a,c){b.fn.jScrollPane=function(e){function d(D,O){var az,Q=this,Y,ak,v,am,T,Z,y,q,aA,aF,av,i,I,h,j,aa,U,aq,X,t,A,ar,af,an,G,l,au,ay,x,aw,aI,f,L,aj=true,P=true,aH=false,k=false,ap=D.clone(false,false).empty(),ac=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aI=D.css("paddingTop")+" "+D.css("paddingRight")+" "+D.css("paddingBottom")+" "+D.css("paddingLeft");f=(parseInt(D.css("paddingLeft"),10)||0)+(parseInt(D.css("paddingRight"),10)||0);function at(aR){var aM,aO,aN,aK,aJ,aQ,aP=false,aL=false;az=aR;if(Y===c){aJ=D.scrollTop();aQ=D.scrollLeft();D.css({overflow:"hidden",padding:0});ak=D.innerWidth()+f;v=D.innerHeight();D.width(ak);Y=b('<div class="jspPane" />').css("padding",aI).append(D.children());am=b('<div class="jspContainer" />').css({width:ak+"px",height:v+"px"}).append(Y).appendTo(D)}else{D.css("width","");aP=az.stickToBottom&&K();aL=az.stickToRight&&B();aK=D.innerWidth()+f!=ak||D.outerHeight()!=v;if(aK){ak=D.innerWidth()+f;v=D.innerHeight();am.css({width:ak+"px",height:v+"px"})}if(!aK&&L==T&&Y.outerHeight()==Z){D.width(ak);return}L=T;Y.css("width","");D.width(ak);am.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}Y.css("overflow","auto");if(aR.contentWidth){T=aR.contentWidth}else{T=Y[0].scrollWidth}Z=Y[0].scrollHeight;Y.css("overflow","");y=T/ak;q=Z/v;aA=q>1;aF=y>1;if(!(aF||aA)){D.removeClass("jspScrollable");Y.css({top:0,width:am.width()-f});n();E();R();w();ai()}else{D.addClass("jspScrollable");aM=az.maintainPosition&&(I||aa);if(aM){aO=aD();aN=aB()}aG();z();F();if(aM){N(aL?(T-ak):aO,false);M(aP?(Z-v):aN,false)}J();ag();ao();if(az.enableKeyboardNavigation){S()}if(az.clickOnTrack){p()}C();if(az.hijackInternalLinks){m()}}if(az.autoReinitialise&&!aw){aw=setInterval(function(){at(az)},az.autoReinitialiseDelay)}else{if(!az.autoReinitialise&&aw){clearInterval(aw)}}aJ&&D.scrollTop(0)&&M(aJ,false);aQ&&D.scrollLeft(0)&&N(aQ,false);D.trigger("jsp-initialised",[aF||aA])}function aG(){if(aA){am.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'),b('<div class="jspDragBottom" />'))),b('<div class="jspCap jspCapBottom" />')));U=am.find(">.jspVerticalBar");aq=U.find(">.jspTrack");av=aq.find(">.jspDrag");if(az.showArrows){ar=b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",aE(0,-1)).bind("click.jsp",aC);af=b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",aE(0,1)).bind("click.jsp",aC);if(az.arrowScrollOnHover){ar.bind("mouseover.jsp",aE(0,-1,ar));af.bind("mouseover.jsp",aE(0,1,af))}al(aq,az.verticalArrowPositions,ar,af)}t=v;am.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){t-=b(this).outerHeight()});av.hover(function(){av.addClass("jspHover")},function(){av.removeClass("jspHover")}).bind("mousedown.jsp",function(aJ){b("html").bind("dragstart.jsp selectstart.jsp",aC);av.addClass("jspActive");var s=aJ.pageY-av.position().top;b("html").bind("mousemove.jsp",function(aK){V(aK.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",ax);return false});o()}}function o(){aq.height(t+"px");I=0;X=az.verticalGutter+aq.outerWidth();Y.width(ak-X-f);try{if(U.position().left===0){Y.css("margin-left",X+"px")}}catch(s){}}function z(){if(aF){am.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'),b('<div class="jspDragRight" />'))),b('<div class="jspCap jspCapRight" />')));an=am.find(">.jspHorizontalBar");G=an.find(">.jspTrack");h=G.find(">.jspDrag");if(az.showArrows){ay=b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",aE(-1,0)).bind("click.jsp",aC);x=b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",aE(1,0)).bind("click.jsp",aC);
if(az.arrowScrollOnHover){ay.bind("mouseover.jsp",aE(-1,0,ay));x.bind("mouseover.jsp",aE(1,0,x))}al(G,az.horizontalArrowPositions,ay,x)}h.hover(function(){h.addClass("jspHover")},function(){h.removeClass("jspHover")}).bind("mousedown.jsp",function(aJ){b("html").bind("dragstart.jsp selectstart.jsp",aC);h.addClass("jspActive");var s=aJ.pageX-h.position().left;b("html").bind("mousemove.jsp",function(aK){W(aK.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",ax);return false});l=am.innerWidth();ah()}}function ah(){am.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){l-=b(this).outerWidth()});G.width(l+"px");aa=0}function F(){if(aF&&aA){var aJ=G.outerHeight(),s=aq.outerWidth();t-=aJ;b(an).find(">.jspCap:visible,>.jspArrow").each(function(){l+=b(this).outerWidth()});l-=s;v-=s;ak-=aJ;G.parent().append(b('<div class="jspCorner" />').css("width",aJ+"px"));o();ah()}if(aF){Y.width((am.outerWidth()-f)+"px")}Z=Y.outerHeight();q=Z/v;if(aF){au=Math.ceil(1/y*l);if(au>az.horizontalDragMaxWidth){au=az.horizontalDragMaxWidth}else{if(au<az.horizontalDragMinWidth){au=az.horizontalDragMinWidth}}h.width(au+"px");j=l-au;ae(aa)}if(aA){A=Math.ceil(1/q*t);if(A>az.verticalDragMaxHeight){A=az.verticalDragMaxHeight}else{if(A<az.verticalDragMinHeight){A=az.verticalDragMinHeight}}av.height(A+"px");i=t-A;ad(I)}}function al(aK,aM,aJ,s){var aO="before",aL="after",aN;if(aM=="os"){aM=/Mac/.test(navigator.platform)?"after":"split"}if(aM==aO){aL=aM}else{if(aM==aL){aO=aM;aN=aJ;aJ=s;s=aN}}aK[aO](aJ)[aL](s)}function aE(aJ,s,aK){return function(){H(aJ,s,this,aK);this.blur();return false}}function H(aM,aL,aP,aO){aP=b(aP).addClass("jspActive");var aN,aK,aJ=true,s=function(){if(aM!==0){Q.scrollByX(aM*az.arrowButtonSpeed)}if(aL!==0){Q.scrollByY(aL*az.arrowButtonSpeed)}aK=setTimeout(s,aJ?az.initialDelay:az.arrowRepeatFreq);aJ=false};s();aN=aO?"mouseout.jsp":"mouseup.jsp";aO=aO||b("html");aO.bind(aN,function(){aP.removeClass("jspActive");aK&&clearTimeout(aK);aK=null;aO.unbind(aN)})}function p(){w();if(aA){aq.bind("mousedown.jsp",function(aO){if(aO.originalTarget===c||aO.originalTarget==aO.currentTarget){var aM=b(this),aP=aM.offset(),aN=aO.pageY-aP.top-I,aK,aJ=true,s=function(){var aS=aM.offset(),aT=aO.pageY-aS.top-A/2,aQ=v*az.scrollPagePercent,aR=i*aQ/(Z-v);if(aN<0){if(I-aR>aT){Q.scrollByY(-aQ)}else{V(aT)}}else{if(aN>0){if(I+aR<aT){Q.scrollByY(aQ)}else{V(aT)}}else{aL();return}}aK=setTimeout(s,aJ?az.initialDelay:az.trackClickRepeatFreq);aJ=false},aL=function(){aK&&clearTimeout(aK);aK=null;b(document).unbind("mouseup.jsp",aL)};s();b(document).bind("mouseup.jsp",aL);return false}})}if(aF){G.bind("mousedown.jsp",function(aO){if(aO.originalTarget===c||aO.originalTarget==aO.currentTarget){var aM=b(this),aP=aM.offset(),aN=aO.pageX-aP.left-aa,aK,aJ=true,s=function(){var aS=aM.offset(),aT=aO.pageX-aS.left-au/2,aQ=ak*az.scrollPagePercent,aR=j*aQ/(T-ak);if(aN<0){if(aa-aR>aT){Q.scrollByX(-aQ)}else{W(aT)}}else{if(aN>0){if(aa+aR<aT){Q.scrollByX(aQ)}else{W(aT)}}else{aL();return}}aK=setTimeout(s,aJ?az.initialDelay:az.trackClickRepeatFreq);aJ=false},aL=function(){aK&&clearTimeout(aK);aK=null;b(document).unbind("mouseup.jsp",aL)};s();b(document).bind("mouseup.jsp",aL);return false}})}}function w(){if(G){G.unbind("mousedown.jsp")}if(aq){aq.unbind("mousedown.jsp")}}function ax(){b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");if(av){av.removeClass("jspActive")}if(h){h.removeClass("jspActive")}}function V(s,aJ){if(!aA){return}if(s<0){s=0}else{if(s>i){s=i}}if(aJ===c){aJ=az.animateScroll}if(aJ){Q.animate(av,"top",s,ad)}else{av.css("top",s);ad(s)}}function ad(aJ){if(aJ===c){aJ=av.position().top}am.scrollTop(0);I=aJ;var aM=I===0,aK=I==i,aL=aJ/i,s=-aL*(Z-v);if(aj!=aM||aH!=aK){aj=aM;aH=aK;D.trigger("jsp-arrow-change",[aj,aH,P,k])}u(aM,aK);Y.css("top",s);D.trigger("jsp-scroll-y",[-s,aM,aK]).trigger("scroll")}function W(aJ,s){if(!aF){return}if(aJ<0){aJ=0}else{if(aJ>j){aJ=j}}if(s===c){s=az.animateScroll}if(s){Q.animate(h,"left",aJ,ae)
}else{h.css("left",aJ);ae(aJ)}}function ae(aJ){if(aJ===c){aJ=h.position().left}am.scrollTop(0);aa=aJ;var aM=aa===0,aL=aa==j,aK=aJ/j,s=-aK*(T-ak);if(P!=aM||k!=aL){P=aM;k=aL;D.trigger("jsp-arrow-change",[aj,aH,P,k])}r(aM,aL);Y.css("left",s);D.trigger("jsp-scroll-x",[-s,aM,aL]).trigger("scroll")}function u(aJ,s){if(az.showArrows){ar[aJ?"addClass":"removeClass"]("jspDisabled");af[s?"addClass":"removeClass"]("jspDisabled")}}function r(aJ,s){if(az.showArrows){ay[aJ?"addClass":"removeClass"]("jspDisabled");x[s?"addClass":"removeClass"]("jspDisabled")}}function M(s,aJ){var aK=s/(Z-v);V(aK*i,aJ)}function N(aJ,s){var aK=aJ/(T-ak);W(aK*j,s)}function ab(aW,aR,aK){var aO,aL,aM,s=0,aV=0,aJ,aQ,aP,aT,aS,aU;try{aO=b(aW)}catch(aN){return}aL=aO.outerHeight();aM=aO.outerWidth();am.scrollTop(0);am.scrollLeft(0);while(!aO.is(".jspPane")){s+=aO.position().top;aV+=aO.position().left;aO=aO.offsetParent();if(/^body|html$/i.test(aO[0].nodeName)){return}}aJ=aB();aP=aJ+v;if(s<aJ||aR){aS=s-az.verticalGutter}else{if(s+aL>aP){aS=s-v+aL+az.verticalGutter}}if(aS){M(aS,aK)}aQ=aD();aT=aQ+ak;if(aV<aQ||aR){aU=aV-az.horizontalGutter}else{if(aV+aM>aT){aU=aV-ak+aM+az.horizontalGutter}}if(aU){N(aU,aK)}}function aD(){return -Y.position().left}function aB(){return -Y.position().top}function K(){var s=Z-v;return(s>20)&&(s-aB()<10)}function B(){var s=T-ak;return(s>20)&&(s-aD()<10)}function ag(){am.unbind(ac).bind(ac,function(aM,aN,aL,aJ){var aK=aa,s=I;Q.scrollBy(aL*az.mouseWheelSpeed,-aJ*az.mouseWheelSpeed,false);return aK==aa&&s==I})}function n(){am.unbind(ac)}function aC(){return false}function J(){Y.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(s){ab(s.target,false)})}function E(){Y.find(":input,a").unbind("focus.jsp")}function S(){var s,aJ,aL=[];aF&&aL.push(an[0]);aA&&aL.push(U[0]);Y.focus(function(){D.focus()});D.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(aO){if(aO.target!==this&&!(aL.length&&b(aO.target).closest(aL).length)){return}var aN=aa,aM=I;switch(aO.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:s=aO.keyCode;aK();break;case 35:M(Z-v);s=null;break;case 36:M(0);s=null;break}aJ=aO.keyCode==s&&aN!=aa||aM!=I;return !aJ}).bind("keypress.jsp",function(aM){if(aM.keyCode==s){aK()}return !aJ});if(az.hideFocus){D.css("outline","none");if("hideFocus" in am[0]){D.attr("hideFocus",true)}}else{D.css("outline","");if("hideFocus" in am[0]){D.attr("hideFocus",false)}}function aK(){var aN=aa,aM=I;switch(s){case 40:Q.scrollByY(az.keyboardSpeed,false);break;case 38:Q.scrollByY(-az.keyboardSpeed,false);break;case 34:case 32:Q.scrollByY(v*az.scrollPagePercent,false);break;case 33:Q.scrollByY(-v*az.scrollPagePercent,false);break;case 39:Q.scrollByX(az.keyboardSpeed,false);break;case 37:Q.scrollByX(-az.keyboardSpeed,false);break}aJ=aN!=aa||aM!=I;return aJ}}function R(){D.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function C(){if(location.hash&&location.hash.length>1){var aL,aJ,aK=escape(location.hash);try{aL=b(aK)}catch(s){return}if(aL.length&&Y.find(aK)){if(am.scrollTop()===0){aJ=setInterval(function(){if(am.scrollTop()>0){ab(aK,true);b(document).scrollTop(am.position().top);clearInterval(aJ)}},50)}else{ab(aK,true);b(document).scrollTop(am.position().top)}}}}function ai(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function m(){ai();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aJ;if(s.length>1){aJ=s[1];if(aJ.length>0&&Y.find("#"+aJ).length>0){ab("#"+aJ,true);return false}}})}function ao(){var aK,aJ,aM,aL,aN,s=false;am.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(aO){var aP=aO.originalEvent.touches[0];aK=aD();aJ=aB();aM=aP.pageX;aL=aP.pageY;aN=false;s=true}).bind("touchmove.jsp",function(aR){if(!s){return}var aQ=aR.originalEvent.touches[0],aP=aa,aO=I;Q.scrollTo(aK+aM-aQ.pageX,aJ+aL-aQ.pageY);aN=aN||Math.abs(aM-aQ.pageX)>5||Math.abs(aL-aQ.pageY)>5;
return aP==aa&&aO==I}).bind("touchend.jsp",function(aO){s=false}).bind("click.jsp-touchclick",function(aO){if(aN){aN=false;return false}})}function g(){var s=aB(),aJ=aD();D.removeClass("jspScrollable").unbind(".jsp");D.replaceWith(ap.append(Y.children()));ap.scrollTop(s);ap.scrollLeft(aJ)}b.extend(Q,{reinitialise:function(aJ){aJ=b.extend({},az,aJ);at(aJ)},scrollToElement:function(aK,aJ,s){ab(aK,aJ,s)},scrollTo:function(aK,s,aJ){N(aK,aJ);M(s,aJ)},scrollToX:function(aJ,s){N(aJ,s)},scrollToY:function(s,aJ){M(s,aJ)},scrollToPercentX:function(aJ,s){N(aJ*(T-ak),s)},scrollToPercentY:function(aJ,s){M(aJ*(Z-v),s)},scrollBy:function(aJ,s,aK){Q.scrollByX(aJ,aK);Q.scrollByY(s,aK)},scrollByX:function(s,aK){var aJ=aD()+Math[s<0?"floor":"ceil"](s),aL=aJ/(T-ak);W(aL*j,aK)},scrollByY:function(s,aK){var aJ=aB()+Math[s<0?"floor":"ceil"](s),aL=aJ/(Z-v);V(aL*i,aK)},positionDragX:function(s,aJ){W(s,aJ)},positionDragY:function(aJ,s){V(aJ,s)},animate:function(aJ,aM,s,aL){var aK={};aK[aM]=s;aJ.animate(aK,{duration:az.animateDuration,easing:az.animateEase,queue:false,step:aL})},getContentPositionX:function(){return aD()},getContentPositionY:function(){return aB()},getContentWidth:function(){return T},getContentHeight:function(){return Z},getPercentScrolledX:function(){return aD()/(T-ak)},getPercentScrolledY:function(){return aB()/(Z-v)},getIsScrollableH:function(){return aF},getIsScrollableV:function(){return aA},getContentPane:function(){return Y},scrollToBottom:function(s){V(i,s)},hijackInternalLinks:function(){m()},destroy:function(){g()}});at(O)}e=b.extend({},b.fn.jScrollPane.defaults,e);b.each(["mouseWheelSpeed","arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){e[this]=e[this]||e.speed});return this.each(function(){var f=b(this),g=f.data("jsp");if(g){g.reinitialise(e)}else{g=new d(f,e);f.data("jsp",g)}})};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,stickToBottom:false,stickToRight:false,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:c,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this);;
/**
 * Eigene jQuery Funktionen
 *
 * Datei wird zwischen dem jQuery Core und unseren jQuery Dateien geladen, damit uns unsere Funktionen immer 
 * zur Verfügung stehen.
 *
 * Ohne $(document).ready(); da wir nicht auf den DOM warten brauchen, denn hier sollte kein Code entstehen 
 * der direkt ausgefuehrt wird.
 *
 * @author     David Winkel <d.winkel@hvssd.de>
 * @since      11.10.2011
 */
if(typeof(jQuery) == 'function') { (function( $ ){
    /**
     * Liefert die opacity Browserunabhängig zurück.
     * 
     * @author David Winkel <d.winkel@hvssd.de>
     * @since  11.10.2011
     * 
     * return  
     */
    jQuery.fn.getopacity = function() {
        var elem = $(this);

        var ori = $(elem).css('opacity');
        var ori2 = $(elem).css('filter');

//        alert(ori2);
        
        if (ori2) {
            // Leerzeichen entfernen
            ori20 = ori2.replace(' ','');

            // ")" entfernen
            ori21 = ori20.replace(')','');

            // "alpha(opacity=" entfernen
            ori22 = ori21.replace('alpha(opacity=','');

            // Zu einem Int umwandeln und einen opacity freundlichen Wert generieren
            ori23 = parseInt( ori22 ) / 100;

            // Sollten wir nun noch immer einen Int haben, wird dieser mit dem Rückgabewert überschrieben 
            if (!isNaN(ori23) && ori23 != '') {
                ori = ori23;
            }
        }
        return ori;
    };

    /**
     * Hover Bild, einblenden
     * 
     * @params glasCssClass Css Klasse des "Glasscheiben" Elementes
     * 
     * @author Mario Augustin <m.augustin@hvssd.de>
     * @since  10.10.2011
     */
    jQuery.fn.glasHoverIn = function(glasCssClass) {
        $(this).glasHover(glasCssClass, 1);
    };

    /**
     * Hover Bild, einblenden
     * 
     * @params glasCssClass Css Klasse des "Glasscheiben" Elementes
     * 
     * @author Mario Augustin <m.augustin@hvssd.de>
     * @since  10.10.2011
     */
    jQuery.fn.glasHoverOut = function(glasCssClass) {
        $(this).glasHover(glasCssClass, 0);
    };

    /**
     * Hover Bild, ein-/ausblenden
     * 
     * @params glasCssClass Css Klasse des "Glasscheiben" Elementes
     * @params type         0 ausblenden, 1 einblenden
     * 
     * @author Mario Augustin <m.augustin@hvssd.de>
     * @since  10.10.2011
     * 
     * @todo dwinkel, 11.10.2011: IE(9) hate ein "Problem" beim ersten mal Hovern. Die Glasscheibe wird ganz
     *                            kurz komplett schwarz und dann wird gefadet. Das wirk etwas hakelig.
     */
    jQuery.fn.glasHover = function(glasCssClass, type) {
        var self   = $(this);
        var glas   = self.find("." + glasCssClass);
        var glasJS = glas.get(0);
        
        // IE zoom -> hasLayout (opacity)
        glasJS.style.zoom = 1;

        //defaults 
        var time = 200;
        switch(type) {
            case 1:
                if(typeof(glasJS.opacityOld) == "undefined") {
                    glasJS.opacityOld = $(glas).getopacity();
                }

                // Glas ausblenden / Bild aufhellen
                var WrapperOpacityTo = 1;
                var WrapperToZIndex = 1000;
                var WrapperOverflow = "visible";
                var OpacityTo = 0;
                break;
            case 0:
                // Glas einblenden / Bild abdunkeln
                var WrapperOpacityTo = 0;
                var WrapperToZIndex = 0;
                var WrapperOverflow = "hidden";

                if(typeof(glasJS.opacityOld) != "undefined") {
//                    alert(glasJS.opacityOld);
                    var OpacityTo = glasJS.opacityOld;
                } else {
                    var OpacityTo = 0.7;
                }
                break;
            default: 
                // Ohne irgendwelche Werte können und sollten wir nicht einfach weiter machen.
                return;
        }
        var flagWrapper = self.find('.views-field-wrapper');
        self.css({overflow : WrapperOverflow});

        // "Glasscheibe" ein/ausblenden (Bild abdunkeln/aufhellen)
        glas.stop(true, true).fadeTo(time, OpacityTo);

        // Flag / Fahne (Titel + Position) anzeigen
        flagWrapper.css({"z-index" : WrapperToZIndex});
        flagWrapper.stop(true, true).fadeTo(time, WrapperOpacityTo);
    };
})( jQuery );} // if(typeof(jQuery) == 'function') { ENDE }
;
(function ($) {
    $(document).ready(function() {
        /**
         * no-script Klassen entfernen. Das kann nur funktionieren wenn JS aktiviert ist, so dass wir bei 
         * allen Elementen die eine Extrabehandlung brauchen, eine Ansatzmoeglichkeit haben.
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  10.10.2011
         * 
         * @void
         */
        $(".no-script").removeClass("no-script");

        // $(".region-footer .menu :nth-child(3) a").attr("href", "javascript:void(0)").css("cursor", "default");
        $(".region-footer .menu :nth-child(4) a").attr("href", "javascript:void(0)").css("cursor", "default");

        /* Startseiten Pfad. Etwas dynamischer loesen :S */
        var pathFrontpage = "startseite";

        /**
         * IE Stuff
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  30.09.2011
         * 
         * @return void
         */
        if(typeof($.browser.msie) != "undefined" && $.browser.msie === true) {
            /*
             * Erlaubt es auch den IE Benutzern nette grafische Footer Buttons zu sehen. Ist fuer alle 
             * Versionen bis 9 gedacht (obwohl eigentlich auch <= 6 angenommen werden kann, aber wir gehen
             * mal nicht davon aus, dass es noch freilaufende 5er Genossen gibt).
             */
            if($.browser.version < 9) {
                $("#footer .block-menu li:nth-child(1)").addClass('footer-button-left');
                $("#footer .block-menu li:nth-child(2)").addClass('footer-button-middle');
                $("#footer .block-menu li:nth-child(3)").addClass('footer-button-right');
            }
        }

        /**
         * Videos
         * 
         * Fuer die Intro Seite wird per CSS die Steuerleiste nicht angezeigt.
         * 
         * @todo dwinkel, 21.08.11: Durch das lokale Testen und dem fehlenden original Video ist die 
         *                          Einschaetzung getruebt ob ein Preloader, oder aehnliches 
         *                          (js timeout + Anfrage an das mediaelement.js Objekt ob es fertig ist,
         *                          oder ob angefangen werden duerfte), benoetigt wird.
         * @todo dwinkel, 21.08.11: Bild anzeigen solange das Video nicht verfuegbar ist oder wir darauf 
         *                          warten, unter Beachtung des FlashFallbacks fuer FF bei h264 und und und...
         */
        /* INTRO */
//        $('.node-type-intro .mejs-playpause-button').livequery(function() {
//            var playButton = this;
//
//            if(playButton !== null) {
//                var video = $('video').get(0);
//
//                // $.log(video);
//                if(typeof(video) != "undefined") {
//                    // Das Video wird eigentlich direkt per Atribute aus dem Element gestartet. Chrome kann 
//                    // das leider nicht oder ignoriert es. So wird etwas nachgeholfen.
//                    video.player.play();
//
//                    // Wird das Video mit reinen HTML5 Mitteln abgespielt, funktioniert das loop Attribut aus 
//                    // dem Element. Bei Flash muss etwas nachgeholfen werden.
//                    video.player.options.loop = true;
//
//                    setTimeout(function() {
//                        $('#content-background').fadeOut(2000);
//                    }, 250);
//                }
//
//                // Puh das war echt ein Krampf das Ding zu finden und einzubauen aber nun soll es erstmal
//                // raus. Ich lasse es erstmal noch drin damit man noch mal nachschauen kann.
////                $('video').get(0).player.media.addEventListener("ended", function() {
////                    var basePath = Drupal.settings.basePath;
////                    top.window.location.href = basePath + pathFrontpage;
////                }, false);
//            }
//        });

        /* LOGO */
//        $('#header .mejs-playpause-button').livequery(function() {
//            var video = $('#structure-image-video-box video').get(0);
//
//            video.player.options.loop = true;
//        });

        /* Art&Weise */
//        $('.node-type-page-video .node .mejs-playpause-button').livequery(function() {
//            var video = $('.node-type-page-video .node video').get(0);
//
//            video.player.play();
//        });

        /**
         * Startseite
         */
        /* Click Event auf die ganze Spalte */
        viewsRowClickFn = function () {
            var self = $(this);

            var fieldLink = self.find(".views-field-title a");
            var fieldLinkUrl = fieldLink.attr("href");

            if(fieldLinkUrl.length == 0) {
                var basePath = Drupal.settings.basePath;
                top.window.location.href = basePath + pathFrontpage;
            } else {
                top.window.location.href = fieldLinkUrl;
            }
        };
        $('.view-hvs-startseite .views-row').unbind("click", viewsRowClickFn).bind("click", viewsRowClickFn);

        /* Hover */
        $('.view-hvs-startseite .views-row').hover(function() {
            var fadeInTime = 200;

            var self = $(this);

            var fieldImage = self.find(".views-field-field-image");
            var fieldBody  = self.find(".views-field-body");
            var fieldTitle = self.find(".views-field-title");

            $(fieldImage).stop(true, true).fadeIn(fadeInTime);
            $(fieldBody).stop(true, true).fadeIn(fadeInTime);
            $(fieldTitle).stop(true, true).animate({
                opacity: 1
            }, fadeInTime);
        }, function() {
            var fadeOutTime = 200;

            var self = $(this);

            var fieldImage = self.find(".views-field-field-image");
            var fieldBody  = self.find(".views-field-body");
            var fieldTitle = self.find(".views-field-title");

            $(fieldImage).stop(true, true).fadeOut(fadeOutTime);
            $(fieldBody).stop(true, true).fadeOut(fadeOutTime);
            $(fieldTitle).stop(true, true).animate({
                opacity: 0.5
            }, fadeOutTime);
        });

        

        /**
         * "Glas Hover Effekt" fuer die Personen / Logo Seite.
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  30.09.2011
         * 
         * @return void
         * Raus: $(.view-kunden .views-row)
         */
        $(".view-personen .views-row, .view-portfolio .views-row").hover(function() {
            $(this).glasHoverIn("views-field-field-glas-hover");
        }, function() {
            $(this).glasHoverOut("views-field-field-glas-hover");
        });

        /**
         * "Glas Hover Effekt" für die Portfolio Galerie.
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  30.09.2011
         * 
         * @return void
         */
        thumbFieldItemEnter = function() {
            $(this).glasHoverIn("field-item-glas-hover");
        };
        thumbFieldItemLeave = function(event) {
            $(this).glasHoverOut("field-item-glas-hover");
        };

        $(".content-picturebox-thumb .field-item").bind("mouseenter", thumbFieldItemEnter).bind("mouseleave", thumbFieldItemLeave);

        /**
         * Click event auf dem "Glas Hover". Wird nicht beim hover gebunden (Performance). Zudem reicht das 
         * <a> leider nicht aus, da es unter dem "Glas Hover" <div> liegt.
         * 
         * Ein $.trigger("click") reicht leider nicht um den Link aufzurufen, deshalb ueber 
         * window.location.href geloest (FF6, Win7).
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  30.09.2011
         * 
         * @return void
         */
        /*
         * PERSONEN
         */
        $(".view-personen .views-field-field-glas-hover").unbind("click").bind("click", function() {
            var personLink = $(this).closest(".views-row-inner").find(".views-field-field-picture-person a");
            if(personLink.length == 1) {
                var aHref = personLink.attr("href");
                
                if(aHref.length > 0) {
                    window.location.href = aHref;
                }
            }
        });

        /*
         * PORTFOLIO OVERVIEW
         */
        $(".view-portfolio .views-field-field-glas-hover").unbind("click").bind("click", function() {
            var portfolioLink = $(this).closest(".views-row-inner").find(".views-field-field-overview-picture a");
            if(portfolioLink.length == 1) {
                var aHref = portfolioLink.attr("href");

                if(aHref.length > 0) {
                    window.location.href = aHref;
                }
            }
        });

        /*
         * KUNDEN
         */
        // Fix ne pointer click klasse setzen... 
        $(".view-kunden .views-row-inner a").closest(".views-row-inner").find(".views-field-field-glas-hover").addClass("pointer");
        $(".view-kunden .views-field-field-glas-hover").unbind("click").bind("click", function() {
            var link = $(this).closest(".views-row-inner").find("a");
            if(link.length == 1) {
                var aHref = link.attr("href");

                if(typeof(aHref) != "undefined" && aHref.length > 0) {
                    window.location.href = aHref;
                }
            }
         });

        /**
         * Navi Mouseover
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  30.09.2011
         * 
         * @return void
         */
        $(".navi a").livequery(function() {
            $(this).hover(function() {
                var title = $(this).find(".navi-title");
                title.addClass("mouseover");
                title.stop(true, true).fadeTo(100, 0.7).css("display", "block");
            }, function() {
                $(this).find(".navi-title").removeClass("mouseover");

                var title = $(this).find(".navi-title:not(.ajax-loader)");
                title.stop(true, true).fadeOut(100);
            });
        }); 

        /**
         * Scrollbar
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  30.09.2011
         * 
         * Momentan nur fuer die Personen Seite aktiv (<- anpassen wenn weiter hinzugefuegt werden)
         * 
         * @todo dwinkel, 06.09.11: Das timeout musste ich setzen, da die Scrollbar ansonsten zu weit nach
         * unten gescrollt hat. Es wurde in etwa 50% (von 340px) weiter gescrollt als es sein musste.
         * Waere schick wenn das auch ohne timeout funktionieren wuerde.
         */
        setTimeout(function() {
            $(".node-type-page .region-content-right").jScrollPane({showArrows: true});
            $(".node-type-person .region-content-right").jScrollPane({showArrows: true});
            $(".node-type-person .region-content-right").jScrollPane({showArrows: true});
            $(".node-type-page .region-content-middle-right").jScrollPane({showArrows: true});
            $(".content-left .field-name-body").jScrollPane({showArrows: true});
            $(".content-scrollable").jScrollPane({showArrows: true});

            /**
             * 1. Korrekturen der Portfolioseite wenn mehr als 12 Portfolios vorhanden sind 
             *          
             * @author Mario Augustin <m.augustin@hvssd.de>
             * @since  06.10.2011
            */
            
            $('.page-portfolio').livequery(function() {
                var countElements = $('.views-row').length;
                if(countElements > 12) {
                    $('.views-row').addClass('views-row-gt12');
                    $('.page-portfolio').addClass('page-portfolio-gt12');
                    
                    
                    var elementInLine = 4;
                    var iCount = 0;
                    $('.views-row').each(function(){
                        iCount++;
                        var self = this;
                        $(self).find('.views-field-wrapper').addClass('views-field-wrapper-gt12-' + iCount);
                        $(self).addClass('views-row-gt12-' + iCount);
                        if(iCount % elementInLine == 0) {
                            iCount = 0;
                        }
                    })
                    /*
                     * scrollbar portfolio
                     * 
                     * @author Mario Augustin <m.augustin@hvssd.de>
                     * @since  06.10.2011
                     */
                    $(".view-portfolio").jScrollPane({showArrows: true});
                }
            });
        }, 800);

        /**
         * Klick Event fuer die Bilder auf der Portfolio Seite. War vorher voll auf livequery. Das brauchen
         * wir eher nicht, da die Inhalte nicht nachgeladen werden.
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  29.09.2011
         * 
         * @return void
         * 
         * @todo dwinkel, 11.10.2011: Hier kann man noch ein wenig mit den Effekten herumspielen. Läuft 
         *                            meiner Meinung nach schon ganz gut, aber etwas Finetuning geht noch.
         */
        $(".content-picturebox-thumb a").livequery(function() {
            var self   = $(this);
            var field  = self.closest(".field-item");
            var glas   = field.find(".field-item-glas-hover");

            var toggleGalleryDisplay = function(data, delta) {
                var picbox = self.closest('.content-picturebox').find('.content-picturebox-right');

                // Fix dem alten Bild die entsprechende CSS Klasse geben
                var oldImg = picbox.find('img');
                oldImg.addClass('old-image');

                // Das neue Bild vorbereiten
                var newImg = $(data);
                newImg.addClass('new-image');

                // Das Neue Bild anfuegen
                picbox.append(newImg);

                // Zum Schluss entspannt das alte Bild, welches per zIndex ueber dem neuen Bild liegt, 
                // ausblenden
                $(oldImg).fadeOut(1000, function() {
                    oldImg.remove();
                    newImg.removeClass("new-image");
                    newImg.css("opacity", "1");

                    glas.removeClass("field-item-ajax-loader-hover");
                    field.bind("mouseenter", thumbFieldItemEnter).bind("mouseleave", thumbFieldItemLeave);
                    
                    field.trigger("mouseleave");
                });
            };

            glas.click(function() {
                var field = glas.closest(".field-item");
                // glas.addClass("field-item-ajax-loader-hover");
                
                var ajaxLoader = $('<div class="field-item-ajax-loader-hover"></div>');
                
                glas.before(ajaxLoader);

                field.unbind("mouseenter", thumbFieldItemEnter).unbind("mouseleave", thumbFieldItemLeave);

                var 
                    self = $(this),
                    field  = self.closest(".field-item"),
                    nid = self.closest('.node').attr('data-nid'),
                    delta = field.attr('data-delta'),
                    loadUrl = Drupal.settings.basePath + "async/load_gallery_picture/" + nid + "/" + delta;

                $.ajax({
                    url: loadUrl,
                    success: function(data) {
                        toggleGalleryDisplay(data, delta);
                        ajaxLoader.remove();
                    }
                });

                return false;
            });
        });

        /**
         * Blendet die Struktur Bilder ein oder aus. Zusätzlich wird das title Attribut leer gemacht.
         * Hatte einen Titel eingeführt damit nicht JS Personen auch wissen was damit gemeint ist.
         * 
         * @author David Winkel <d.winkel@hvssd.de>
         * @since  21.10.2011
         */
        var structureElements = $('#content-structure>img.jq_content-structure-logo');

        if(typeof(structureElements) == "object" && structureElements.length > 0) {
            structureElements.removeAttr("title");
            structureElements.hover(function() {
                $(this).next().show();
            }, function() {
                $(this).next().hide();
            });
        }
    });
})(jQuery);;

