Estate = ( function() {
	/* START PUBLIC */
	return {
		Trace: function( string ) {
			if ( Estate.Develop && Estate.Develop.Trace ) {
				Estate.Develop.Trace( string )
			}
		},
		
		TraceAttr: function( string ) {
			if ( Estate.Develop && Estate.Develop.Trace ) {
				Estate.Develop.TraceAttr( string )
			}
		}
	}
	/* END PUBLIC */
})();






/*
 * Summary:
 * Tools to validate function arguments
 */		
Estate.Check = ( function() {
	/* START PRIVATE */
	function LiteralsAreCompatible( mainLiteral, updateLiteral ) {
		for (prop in updateLiteral) {
			if ( typeof(mainLiteral[prop]) == "undefined" ) {
				return "The variable '" + prop + "'in the object literal cannot be merged with the original object literal.";
			}

			if ( typeof(updateLiteral[prop]) != typeof(mainLiteral[prop]) ) {
				return "The variable '" + prop + " is of the wrong type. It is '" + typeof(updateLiteral[prop]) + "' but it should be '" + typeof(mainLiteral[prop]) + "'";
			}
			
			if ( typeof( updateLiteral[prop] ) == "object" ) {
				LiteralsAreCompatible( mainLiteral[prop], updateLiteral[prop] );
			}
		}
	}
	/* END PRIVATE */
	


	/* START PUBLIC */
	return {
		/*
		 * Summary:
		 * Checks if the right amount of arguments are used when calling the function
		 * 
		 * Usage:
			error = Estate.Check.ArgumentsCount( arguments.length, 1 );
			if ( error != "" ) throw new Error( error );
		 */		
		ArgumentsCount: function( CurrentArgumentsLength, CorrectArgumentsLength ) {
			if ( typeof(CorrectArgumentsLength) == "number" ) {
				if ( CurrentArgumentsLength != CorrectArgumentsLength ) {
					return "Wrong number of arguments. There argument count should be "+ CorrectArgumentsLength +", but it is "+ CurrentArgumentsLength;
				}
			}
			if ( typeof(CorrectArgumentsLength) == "array" ) {
				var CorrectArgumentsCount = false;
				for (var i = 0; i < CorrectArgumentsLength.length; i++) {
					if ( CorrectArgumentsCount == CorrectArgumentsLength[i] ) {
						CorrectArgumentsCount = true
					}
				}
			}
			return ""
		},

		/*
		 * Summary:
		 * Checks if an element with a particular id exists
		 * 
		 * Usage:
			error = Estate.Check.ElementById( 'elID' );
			*OR*
			error = Estate.Check.ElementById( 'elID', 'div' );

			if ( error != "" ) throw new Error( error );
		 */
		ElementById: function( ElementID, RequiredTagName ) {
			if ( typeof( ElementID ) != "string" ) {
				return "Provided element id is not a string but  '"+ typeof( ElementID ) +"'.";
			}
			if ( !document.getElementById(ElementID) ) {
				return "Cannot find HTML element with the id '"+ ElementID +"'";
			}
			if ( arguments.length > 1 && typeof( RequiredTagName ) == "string" ) {
				if ( document.getElementById(ElementID).tagName.toLowerCase() != RequiredTagName && RequiredTagName != "" ) {
					return "HTML element with ID '"+ ElementID +"' has the tagname '"+ document.getElementById(ElementID).tagName +"' but it should be '"+ RequiredTagName +"'";
				}
			}
			return ""
		},

		/*
		 * Summary:
		 * Checks if the referenced object is an HTML element
		 * 
		 * Usage:
			error = Estate.Check.Element( document.getElementsByTagName('a')[0] );
			if ( error != "" ) throw new Error( error );
		 */
		Element: function( Element ) {
			if ( typeof( Element.tagName ) == "undefined" ) {
				return "HTML element expected. Type of checked variable is " + typeof( Element )
			}
			return ""
		},

		/*
		 * Summary:
		 * Checks if argument is of the expected variable type
		 * 
		 * Usage:
			error = Estate.Check.VariableType( id, "string" );
			if ( error != "" ) throw new Error( error );
		 */
		VariableType: function( Variable, ExpectedVariableType ) {
			if ( typeof( Variable ) != ExpectedVariableType ) {
				return "Unexpected variable type. There variable type should be "+ ExpectedVariableType +", but it is "+ typeof( Variable );
			}
			return ""
		},

		/*
		 * Summary:
		 * Checks an object literal
		 * 
		 * Usage:
			oLiteral.foo = Estate.Check.SetLiteralIfDefined( oLiteral, oNewLiteral, "foo" )
		 */
		SetLiteralIfDefined: function( oldVariable, newVariable, arrayID ) {
			if ( typeof( newVariable ) == "undefined" ) {
				return oldVariable[arrayID]
			}

			if ( typeof( newVariable[arrayID] ) == "undefined" ) {
				return oldVariable[arrayID]
			} else {
				return newVariable[arrayID]
			}
		},

		/*
		 * Summary:
		 * Updates object literal. The 2nd argument is merged with the 1st. Please use
		 * Estate.Check.LiteralUpdatable if you want to be sure that this method
		 * only updates variables and doesn't create new ones.
		 * 
		 * Usage:
			Estate.Check.UpdateLiteral( mainLiteral, updatingLiteral )
		 */
		UpdateLiteral: function( mainLiteral, updateLiteral ) {
			for (prop in updateLiteral) {
				mainLiteral[prop] = updateLiteral[prop]
				
				if ( typeof( updateLiteral[prop] ) == "object" ) {
					Estate.Check.UpdateLiteral( mainLiteral[prop], updateLiteral[prop] );
				}
			}
		},

		/*
		 * Summary:
		 * Compares 2 object literals and checks if the 2nd argument can be merged
		 * with the 1st. If there's a variable in the 1st argument that's not
		 * been defined in the 2nd, the function returns the name of the variable.
		 * 
		 * Usage:
			error = Estate.Check.LiteralUpdatable( mainLiteral, updatingLiteral );
			if ( error != "" ) throw new Error( error );
		 */
		LiteralUpdatable: function( mainLiteral, updateLiteral ) {
			if ( typeof(mainLiteral) != "object") {
				throw new Error( "Cannot check literal: 'mainLiteral' is not an object" )
			}
			if ( typeof(updateLiteral) != "object") {
				throw new Error( "Cannot check literal: 'updateLiteral' second argument is not an object" )
			}
			
			
			var isNotUpdatableVariable = LiteralsAreCompatible( mainLiteral, updateLiteral )
			
			if ( typeof( isNotUpdatableVariable ) == "undefined" ) {
				return ''
			} else {
				return isNotUpdatableVariable;
			}
		}
	}
	/* END PUBLIC */
})();






/*
 * Summary:
 * For getting, setting and deleting cookies
 */
Estate.Cookies = (function() {
    /* START PUBLIC */
    return {
		/**
		* Sets a cookie
		*
		* @since 1.0 - 2010-02-23
		* @version 1.0 - 2010-02-23
		* @param {String} name Name of the cookie
		* @param {String} value Value of the cookie
		* @param {Date} expires Expire date
		* @param {String} path Path where the cookie is valid (default: path of calling document)
		* @param {String} domain
		* @param {Boolean} secure Indicating if the cookie transmission requires a secure transmission
		* @example
		* Estate.Cookies.Set( "cookieName", "cookieValue", new Date(2015, 12, 31, 23, 59, 59, 0), "/", "www.domain.com", "")
		*/
		Set: function(name,
						   value,
						   expires,
						   path,
						   domain,
						   secure
						   ) {
    		document.cookie = name + "=" + encodeURIComponent(value) +
					((expires) ? "; expires=" + expires.toGMTString() : "") +
					((path) ? "; path=" + path : "") +
					((domain) ? "; domain=" + domain : "") +
					((secure) ? "; secure" : "");
		},

        /*
        * Summary:
        * Gets cookie data
        * 
        * Usage:
        Estate.Cookies.Get()
        * 
        */
        Get: function(name) {
            var dc = document.cookie;
            var prefix = name + "=";
            var begin = dc.indexOf("; " + prefix);
            if (begin == -1) {
                begin = dc.indexOf(prefix);
                if (begin != 0) return null;
            } else {
                begin += 2;
            }
            var end = document.cookie.indexOf(";", begin);
            if (end == -1) {
                end = dc.length;
            }
            return unescape(dc.substring(begin + prefix.length, end));
        },

        /*
        * Summary:
        * Deletes cookie data
        * 
        * Usage:
        Estate.Cookies.Delete()
        * 
        */
        Delete: function(name, 	/* name of the cookie */
						  path, 	/* path of the cookie (must be same as path used to create cookie) */
						  domain	/* domain of the cookie (must be same as domain used to create cookie) */
						  ) {
            if (Estate.Cookies.Get(name)) {
                document.cookie = name + "=" +
				((path) ? "; path=" + path : "") +
				((domain) ? "; domain=" + domain : "") +
				"; expires=Thu, 01-Jan-70 00:00:01 GMT";
            }
        }
    }
    /* END PUBLIC */
})();






Estate.CSSTools = ( function() {
	/* START PUBLIC */
	return {
		
		/*
		 * Summary:
		 * With ClassToggle you can let a specific class on an element be switched on or off
		 * 
		 * Usage:
		 * Estate.CSSTools.ClassToggle( document.getElementById('elementId'), 'className')
		 */
		ClassToggle: function( el, className ) {
			var error;
			error = Estate.Check.Element( el );
			if ( error != "" ) throw new Error( error );
			error = Estate.Check.VariableType( className, "string" )
			if ( error != "" ) throw new Error( error );


			if ( el.className.indexOf( className ) < 0) {
				el.className += " "+ className
			} else {
				while ( el.className.indexOf( className ) >= 0) {
					el.className = el.className.replace( " "+ className, "" )
					el.className = el.className.replace( className, "" )
				}
			}
		},

		AddClass: function( el, className ) {
			var error;
			error = Estate.Check.Element( el );
			if ( error != "" ) throw new Error( error );
			error = Estate.Check.VariableType( className, "string" )
			if ( error != "" ) throw new Error( error );


			if ( el.className.indexOf( className ) < 0) {
				el.className += " "+ className
			}
		},

		RemoveClass: function( el, className ) {
			var error;
			error = Estate.Check.Element( el );
			if ( error != "" ) throw new Error( error );
			error = Estate.Check.VariableType( className, "string" )
			if ( error != "" ) throw new Error( error );


			while ( el.className.indexOf( className ) >= 0) {
				el.className = el.className.replace( " "+ className, "" )
				el.className = el.className.replace( className, "" )
			}
		},
		

        /*
         * Summary:
         * Adds and removes a css class on the body. The class is used to show the website with a larger font
         * 
         * Usage:
         * Estate.Custom.ToggleFontSize(linkTextHolder)
         */
        ToggleFontSize: function(linkTextHolderId) {
            if (arguments.length > 0) {
                var error
                error = Estate.Check.ElementById(linkTextHolderId);
                if (error != "") throw new Error(error);
            }


            var fontSizeClassName = "FontSize"
            var smallerTextLink = "Kleinere letters"
            var largerTextLink = "Grotere letters"

            if (Estate.Cookies.Get("fontSize") == null) {
                Estate.Cookies.Set("fontSize", "1")
                Estate.CSSTools.AddClass(document.body, fontSizeClassName + '1')
                if (linkTextHolderId != undefined) {
                    document.getElementById(linkTextHolderId).innerHTML = smallerTextLink
                }
            } else {
                Estate.Cookies.Delete("fontSize")
                Estate.CSSTools.RemoveClass(document.body, fontSizeClassName + '1')
                if (linkTextHolderId != undefined) {
                    document.getElementById(linkTextHolderId).innerHTML = largerTextLink
                }
            }
        }
	}
	/* END PUBLIC */
})();






Estate.Events = ( function() {
	/* START PUBLIC */
	return {
		/*
		 * Summary:
		 * Adds a function to an event of a single element
		 * 
		 * Usage:
		 * Estate.Events.AddEvent( document.getElementById('elementId'), functionName, "onclick" )
		 */
		AddEvent: function( element,		/* the element on which the event is placed */
						   	newFunction,	/* the function that has to be added to the event */
							eventType		/* the event type itself */
							  ) {
			var error;
			error = Estate.Check.VariableType( element, "object" )
			if ( error != "" ) throw new Error( error );
			error = Estate.Check.VariableType( newFunction, "function" )
			if ( error != "" ) throw new Error( error );
			
			
			var oldEvent = eval("element." + eventType);
			var eventContentType = eval("typeof element." + eventType)
			
			if ( eventContentType != 'function' ) {
				eval("element." + eventType + " = newFunction")
			} else {
				eval("element." + eventType + " = function(e) { oldEvent(e); newFunction(e); }")
			}
		}
	}
	/* END PUBLIC */
})();






Estate.Forms = ( function() {
	/* START PUBLIC */
	return {
		/*
		 * Summary:
		 * Inverts the checked state of all checkboxes in a box
		 *
		 * Usage:
		 * Estate.Forms.InvertCheckboxSelection( document.getElementsByTagName('form')[0] )
		 */
		InvertCheckboxSelection: function( collectionParent ) {
			var error;
			error = Estate.Check.Element( collectionParent );
			if ( error != "" ) throw new Error( error );


			var formFieldsCollection = collectionParent.getElementsByTagName( "input" )
			if (collectionParent.alt == "true") {
				collectionParent.alt = ""
			} else {
				collectionParent.alt = "true"
			}
			var isAllChecked = collectionParent.alt

			for ( var i=0; i < formFieldsCollection.length; i++ ) {
				if (formFieldsCollection[i].type == "checkbox") {
					if (collectionParent.alt != "true") {
						formFieldsCollection[i].checked = ""
					} else {
						formFieldsCollection[i].checked = "checked"
					}
				}
			}
		}
	}
	/* END PUBLIC */
})();






Estate.GetElements = ( function() {
	/* START PUBLIC */
	return {
		/*
		 * Summary:
		 * Returns all elements with a specific class as an array
		 * 
		 * Usage:
		 * var elementCollection = Estate.GetElements.ByClassName( 'className', 'a', document.getElementById('parentElement') );
		 */
		ByClassName: function ( CurrentArgumentsLength, CorrectArgumentsLength ) {
			if (document.getElementsByClassName) {
				getElementsByClassName = function (className, tag, elm) {
					elm = elm || document;
					var elements = elm.getElementsByClassName(className),
						nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
						returnElements = [],
						current;
					for(var i=0, il=elements.length; i<il; i+=1){
						current = elements[i];
						if(!nodeName || nodeName.test(current.nodeName)) {
							returnElements.push(current);
						}
					}
					return returnElements;
				};
			}
			else if (document.evaluate) {
				getElementsByClassName = function (className, tag, elm) {
					tag = tag || "*";
					elm = elm || document;
					var classes = className.split(" "),
						classesToCheck = "",
						xhtmlNamespace = "http://www.w3.org/1999/xhtml",
						namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
						returnElements = [],
						elements,
						node;
					for(var j=0, jl=classes.length; j<jl; j+=1){
						classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
					}
					try	{
						elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
					}
					catch (e) {
						elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
					}
					while ((node = elements.iterateNext())) {
						returnElements.push(node);
					}
					return returnElements;
				};
			}
			else {
				getElementsByClassName = function (className, tag, elm) {
					tag = tag || "*";
					elm = elm || document;
					var classes = className.split(" "),
						classesToCheck = [],
						elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
						current,
						returnElements = [],
						match;
					for(var k=0, kl=classes.length; k<kl; k+=1){
						classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
					}
					for(var l=0, ll=elements.length; l<ll; l+=1){
						current = elements[l];
						match = false;
						for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
							match = classesToCheck[m].test(current.className);
							if (!match) {
								break;
							}
						}
						if (match) {
							returnElements.push(current);
						}
					}
					return returnElements;
				};
			}
			return getElementsByClassName(className, tag, elm);
		}
	}
	/* END PUBLIC */
})();






/*
 * Summary:
 * Truncates a string until it fits in its parent block.
 *
 * Warning:
 * In most cases it's better to cut the string on the server side
 * 
 * Usage:
       jQuery(document).ready( function() {
              Estate.jQuery.TextOverflowFix( ['.block1','.block2'], ['span',''] )
       })
 */
Estate.jQuery = ( function() {
       /* START PUBLIC */
       return {
              TextOverflowFix: function( aQueryBlock,  /* array of containers (as jQuery selector) */
                                                          aQueryText /* array of tags with the text that has to be shortened (as jQuery selector) */
                                                          ) {
                     Estate.Develop.Trace( typeof( jQuery ) )
                     var error
                     error = Estate.Check.VariableType( aQueryBlock, "object" )
                     if ( error != "" ) throw new Error( error );
                     error = Estate.Check.VariableType( aQueryText, "object" )
                     if ( error != "" ) throw new Error( error );
                     if ( typeof(jQuery) != "function" ) throw new Error( "jQuery library must be loaded before you can use this method" )
 
                     var cutStringStepSize = 15;
                     var articleText = '';
                     var loopCount;
                     var maxCount = 100;
                     
                     for (var i = 0; i < aQueryBlock.length; i++) {
                           loopCount = 0;
                           jQuery(aQueryBlock[i]).scrollTop(100);
                           if ( jQuery( aQueryBlock[i] +' '+ aQueryText[i] ).size() > 0 ) {
                                  while ( jQuery(aQueryBlock[i]).scrollTop() != 0 ) {
                                         articleText = jQuery( aQueryBlock[i] +' '+ aQueryText[i] ).html()
                                         jQuery( aQueryBlock[i] + ' ' + aQueryText[i]).html( articleText.substr( 0, articleText.length - cutStringStepSize ) + "..." )
                                         jQuery(aQueryBlock[i]).scrollTop(0)
                                         jQuery(aQueryBlock[i]).scrollTop(100)
                                         loopCount++
                                         if ( loopCount > maxCount ) {
                                                break;
                                         }
                                  }
                           }
                           
                           loopCount = 0;
                           jQuery(aQueryBlock[i]).scrollLeft(100);
                           if ( jQuery( aQueryBlock[i] +' '+ aQueryText[i] ).size() > 0 ) {
                                  while ( jQuery(aQueryBlock[i]).scrollLeft() != 0 ) {
                                         articleText = jQuery( aQueryBlock[i] +' '+ aQueryText[i] ).html()
                                         jQuery( aQueryBlock[i] + ' ' + aQueryText[i]).html( articleText.substr( 0, articleText.length - cutStringStepSize ) + "..." )
                                         jQuery(aQueryBlock[i]).scrollLeft(0)
                                         jQuery(aQueryBlock[i]).scrollLeft(100)
                                         jQuery(aQueryBlock[i] +' '+ aQueryText[i] ).width('auto')
                                         loopCount++
                                         if ( loopCount > maxCount ) {
                                                break;
                                         }
                                  }
                           }
                     }
              }
       }
       /* END PUBLIC */
})();






Estate.Layers = ( function() {
	/* START PUBLIC */
	return {
		/*
		 * Summary:
		 * Returns the position of the element on the y-axis
		 * 
		 * Usage:
		 * Estate.Layers.GetPositionX( document.getElementById('elementId') )
		 */
		GetPositionX: function(obj) {
			var error
			error = Estate.Check.Element( obj );
			if ( error != "" ) throw new Error( error );


			var x = 0
			if (obj.offsetParent) {
				while (obj.offsetParent) {
					x += obj.offsetLeft
					obj = obj.offsetParent
				}
			} else 	if (obj.x) {
				x += obj.x
			}
			return x
		},
		
		/*
		 * Summary:
		 * Returns the position of the element on the x-axis
		 * 
		 * Usage:
		 * Estate.Layers.GetPositionX( document.getElementById('elementId') )
		 */
		GetPositionY: function(obj) {
			var error
			error = Estate.Check.Element( obj );
			if ( error != "" ) throw new Error( error );


			var y = 0
			if (obj.offsetParent) {
				while (obj.offsetParent) {
					y += obj.offsetTop
					obj = obj.offsetParent
				}
			} else 	if (obj.y) {
				y += obj.y
			}
			return y
		}
	}
	/* END PUBLIC */
})();







/*
 * Summary:
 * Loads Javascript library when needed
 *
 * Usage:
	Estate.LoadLibrary.GoogleAnalytics("UA-9330954-1")
 */
Estate.LoadLibrary = (function() {
	/* START PUBLIC */
	return {
		GoogleAnalytics: function(trackerCode) {
			var script = document.createElement("script");
			var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
			script.type = "text/javascript";
			script.src = gaJsHost + "google-analytics.com/ga.js";
			document.body.appendChild(script);
			try {
				var pageTracker = _gat._getTracker(trackerCode);
				pageTracker._trackPageview();
			}
			catch(err) {}
		}
	}
	/* END PUBLIC */
})();






Estate.Navigation = ( function() {
	/* START PUBLIC */
	return {

		/*
		 * Summary:
		 * Navigates one step backwards in browser history. If no browser history is available the static link in the href is used
		 * 
		 * Usage:
		 * <a href="contact.asp" onclick="return Estate.Navigation.LinkBack()">Terug</a>
		 */
		LinkBack: function () {
			if ( history.length > 0 ) {
				history.go( -1 )
				return false
			} else {
				return true
			}
		}
	}
	/* END PUBLIC */
})();






Estate.StringTools = ( function() {
	/* START PRIVATE */
	function TranslateScrambledAddress( string ) {
		var returnString = "";
		var aCharacters;

		string = string.replace( "scrambled:", "" )
		string = string.substring( 1, (string.length - 1) )
		aCharacters = string.split("][")
		for ( var i = 0; i < aCharacters.length; i++ ) {
			returnString += String.fromCharCode( aCharacters[i] )
		}

		return returnString
	}
	/* END PRIVATE */

	/* START PUBLIC */
	return {
		/*
		 * Summary:
		 * Returns the filename is it exists in the address bar
		 *
		 * Usage:
		 * var filename = Estate.StringTools.GetFilenameFromUrl()
		 */
		GetFilenameFromUrl: function() {
			var error;
			error = Estate.Check.ArgumentsCount( arguments.length, 0 );
			if ( error != "" ) throw new Error( error );


	        var file_name = document.location.href;
	        var end = ( file_name.indexOf("?") == -1 ) ? file_name.length : file_name.indexOf("?");
	        return file_name.substring( file_name.lastIndexOf("/")+1, end );
		},

		GetFilenameWithoutExtension: function( data ) {
			var data = data.replace(/^\s|\s$/g, "");
			if (/\.\w+$/.test(data)) {
				var m = data.match(/([^\/\\]+)\.(\w+)$/);
				if (m)
					return m[1];
				else
					return "no file name";
			} else {
				var m = data.match(/([^\/\\]+)$/);
				if (m)
					return m[1];
				else
					return "no file name";
			}
		},

		/*
		 * Summary:
		 * Removes measurement unit from a string
		 *
		 * Usage:
		 * width = Estate.StringTools.RemoveMeasurement( width )
		 */
		RemoveMeasurement: function( SuppliedString ) {
			var error;
			error = Estate.Check.ArgumentsCount( arguments.length, 1 );
			if ( error != "" ) throw new Error( error );
			error = Estate.Check.VariableType( SuppliedString, "string" );
			if ( error != "" ) throw new Error( error );


			var StringWithoutMeasure = SuppliedString
			StringWithoutMeasure = StringWithoutMeasure.replace( "px", "" )
			StringWithoutMeasure = StringWithoutMeasure.replace( "em", "" )
			StringWithoutMeasure = StringWithoutMeasure.replace( "pt", "" )
			
			return StringWithoutMeasure
		},

		/*
		 * Summary:
		 * Searches all scrambled mailto:links and unscrambles them
		 *
		 * Requires:
		 * jQuery
		 *
		 * Usage:
		 * Estate.StringTools.ShowScrambledMailtoLinks()
		 */
		ShowScrambledMailtoLinks: function() {
			var error;
			error = Estate.Check.ArgumentsCount( arguments.length, 0 );
			if ( error != "" ) throw new Error( error );

			//alert( jQuery( 'a[href^="scrambled:"]').size() )
			var mailaddress
			jQuery( 'a[href^="scrambled:"]').each( function() {
				mailaddress = TranslateScrambledAddress( jQuery(this).attr('href') )
				jQuery(this).attr( 'href', "mailto:" + mailaddress )
				jQuery(this).html( mailaddress )
			})
		},


		/**
		 * Returns the value of variable in a GET url
		 *
		 * @since 1.0 - 2010-02-23
		 * @version 1.0 - 2010-02-23
		 * @param {String} SuppliedString
		 * @example
		 * // http://www.domain.com/index.aspx?foo=bar
		 * value = Estate.StringTools.GetQueryString("foo")
		 */
		GetQueryString: function(variable) {
			var query = window.location.search.substring(1);
			var vars = query.split("&");
			for (var i = 0; i < vars.length; i++) {
				var pair = vars[i].split("=");
				if (pair[0] == variable) {
					return pair[1];
				}
			}
		}
	}
	/* END PUBLIC */
})();






/*
 * Summary:
 * UI/interactivity components
 */
Estate.UI = (function() {
	/* START PUBLIC */
	return {
		/*
		 * Summary:
		 * Shows tabbed content
		 *
		 * Requires:
		 * jQuery
		 *
		 * Usage:
		 * Estate.UI.SetTabbedCOntent("TabbedContent")
		 */
		SetTabbedCOntent: function( container ) {
			jQuery("#" + container + " div.contents div").hide()
			jQuery("#" + container + " div.contents div:first").fadeIn()
			jQuery("#" + container + " div.tabs a:first").addClass("active")
			jQuery("#" + container + " div.tabs a").each(function(index) {
				jQuery(this).click(function() {
					jQuery("#" + container + " div.contents div").hide()
					jQuery("#" + container + " div.contents div:eq(" + index + ")").fadeIn()
					jQuery("#" + container + " div.tabs a").removeClass("active")
					jQuery("#" + container + " div.tabs a:eq(" + index + ")").addClass("active")
				})
			})
		}
	}
	/* END PUBLIC */
})();






/*
 * Summary:
 * Hacks to bypass browser errors
 */
Estate.Hack = ( function() {
	/* START PUBLIC */
	return {
		SetFloatingImages: function() {
			jQuery('img[align="left"]').addClass("imgAlignLeft")
			jQuery('img[align="right"]').addClass("imgAlignRight")
		}
	}
	/* END PUBLIC */
})();
