jQuery.autocomplete = function(input, options) {
	// Create a link to self
	var me = this;

	// Create jQuery object for input element
	var $input = jQuery(input).attr("autocomplete", "off");

	// Apply inputClass if necessary
	if (options.inputClass) $input.addClass(options.inputClass);

	// Create results
	var results = document.createElement("div");
	// Create jQuery object for results
	var $results = jQuery(results);
	$results.hide().addClass(options.resultsClass).css("position", "absolute");
	if( options.width > 0 ) $results.css("width", options.width);

	// Add to body element
	jQuery("body").append(results);

	input.autocompleter = me;

	var timeout = null;
	var prev = "";
	var active = -1;
	var cache = {};
	var keyb = false;
	var hasFocus = false;
	var lastKeyPressCode = null;

	// flush cache
	function flushCache(){
		cache = {};
		cache.data = {};
		cache.length = 0;
	};

	// flush cache
	flushCache();

	// if there is a data array supplied
	if( options.data != null ){
		var sFirstChar = "", stMatchSets = {}, row = [];

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( typeof options.url != "string" ) options.cacheLength = 1;

		// loop through the array and create a lookup structure
		for( var i=0; i < options.data.length; i++ ){
			// if row is a string, make an array otherwise just reference the array
			row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]);

			// if the length is zero, don't add to list
			if( row[0].length > 0 ){
				// get the first character
				sFirstChar = row[0].substring(0, 1).toLowerCase();
				// if no lookup array for this character exists, look it up now
				if( !stMatchSets[sFirstChar] ) stMatchSets[sFirstChar] = [];
				// if the match is a string
				stMatchSets[sFirstChar].push(row);
			}
		}

		// add the data items to the cache
		for( var k in stMatchSets ){
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			addToCache(k, stMatchSets[k]);
		}
	}

	$input
	.keydown(function(e) {
		// track last key pressed
		lastKeyPressCode = e.keyCode;
		switch(e.keyCode) {
			case 38: // up
				e.preventDefault();
				moveSelect(-1);
				break;
			case 40: // down
				e.preventDefault();
				moveSelect(1);
				break;
			case 9:  // tab
			case 13: // return
				if( selectCurrent() ){
					// make sure to blur off the current field
					$input.get(0).blur();
					$input.focus();
					e.preventDefault();
				}
				break;
			default:
				active = -1;
				if (timeout) clearTimeout(timeout);
				timeout = setTimeout(function(){onChange();}, options.delay);
				break;
		}
	})
	.focus(function(){
		// track whether the field has focus, we shouldn't process any results if the field no longer has focus
		hasFocus = true;
	})
	.blur(function() {
		// track whether the field has focus
		hasFocus = false;
		hideResults();
	});

	hideResultsNow();

	function onChange() {
		// ignore if the following keys are pressed: [del] [shift] [capslock]
		if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ) return $results.hide();
		var v = $input.val();
		if (v == prev) return;
		prev = v;
		if (v.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			requestData(v);
		} else {
			$input.removeClass(options.loadingClass);
			$results.hide();
		}
	};

 	function moveSelect(step) {
 		
		var lis = jQuery("li", results);
		if (!lis) return;

		active += step;

		if (active < 0) {
			active = 0;
		} else if (active >= lis.size()) {
			active = lis.size() - 1;
		}

		lis.removeClass("ac_over");

		jQuery(lis[active]).addClass("ac_over");
		// Weird behaviour in IE
		// if (lis[active] && lis[active].scrollIntoView) {
		// 	lis[active].scrollIntoView(false);
		// }

	};

	function selectCurrent() {
		var li = jQuery("li.ac_over", results)[0];
		if (!li) {
			var $li = jQuery("li", results);
			if (options.selectOnly) {
				if ($li.length == 1) li = $li[0];
			} else if (options.selectFirst) {
				li = $li[0];
			}
		}
		if (li) {
			selectItem(li);
			return true;
		} else {
			return false;
		}
	};

	function selectItem(li) {
		if (!li) {
			li = document.createElement("li");
			li.extra = [];
			li.selectValue = "";
		}
		var v = jQuery.trim(li.selectValue ? li.selectValue : li.innerHTML);
		input.lastSelected = v;
		prev = v;
		$results.html("");
		$input.val(v);
		hideResultsNow();
		if (options.onItemSelect) setTimeout(function() { options.onItemSelect(li); }, 1);
	};

	// selects a portion of the input string
	function createSelection(start, end){
		// get a reference to the input element
		var field = $input.get(0);
		if( field.createTextRange ){
			var selRange = field.createTextRange();
			selRange.collapse(true);
			selRange.moveStart("character", start);
			selRange.moveEnd("character", end);
			selRange.select();
		} else if( field.setSelectionRange ){
			field.setSelectionRange(start, end);
		} else {
			if( field.selectionStart ){
				field.selectionStart = start;
				field.selectionEnd = end;
			}
		}
		field.focus();
	};

	// fills in the input box w/the first match (assumed to be the best match)
	function autoFill(sValue){
		// if the last user key pressed was backspace, don't autofill
		if( lastKeyPressCode != 8 ){
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(prev.length));
			// select the portion of the value not typed by the user (so the next character will erase)
			createSelection(prev.length, sValue.length);
		}
	};

	function showResults() {
		// get the position of the input field right now (in case the DOM is shifted)
		var pos = findPos(input);
		// either use the specified width, or autocalculate based on form element
		var iWidth = (options.width > 0) ? options.width : $input.width();
		// reposition
		$results.css({
			width: parseInt(iWidth) + "px",
			top: (pos.y + input.offsetHeight) + "px",
			left: pos.x + "px"
		}).show();
	};

	function hideResults() {
		if (timeout) clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		if (timeout) clearTimeout(timeout);
		$input.removeClass(options.loadingClass);
		if ($results.is(":visible")) {
			$results.hide();
		}
		if (options.mustMatch) {
			var v = $input.val();
			if (v != input.lastSelected) {
				selectItem(null);
			}
		}
	};

	function receiveData(q, data) {
		if (data) {
			$input.removeClass(options.loadingClass);
			results.innerHTML = "";

			// if the field no longer has focus or if there are no matches, do not display the drop down
			if( !hasFocus || data.length == 0 ) return hideResultsNow();

//			if (jQuery.browser.msie) {
//				// we put a styled iframe behind the calendar so HTML SELECT elements don't show through
//				$results.append(document.createElement('iframe'));
//			}
			results.appendChild(dataToDom(data));
			// autofill in the complete box w/the first match as long as the user hasn't entered in more data
			if( options.autoFill && ($input.val().toLowerCase() == q.toLowerCase()) ) autoFill(data[0][0]);
			showResults();
		} else {
			hideResultsNow();
		}
	};

	function parseData(data) {
		if (!data) return null;
		var parsed = [];
		var rows = data.split(options.lineSeparator);
		for (var i=0; i < rows.length; i++) {
			var row = jQuery.trim(rows[i]);
			if (row) {
				parsed[parsed.length] = row.split(options.cellSeparator);
			}
		}
		return parsed;
	};

	function dataToDom(data) {
		var ul = document.createElement("ul");
		var num = data.length;

		// limited results to a max number
		if( (options.maxItemsToShow > 0) && (options.maxItemsToShow < num) ) num = options.maxItemsToShow;

		for (var i=0; i < num; i++) {
			var row = data[i];
			if (!row) continue;
			var li = document.createElement("li");
			if (options.formatItem) {
				li.innerHTML = options.formatItem(row, i, num);
				li.selectValue = row[0];
			} else {
				li.innerHTML = row[0];
				li.selectValue = row[0];
			}
			var extra = null;
			if (row.length > 1) {
				extra = [];
				for (var j=1; j < row.length; j++) {
					extra[extra.length] = row[j];
				}
			}
			li.extra = extra;
			ul.appendChild(li);
			jQuery(li).hover(
				function() { jQuery("li", ul).removeClass("ac_over"); jQuery(this).addClass("ac_over"); active = jQuery("li", ul).indexOf(jQuery(this).get(0)); },
				function() { jQuery(this).removeClass("ac_over"); }
			).click(function(e) { e.preventDefault(); e.stopPropagation(); selectItem(this); });
		}
		return ul;
	};

	function requestData(q) {
		if (!options.matchCase) q = q.toLowerCase();
		var data = options.cacheLength ? loadFromCache(q) : null;
		// recieve the cached data
		if (data && data.length >= 20) {
			receiveData(q, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			jQuery.get(makeUrl(q), function(data) {
				data = parseData(data);
				addToCache(q, data);
				receiveData(q, data);
			});
		// if there's been no data found, remove the loading class
		} else {
			$input.removeClass(options.loadingClass);
		}
	};

	function makeUrl(q) {
		var url = options.url + "?q=" + encodeURI(q);
		for (var i in options.extraParams) {
			url += "&" + i + "=" + encodeURI(options.extraParams[i]);
		}
		return url;
	};

	function loadFromCache(q) {
		if (!q) return null;
		if (cache.data[q]) return cache.data[q];
		if (options.matchSubset) {
			for (var i = q.length - 1; i >= options.minChars; i--) {
				var qs = q.substr(0, i);
				var c = cache.data[qs];
				if (c) {
					var csub = [];
					for (var j = 0; j < c.length; j++) {
						var x = c[j];
						var x0 = x[0];
						if (matchSubset(x0, q)) {
							csub[csub.length] = x;
						}
					}
					return csub;
				}
			}
		}
		return null;
	};

	function matchSubset(s, sub) {
		if (!options.matchCase) s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};

	this.flushCache = function() {
		flushCache();
	};

	this.setExtraParams = function(p) {
		options.extraParams = p;
	};

	this.findValue = function(){
		var q = $input.val();

		if (!options.matchCase) q = q.toLowerCase();
		var data = options.cacheLength ? loadFromCache(q) : null;
		if (data && data.length >= 20) {
			findValueCallback(q, data);
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			jQuery.get(makeUrl(q), function(data) {
				data = parseData(data);
				addToCache(q, data);
				findValueCallback(q, data);
			});
		} else {
			// no matches
			findValueCallback(q, null);
		}
	};

	function findValueCallback(q, data){
		if (data) $input.removeClass(options.loadingClass);

		var num = (data) ? data.length : 0;
		var li = null;

		for (var i=0; i < num; i++) {
			var row = data[i];

			if( row[0].toLowerCase() == q.toLowerCase() ){
				li = document.createElement("li");
				if (options.formatItem) {
					li.innerHTML = options.formatItem(row, i, num);
					li.selectValue = row[0];
				} else {
					li.innerHTML = row[0];
					li.selectValue = row[0];
				}
				var extra = null;
				if( row.length > 1 ){
					extra = [];
					for (var j=1; j < row.length; j++) {
						extra[extra.length] = row[j];
					}
				}
				li.extra = extra;
			}
		}

		if( options.onFindValue ) setTimeout(function() { options.onFindValue(li); }, 1);
	}

	function addToCache(q, data) {
		if (!data || !q || !options.cacheLength) return;
		if (!cache.length || cache.length > options.cacheLength) {
			flushCache();
			cache.length++;
		} else if (!cache[q]) {
			cache.length++;
		}
		cache.data[q] = data;
	};

	function findPos(obj) {
		var curleft = obj.offsetLeft || 0;
		var curtop = obj.offsetTop || 0;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
		return {x:curleft,y:curtop};
	}
};

jQuery.fn.autocomplete = function(url, options, data) {
	// Make sure options exists
	options = options || {};
	// Set url as option
	options.url = url;
	// set some bulk local data
	options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null;

	// Set default values for required options
	options.inputClass = options.inputClass || "ac_input";
	options.resultsClass = options.resultsClass || "ac_results";
	options.lineSeparator = options.lineSeparator || "\n";
	options.cellSeparator = options.cellSeparator || "|";
	options.minChars = options.minChars || 1;
	options.delay = options.delay || 400;
	options.matchCase = options.matchCase || 0;
	options.matchSubset = options.matchSubset || 1;
	options.matchContains = options.matchContains || 1;
	options.cacheLength = options.cacheLength || 10;
	options.mustMatch = options.mustMatch || 0;
	options.extraParams = options.extraParams || {};
	options.loadingClass = options.loadingClass || "ac_loading";
	options.selectFirst = options.selectFirst || false;
	options.selectOnly = options.selectOnly || false;
	options.maxItemsToShow = options.maxItemsToShow || 20;
	options.autoFill = options.autoFill || false;
	options.width = parseInt(options.width, 10) || 0;

	this.each(function() {
		var input = this;
		new jQuery.autocomplete(input, options);
	});

	// Don't break the chain
	return this;
};

jQuery.fn.autocompleteArray = function(data, options) {
	return this.autocomplete(null, options, data);
};

jQuery.fn.indexOf = function(e){
	for( var i=0; i<this.length; i++ ){
		if( this[i] == e ) return i;
	}
	return -1;
};
var $j = jQuery.noConflict();

jQuery(function() {
		jQuery("#searchzip").click(function(){
			jQuery(this).val('');
		});
    	jQuery("#searchzip").autocomplete("locate/");
		jQuery("#searchRequestZip").click(function(){
			jQuery(this).val('');
		});
    	jQuery("#searchRequestZip").autocomplete("locate/");
    	jQuery("#zip2").click(function(){
			jQuery(this).val('');
		});
    	jQuery("#zip").click(function(){
			jQuery(this).val('');
		});
	});

jQuery(function() {
	jQuery("#searchziponly").click(function(){
		jQuery(this).val('');
	});
	jQuery("#searchziponly").autocomplete("locateZip/");
});

jQuery(function() {
	jQuery(".show_options").click(function(){
		var wert = this.id;
		var elements = wert.split('_');
		if (document.getElementById(elements[1] + "_" + elements[2]).style.display == 'none'){
			jQuery("#plus_"+ elements[1] + "_" + elements[2]).css("background","url('/static_media/pics/content/sprites_icons_buttons.png') no-repeat -1455px 0;");
		}
		else {
			jQuery("#plus_"+ elements[1] + "_" + elements[2]).css("background","url('/static_media/pics/content/sprites_icons_buttons.png') no-repeat -1518px 0;");	
		}
		DivEinAusblenden(elements[1] + "_" + elements[2]);
		
	});
});

jQuery(function() {
	jQuery("#show_filter_morepets").click(function(){
			jQuery("#show_filter_morepets").hide();
			jQuery("#show_filter_lesspets").show();
			jQuery("#filter_morepets").show();
	});
});
jQuery(function() {
	jQuery("#show_filter_lesspets").click(function(){
			jQuery("#show_filter_morepets").show();
			jQuery("#show_filter_lesspets").hide();
			jQuery("#filter_morepets").hide();
	});
});


jQuery(function() {
	jQuery("#show_exp").click(function(){
			jQuery("#show_exp").hide();
			jQuery("#hide_exp").show();
			jQuery("#exp").show();
	});
});
jQuery(function() {
	jQuery("#hide_exp").click(function(){
			jQuery("#show_exp").show();
			jQuery("#hide_exp").hide();
			jQuery("#exp").hide();
	});
});

jQuery(function() {
	jQuery("#show_details").click(function(){
			jQuery("#show_details").hide();
			jQuery("#hide_details").show();
			jQuery("#details").show();
	});
});
jQuery(function() {
	jQuery("#hide_details").click(function(){
			jQuery("#show_details").show();
			jQuery("#hide_details").hide();
			jQuery("#details").hide();
	});
});

jQuery(function() {
	jQuery("#show_tasks").click(function(){
			jQuery("#show_tasks").hide();
			jQuery("#hide_tasks").show();
			jQuery("#tasks").show();
	});
});
jQuery(function() {
	jQuery("#hide_tasks").click(function(){
			jQuery("#show_tasks").show();
			jQuery("#hide_tasks").hide();
			jQuery("#tasks").hide();
	});
});

jQuery(function() {
	jQuery("#show_availability").click(function(){
			jQuery("#show_availability").hide();
			jQuery("#hide_availability").show();
			jQuery("#availability").show();
	});
});
jQuery(function() {
	jQuery("#hide_availability").click(function(){
			jQuery("#show_availability").show();
			jQuery("#hide_availability").hide();
			jQuery("#availability").hide();
	});
});

jQuery(function() {
	jQuery("#show_ausbildung").click(function(){
			jQuery("#show_ausbildung").hide();
			jQuery("#hide_ausbildung").show();
			jQuery("#ausbildung").show();
	});
});
jQuery(function() {
	jQuery("#hide_ausbildung").click(function(){
			jQuery("#show_ausbildung").show();
			jQuery("#hide_ausbildung").hide();
			jQuery("#ausbildung").hide();
	});
});

jQuery(function() {
	jQuery("#show_dokumente").click(function(){
			jQuery("#show_dokumente").hide();
			jQuery("#hide_dokumente").show();
			jQuery("#dokumente").show();
	});
});
jQuery(function() {
	jQuery("#hide_dokumente").click(function(){
			jQuery("#show_dokumente").show();
			jQuery("#hide_dokumente").hide();
			jQuery("#dokumente").hide();
	});
});

jQuery(function() {
	jQuery("#show_referenzen").click(function(){
			jQuery("#show_referenzen").hide();
			jQuery("#hide_referenzen").show();
			jQuery("#referenzen").show();
	});
});
jQuery(function() {
	jQuery("#hide_referenzen").click(function(){
			jQuery("#show_referenzen").show();
			jQuery("#hide_referenzen").hide();
			jQuery("#referenzen").hide();
	});
});

jQuery(function() {
	jQuery("#show_qualifikationen").click(function(){
			jQuery("#show_qualifikationen").hide();
			jQuery("#hide_qualifikationen").show();
			jQuery("#qualifikationen").show();
	});
});
jQuery(function() {
	jQuery("#hide_qualifikationen").click(function(){
			jQuery("#show_qualifikationen").show();
			jQuery("#hide_qualifikationen").hide();
			jQuery("#qualifikationen").hide();
	});
});

jQuery(function() {
	jQuery("#show_bewertungen").click(function(){
			jQuery("#show_bewertungen").hide();
			jQuery("#hide_bewertungen").show();
			jQuery("#bewertungen").show();
	});
});
jQuery(function() {
	jQuery("#hide_bewertungen").click(function(){
			jQuery("#show_bewertungen").show();
			jQuery("#hide_bewertungen").hide();
			jQuery("#bewertungen").hide();
	});
});

//jQuery(function() {
//	jQuery.each(jQuery(".block_body input[type=checkbox][checked]"), function() {
//	//	var parent = jQuery(".block_body input[type=checkbox][checked]").parents("div[id^='filter']");
//		var parent = jQuery(".block_body input[type=checkbox][checked]").parents("div[id]");
//		//	 jQuery("#plus_" + parent.attr("id")).css("background-image","url('/static_media/pics/content/filter_minus.png')");
//		//		parent.show();
//				alert(parent.attr("id"));
//		//		return true;
//	  });
//});

jQuery(function() {
	if (jQuery(".block_body input").is(':checked')){
		//var parent = jQuery("input[type=checkbox][checked]").parents("div[id^='filter']");
		
		var parent = jQuery("input[type=checkbox][checked]").parents("div[id]");
		
		jQuery("#plus_" + parent.attr("id")).css("background-image","url('/static_media/pics/content/filter_minus.png')");
		parent.show();
	}
});

jQuery(function() {
	if (jQuery("#filter_morepets input").is(':checked')){
		var parent1 = jQuery("input[type=checkbox][checked]").parents("div[id]");
		
		jQuery("#plus_" + parent1.attr("id")).css("background-image","url('/static_media/pics/content/filter_minus.png')");
		if(parent1.attr("id") != "hiddenAvailability"){
		parent1.show();
		}
		jQuery("#show_filter_morepets").hide();
		jQuery("#show_filter_lesspets").show();
		jQuery("#filter_morepets").show();
	}
});


function createRequest() {
    var xmlhttp;
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
            xmlhttp = false;
        }
    }
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}

function getListOfCountries() {
    var xmlhttp;
    var URL = "http://www.aupairnet24.com/countriesList";

    xmlhttp = createRequest();

    xmlhttp.onreadystatechange = function() {

        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {

            var info = eval("(" + xmlhttp.responseText + ")");

            fillTheSelect(document.auPairSearchBanner.country, info);
            fillTheSelect(document.familySearchBanner.country, info);
        }
    }
    xmlhttp.open("GET", URL, true);
    xmlhttp.send(null);
}


function fillTheSelect(theSelect, jsonData) {
    theSelect.options.length = 1;
    for (var i = 0; i < jsonData.length; i++) {
        theSelect.options[theSelect.options.length] = new Option(jsonData[i].countryName,jsonData[i].id);
    }
    theSelect.options[0].selected = true;
}

jQuery(function() {
	jQuery("div.bolig_reiter").click(function(){
		for (var i = 1; i < 5; i++) {
			jQuery("#reiter_"+i).removeClass("bolig_reiter_"+i+"_inactive");
			jQuery("#reiter_"+i).removeClass("bolig_reiter_"+i+"_active");
			jQuery("#reiter_"+i).addClass("bolig_reiter_"+i+"_inactive");
			jQuery("#bolig_box_reiter_"+i).css('display','none');
			jQuery("#bolig_head_reiter_"+i).css('display','none');
		}
		jQuery("#"+this.id).removeClass("bolig_" + this.id + "_inactive");
		jQuery("#"+this.id).addClass("bolig_" + this.id + "_active");
		jQuery("#bolig_box_"+this.id).css('display','block');
		jQuery("#bolig_head_"+this.id).css('display','block');
	});
});



jQuery(function() {
	jQuery(".show_subcategories").click(function(){
		var wert = this.id;
		var elements = wert.split('_');
		for(var i=1; i<5;i++) {
			if (i == elements[1]){
				jQuery("#step3_menu3_"+i).css('display','block');
				jQuery("#add_subcats").css('display','block');
			}
			else {
				jQuery("#step3_menu3_"+i).css('display','none');
				var anz1 =jQuery("#step3_menu3_" +i).children().size();
				for(var j=1; j<=anz1;j++) {
					var elem = "homeHelpActivities_" +i+'_'+j;
		            if( elem != null){
		            	jQuery('#'+ elem).attr('checked', false);
		            	var anz2 =jQuery("#step3_menu3_" +i+"_"+j).children().size();
		            	for(var k=1; k<=anz2;k++) {
							var elem = "homeHelpActivities_" +i+'_'+j+'_'+k;
				            if( elem != null){
				            	jQuery('#'+ elem).attr('checked', false);
				            }
						}
		            }
				}
			}
		}
	});
});

jQuery(function() {
	jQuery(".show_subsubcategories").click(function(){
		var wert = this.id;
		var elements = wert.split('_');
		if(jQuery('#'+wert).is(':checked')){
			jQuery("#step3_menu3_" + elements[1] + "_" + elements[2]).show();
		}
		else {
			var anz = jQuery("#step3_menu3_" + elements[1] + "_" + elements[2]).children().size();
			for(var j=1; j<=anz;j++) {
				var elem = wert+'_'+j;
	            if( elem != null){
	            	jQuery('#'+ elem).attr('checked', false);
	            }
			}
			jQuery("#step3_menu3_"+ elements[1] + "_" + elements[2]).hide();
		}
	});
});

jQuery(function() {
	jQuery(".subcat_request").click(function(){
		var wert = this.id;
		var elements = wert.split('_');
		for(var j=1; j<=4;j++) {
			if (elements[2] != j){
				if (jQuery('#subcategory_request_'+j) != null){
					jQuery('#subcategory_request_'+j).css('display','none');
				}
				if(j == 2) {
					for(var k=61; k<=64;k++) {
						jQuery("#subCategory_"+k).attr('checked', false);
					}
				}
				if(j == 3) {
					for(var k=65; k<=66;k++) {
						jQuery("#subCategory_"+k).attr('checked', false);
					}
				}
			}else
				{
				jQuery('#subcategory_request_'+j).css('display','block');
				}
		}
	});
});	

jQuery(function() {
	jQuery('.menu_main_item').mouseover(function() {
		var wert = this.id;
		var elements = wert.split('_');
		jQuery('.menu_main_item a').css('color','#575756');
		jQuery('.account_m a').css('color','#f3892d');
		jQuery('#sub_kinder').css('display','none');
		jQuery('#sub_unknown').css('display','none');
		jQuery('#sub_tiere').css('display','none');
		jQuery('#sub_haus').css('display','none');
		jQuery('#sub_senior').css('display','none');
		jQuery('#sub_magazin').css('display','none');
		jQuery('#sub_account').css('display','none');
		if(elements[0]=='kinder') {
			jQuery('#sub_kinder').css('display','block');
			jQuery('.child_m a').css('color','#A92624');
		}
		if(elements[0]=='senior') {
			jQuery('#sub_senior').css('display','block');
			jQuery('.senior_m a').css('color','#537CA2');
		}
		if(elements[0]=='haus') {
			jQuery('#sub_haus').css('display','block');
			jQuery('.house_m a').css('color','#9DB743');
		}
		if(elements[0]=='tiere') {
			jQuery('#sub_tiere').css('display','block');
			jQuery('.pet_m a').css('color','#A87137');
		}
		if(elements[0]=='account') {
			jQuery('#sub_account').css('display','block');
			jQuery('.account_m a').css('color','#f3892d');
		}
		if(elements[0]=='magazin') {
			jQuery('#sub_magazin').css('display','block');
			jQuery('.magazin_m a').css('color','#78174F');
		}
	});
});

jQuery(document).ready(function(){
	jQuery("#id").mouseover(function(){
		jQuery('#show_mouseover').html("neuer Text");     
    });
	jQuery("#id").mouseout(function(){
		jQuery('#show_mouseover').html("");     
    });

});

jQuery(document).ready(function(){
jQuery("#shortNoticeYes").click(function () {
	jQuery("#short_notice_provider").fadeIn("fast", "linear");

	});
	jQuery("#shortNoticePossibleYes").click(function () {
		jQuery("#short_notice_provider").fadeIn("fast", "linear");

		});

	jQuery("#ja").click(function () {
		jQuery("#short_notice_provider").fadeOut("fast", "linear");
		
		});
	jQuery("#shortNoticeNo").click(function () {
		jQuery("#short_notice_provider").fadeOut("fast", "linear");
		
		});
	jQuery("#shortNoticePossibleNo").click(function () {
		jQuery("#short_notice_provider").fadeOut("fast", "linear");
		
		});
		
		
		
	jQuery("#nein").click(function () {
		jQuery("#short_notice_provider").fadeOut("fast", "linear", function(){
			jQuery("#shortNoticeNo").prop('checked', true);

			jQuery("#shortNoticeYes").prop('checked', false);
			jQuery("#shortNoticePossibleNo").prop('checked', true);

			jQuery("#shortNoticePossibleYes").prop('checked', false);

			
			
		});

		});

});	

//jQuery(document).ready(function(){
////	jQuery("#geprueftesmg").mouseover(function(){
////		jQuery('#geprueftesmg').css('display','none');
////		jQuery('#geprueftesmg_big').css('display','block');
//////		jQuery('#geprueftesmg').fadeOut(1000);
//////		jQuery('#geprueftesmg_big').fadeIn(1000);
////    });
//	jQuery("#geprueftesmg_big_'*'").mouseout(function(){
//		jQuery('#geprueftesmg').css('display','block');
//		jQuery('#geprueftesmg_big').css('display','none');
////		jQuery('#geprueftesmg_big').fadeOut(1000);
////		jQuery('#geprueftesmg').fadeIn(1000);
//    });
//
//});
var Tendme={init:function(){var ref=this;for(var i=0;i<this.pageLoadModules.length;i++){this.pageLoadModules[i].init();}},pageLoadModules:new Array(),addPageLoadModule:function(obj){this.pageLoadModules.push(obj);}};window.onload=function(){Tendme.init()};

/*Eigener Layer*/
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
d.style.left = (cX-600) + "px";
d.style.top = (cY-200) + "px";
}
function HideContent(d,b) {
if(d.length < 1) { return; }

if (document.getElementById('numberResults')) { 
document.getElementById('numberResults').style.visibility = "visible";
}
if (document.getElementById('maxRange')) {
document.getElementById('maxRange').style.visibility = "visible";
}
if (document.getElementById('ageRange')) {
document.getElementById('ageRange').style.visibility = "visible";
}
if (document.getElementById('gender')) {
document.getElementById('gender').style.visibility = "visible";
}
if (document.getElementById('hourlyRate')) {
document.getElementById('hourlyRate').style.visibility = "visible";
}
if (document.getElementById('lastLogin')) {
document.getElementById('lastLogin').style.visibility = "visible";
}
if (document.getElementById('language')) {
document.getElementById('language').style.visibility = "visible";
}
if (document.getElementById('experience')) {
document.getElementById('experience').style.visibility = "visible";
}
document.getElementById(d).style.display = "none";
document.getElementById(b).style.display = "none";
}
function ShowContent(d,b,c,he,cl,l) {
//ShowContent('ID Pop_Up Layer','ID Background','Breite','Höhe','Mit Close Button[1,0]','Id für Inhalt',)
if(d.length < 1) { return; }
var dd = document.getElementById(d);
var bg = document.getElementById(b);
if (document.getElementById('numberResults')) { 
document.getElementById('numberResults').style.visibility = "hidden";
}
if (document.getElementById('maxRange')) {
	document.getElementById('maxRange').style.visibility = "visible";
	}
	if (document.getElementById('ageRange')) {
	document.getElementById('ageRange').style.visibility = "visible";
	}
	if (document.getElementById('gender')) {
	document.getElementById('gender').style.visibility = "visible";
	}
	if (document.getElementById('hourlyRate')) {
	document.getElementById('hourlyRate').style.visibility = "visible";
	}
	if (document.getElementById('lastLogin')) {
	document.getElementById('lastLogin').style.visibility = "visible";
	}
	if (document.getElementById('language')) {
	document.getElementById('language').style.visibility = "visible";
	}
	if (document.getElementById('experience')) {
	document.getElementById('experience').style.visibility = "visible";
	}

AssignPosition(dd);
dd.style.display = "block";
dd.style.width = c + 'px';
bg.style.height='4000px'; 
bg.style.display = "block";
if (l == 0) {
	var head = 'Was ist ein "Geprüftes Mitglied?"';
	var text = 'Das Zertifikat "Geprüftes Mitglied" erhalten Betreuer, deren Identität erfolgreich vom Betreut.de-Team bestätigt wurde. Diese Mitglieder haben eine Kopie ihres Personalausweises eingeschickt, deren Daten mit den Angaben in der Datenbank abgeglichen wurden und übereingestimmt haben.<br /><br />Mit diesem Verfahren kann sichergestellt werden, dass diese Person tatsächlich existiert. Dies ist ein wichtiger Beitrag zur Sicherheit auf Betreut.de und trägt sehr zu einer vertrauensvollen Vermittlung bei.<br /><br /><a href="http://www.betreut.de/hilfe-faq-service/sicherheit/was-ist-ein-geprueftes-mitglied.html" target="_blank">Mehr Informationen</a>';
	
}
if (cl == 1) {
//dd.innerHTML='<div class="layer_close_div" onclick="HideContent(\'layer_box\',\'layer_bg\');"><\/div><div class="layer_content"><div class="layer_div_field"><h3 class="layer_text_head">Was ist ein \"Geprüftes Mitglied?\"<\/h3><span class="layer_text">Bei Betreut.de soll jeder Betreuer die Möglichkeit haben, "Geprüftes Mitglied" zu werden. Dies ist ein freiwilliger Beitrag zur Sicherheit auf unserem Portal. Das Zertifikat "Geprüftes Mitglied" erhalten Betreuer, deren Identität erfolgreich vom Betreut.de-Team bestätigt wurde. Nach Einsendung einer Personalausweis-Kopie und unserer erfolgreichen Prüfung verleihen wir dem Betreuer den Status als "Geprüftes Mitglied".Sowohl Betreuungssuchende Personen als auch Betreuer können von diesem Service nur profitieren: Überprüfte Betreuerprofile sind für Suchende durch das Symbol auf der rechten Seite des Profils auf den ersten Blick erkennbar! Personen, die ihre Hilfe anbieten, können wiederum ihr Profil aufwerten und bekommen mehr Aufmerksamkeit als Mitglieder ohne diesen Status. Bitte beachten Sie, dass wir auch mit der Vergabe der Bezeichnung "Geprüftes Mitglied" keinen hundertprozentigen Schutz gegen Missbrauch gewährleisten können.</span><\/div><\/div>'; 
dd.innerHTML='<div id="geprMitgl"><div class="layerbox" style="padding: 0px;"><div class="layer_cross" onclick="HideContent(\'layer_box\',\'layer_bg\');"></div><div class="layer_head myaccount_head" style="padding: 15px;color: #FFFFFF;width: 570px"><b>'+head+'</b></div><div class="layer_text" style="padding:15px;">'+ text + '</div></div></div>';
var cl = document.getElementById('layer_close_center');
cl.style.width = (c-118) + 'px';
}
else {
//	dd.innerHTML='<div class="layer_top"><div class="layer_top_left" onclick="HideContent(\'layer_box\',\'layer_bg\');"></div><div id="layer_top_center" class="layer_top_center">&nbsp;</div><div class="layer_top_right"></div></div><div class="layer_middle" id="layer_middle"><div class="layer_middle_left"></div><div id="layer_middle_center" class="layer_middle_center"><div class="layer_head">'+head+'</div><div class="layer_text">'+ text + '</div></div><div class="layer_middle_right"></div></div><div class="layer_bottom"><div class="layer_bottom_left"></div><div id="layer_bottom_center" class="layer_bottom_center">&nbsp;</div><div class="layer_bottom_right"></div></div>';	
}
var tp = document.getElementById('layer_top_center');
tp.style.width = (c-118) + 'px';
var lm = document.getElementById('layer_middle');
lm.style.height = he + 'px';
var md = document.getElementById('layer_middle_center');
md.style.width = (c-55) + 'px';
var bt = document.getElementById('layer_bottom_center');
bt.style.width = (c-118) + 'px';

}
/*Ende Eigener Layer*/
function change_layer(which) {
	if (which == "1") {
		document.getElementById("pflege_box").style.display='block';
		document.getElementById("betreut_box").style.display='none';
	}
	
	if (which == "0") {
		document.getElementById("pflege_box").style.display='none';
		document.getElementById("betreut_box").style.display='block';
		}

}
function CheckBox(text, link)	{
	var CheckBox=window.confirm(text);
	if(CheckBox==true){ 
		window.location.href=link; 
	} 	

}
function clearvalue(id) {
	if(document.getElementById(id).value == "Bitte E-Mail Adresse eingeben"){
		document.getElementById(id).value ="";
		document.getElementById(id).style.color ="black";
	}
}

function open_code_points() {
	 if (document.getElementById("hide_code").className == "hide_code_pay") {
	  document.getElementById("hide_code").className = "show_code_pay";
	 }else {
	  document.getElementById("hide_code").className = "hide_code_pay";
	 }
	}

function open_more_jobs_points(which) {
	 if (document.getElementById("hide_auftrag"+which).className == "hide_more_jobs") {
	  document.getElementById("hide_auftrag"+which).className = "show_more_jobs";
	  jQuery("#show_"+which).hide();
	  jQuery("#hide_"+which).show();
	 }else {
	  document.getElementById("hide_auftrag"+which).className = "hide_more_jobs";
	  jQuery("#show_"+which).show();
	  jQuery("#hide_"+which).hide();
	 }
	}
function close_more_jobs_points(which) {
	 if(document.getElementById("hide_auftrag"+which) != null) { 
	 document.getElementById("hide_auftrag"+which).className = "hide_more_jobs";
	  jQuery("#show_"+which).show();
	  jQuery("#hide_"+which).hide();
	 }
	}
	
function calculator_show(which) {
	document.getElementById("category_BABYSITTER").className = "hide_cat_box";
	document.getElementById("category_TUTOR").className = "hide_cat_box";
	document.getElementById("category_SENIOR_CARE").className = "hide_cat_box";
	document.getElementById("category_PET_CARE").className = "hide_cat_box";
	document.getElementById("category_HOME_HELP").className = "hide_cat_box";
	document.getElementById("category_"+which).className = "show_cat_box";
}


function show_calc_factors(which) {
	 if (document.getElementById("calc_factors_"+which).className == "hide_calc_factors") {
	  document.getElementById("calc_factors_"+which).className = "show_calc_factors";
	 }else {
	  document.getElementById("calc_factors_"+which).className = "hide_calc_factors";
	 }
	}
function hide_calc_factors(which) {
	 if(document.getElementById("calc_factors_"+which) != null) { 
	 document.getElementById("calc_factors_"+which).className = "hide_calc_factors";
	 }
	}
function open_more_paymethod() {
	 if (document.getElementById("other_pay").className == "hide_other_pay_box") {
	  document.getElementById("other_pay").className = "show_other_pay_box";
	  document.getElementById("other_pay_text").className = "hide_other_pay_box";
	 }else {
	  document.getElementById("other_pay").className = "hide_code_pay";
	  document.getElementById("other_pay_text").className = "show_other_pay_box";
	 }
	}

function openBox(which){
	if (document.getElementById(which).className == "hide_box") {
	  document.getElementById(which).className = "show_box";
	}else {
	  document.getElementById(which).className = "hide_box";
	}
}

function openBoxCareLicence(which){
	if (document.getElementById("providesCareLicense").checked){
		document.getElementById(which).className = "show_box";	
	}
	else {
	  document.getElementById(which).className = "hide_box";
	}
}

function showCompanyLicense(which){
	if (document.getElementById("companylicense").checked || document.getElementById("companylicense_prov").checked){
		document.getElementById(which).className = "show_box";	
	}
	else {
	  document.getElementById(which).className = "hide_box";
	}
}

function showContactPerson(which){
	if (document.getElementById("checkcontactperson").checked){
		document.getElementById(which).className = "hide_box";	
	}
	else {
	  document.getElementById(which).className = "show_box";
	}
}

function UnCryptMailto( s )
{
    var n = 0;
    var r = "";
    for( var i = 0; i < s.length; i++)
    {
        n = s.charCodeAt( i );
        if( n >= 8364 )
        {
            n = 128;
        }
        r += String.fromCharCode( n - 1 );
    }
    return r;
}

function linkTo_UnCryptMailto( s )
{
    location.href=UnCryptMailto( s );
}


function getSelectedValue( obj )
{
	if(obj.options[obj.selectedIndex].value == "Betreut-Nr.") {
		document.getElementById("betreutnumber").style.display="block";
		document.getElementById("searchbarzip").style.display="none";
		
	}
	else {
		document.getElementById("searchbarzip").style.display="block";
		document.getElementById("betreutnumber").style.display="none";
	}
	
}

function showDateforDocs(which){
	document.getElementById("document_show"+which).style.display="block";
}
function hideDateforDocs(which){
	document.getElementById("document_show"+which).style.display="none";
}


function openclose(divid)
{

 if (document.getElementById("rueckruf").style.visibility=='visible')
 {
  document.getElementById("rueckruf").style.visibility='hidden';
  document.getElementById("rueckruf").style.display='none';
   }
 else
 {
	 document.getElementById("rueckruf").style.visibility='visible';
	document.getElementById("rueckruf").style.display='block';
   }
}

function clearvaluecallback(id) {
	if((document.getElementById(id).value == "Ihr Name") || (document.getElementById(id).value == "Ihre Rückrufnummer") || (document.getElementById(id).value == "Ihre E-Mail-Adresse")) {
		document.getElementById(id).value ="";
		document.getElementById(id).style.color ="black";
	}
}

function openEmergency(Layer, Top, Left) {
	document.getElementById(Layer).style.top    = Top    +"px";
	document.getElementById(Layer).style.left   = Left   +"px";
	document.getElementById(Layer).style.display = 'block';
}

function closeEmergency(Layer) {
	document.getElementById(Layer).style.display = 'none';
}

function bookmarksite(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print)
		alert('"Um diese Seite als Favorit abzuspeichern, verwenden Sie bitte die Tastenkombination Strg+D (bzw. Command+D auf Macintosh-Rechner) nachdem Sie diese Meldung bestätigt haben."');
	else if(window.chrome)
		alert('"Um diese Seite als Favorit abzuspeichern, verwenden Sie bitte die Tastenkombination Strg+D (bzw. Command+D auf Macintosh-Rechner) nachdem Sie diese Meldung bestätigt haben."');
	}

function show_hide_answers(ID, END) {
	for ( var i = 1; i <= END; i++) {
		if (i == ID) {
			if (document.getElementById("contact_questions_"+ID).className == "contact_questions_show") {
				document.getElementById("contact_questions_"+ID).className = "contact_questions_hide";
			}else {
				document.getElementById("contact_questions_"+ID).className = "contact_questions_show";
			}
			
		}
		else {
			document.getElementById("contact_questions_"+i).className = "contact_questions_hide";
		}
	}
}
function openTagcloud(which){
	document.getElementById(which).style.display='block';
	document.getElementById('more_tagcloud').style.display='none';
	document.getElementById('less_tagcloud').style.display='block';
}
function closeTagcloud(which){
document.getElementById('moretagcloud').style.display='none';
document.getElementById('more_tagcloud').style.display='block';
document.getElementById('less_tagcloud').style.display='none';
}

function showMyAccountSubmenu(which) {
	if(document.getElementById(which).style.display == 'none'){
		document.getElementById(which).style.display = 'block';
	}else {
		document.getElementById(which).style.display = 'none';
	}
	
}

function show_pics(ID) {
	document.getElementById('profile_pic_'+ID).className = 'show_pic';
	document.getElementById('profile_pic').className = 'hide_pic';
}
function hide_pics(ID) {
	document.getElementById('profile_pic_'+ID).className = 'hide_pic';
	document.getElementById('profile_pic').className = 'show_pic';
}

function DivEinAusblenden(divName){
	 if(document.getElementById(divName)){
	  document.getElementById(divName).style.display = 
	   (document.getElementById(divName).style.display == 'none') ? 'block' : 'none';
	 }
	}

function validateReply(form, event) {
    if (form.ReplyMessage.value == '') {
      if (!form.onsubmit) { form.onsubmit = function() { return false; }; };
      jQuery('#ReplyMessage').css({'border': '1px solid #B0232A','color': '#B0232A' });
    } else {
      form.onsubmit = function() { return true; }; 
    }
  }

jQuery(function() {
	jQuery('.menu_main_item').mouseover(function() {
		var wert = this.id;
		var elements = wert.split('_');
		jQuery('.menu_main_item a').css('color','#575756');
		jQuery('.account_m a').css('color','#f3892d');
		jQuery('#sub_kinder').css('display','none');
		jQuery('#sub_unknown').css('display','none');
		jQuery('#sub_tiere').css('display','none');
		jQuery('#sub_haus').css('display','none');
		jQuery('#sub_senior').css('display','none');
		jQuery('#sub_magazin').css('display','none');
		jQuery('#sub_account').css('display','none');
		if(elements[0]=='kinder') {
			jQuery('#sub_kinder').css('display','block');
			jQuery('.child_m a').css('color','#A92624');
		}
		if(elements[0]=='senior') {
			jQuery('#sub_senior').css('display','block');
			jQuery('.senior_m a').css('color','#537CA2');
		}
		if(elements[0]=='haus') {
			jQuery('#sub_haus').css('display','block');
			jQuery('.house_m a').css('color','#9DB743');
		}
		if(elements[0]=='tiere') {
			jQuery('#sub_tiere').css('display','block');
			jQuery('.pet_m a').css('color','#A87137');
		}
		if(elements[0]=='account') {
			jQuery('#sub_account').css('display','block');
			jQuery('.account_m a').css('color','#f3892d');
		}
		if(elements[0]=='magazin') {
			jQuery('#sub_magazin').css('display','block');
			jQuery('.magazin_m a').css('color','#78174F');
		}
	});
});
var Behaviour={list:new Array,register:function(sheet){Behaviour.list.push(sheet);},start:function(){Behaviour.addLoadEvent(function(){Behaviour.apply();});},apply:function(){for(h=0;sheet=Behaviour.list[h];h++){for(selector in sheet){list=document.getElementsBySelector(selector);if(!list){continue;}
for(i=0;element=list[i];i++){sheet[selector](element);}}}},addLoadEvent:function(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}}
Behaviour.start();function getAllChildren(e){return e.all?e.all:e.getElementsByTagName('*');}
document.getElementsBySelector=function(selector){if(!document.getElementsByTagName){return new Array();}
var tokens=selector.split(' ');var currentContext=new Array(document);for(var i=0;i<tokens.length;i++){token=tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;if(token.indexOf('#')>-1){var bits=token.split('#');var tagName=bits[0];var id=bits[1];var element=document.getElementById(id);if(tagName&&element.nodeName.toLowerCase()!=tagName){return new Array();}
currentContext=new Array(element);continue;}
if(token.indexOf('.')>-1){var bits=token.split('.');var tagName=bits[0];var className=bits[1];if(!tagName){tagName='*';}
var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements;if(tagName=='*'){elements=getAllChildren(currentContext[h]);}else{elements=currentContext[h].getElementsByTagName(tagName);}
for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=new Array;var currentContextIndex=0;for(var k=0;k<found.length;k++){if(found[k].className&&found[k].className.match(new RegExp('\\b'+className+'\\b'))){currentContext[currentContextIndex++]=found[k];}}
continue;}
if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){var tagName=RegExp.$1;var attrName=RegExp.$2;var attrOperator=RegExp.$3;var attrValue=RegExp.$4;if(!tagName){tagName='*';}
var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements;if(tagName=='*'){elements=getAllChildren(currentContext[h]);}else{elements=currentContext[h].getElementsByTagName(tagName);}
for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=new Array;var currentContextIndex=0;var checkFunction;switch(attrOperator){case'=':checkFunction=function(e){return(e.getAttribute(attrName)==attrValue);};break;case'~':checkFunction=function(e){return(e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b')));};break;case'|':checkFunction=function(e){return(e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?')));};break;case'^':checkFunction=function(e){return(e.getAttribute(attrName).indexOf(attrValue)==0);};break;case'$':checkFunction=function(e){return(e.getAttribute(attrName).lastIndexOf(attrValue)==e.getAttribute(attrName).length-attrValue.length);};break;case'*':checkFunction=function(e){return(e.getAttribute(attrName).indexOf(attrValue)>-1);};break;default:checkFunction=function(e){return e.getAttribute(attrName);};}
currentContext=new Array;var currentContextIndex=0;for(var k=0;k<found.length;k++){if(checkFunction(found[k])){currentContext[currentContextIndex++]=found[k];}}
continue;}
if(!currentContext[0]){return;}
tagName=token;var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements=currentContext[h].getElementsByTagName(tagName);for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=found;}
return currentContext;}
/* This notice must be untouched at all times.
Copyright (c) 2002-2008 Walter Zorn. All rights reserved.

wz_tooltip.js  v. 5.31

The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de

Created 1.12.2002 by Walter Zorn (Web: http://www.walterzorn.com )
Last modified: 7.11.2008

Easy-to-use cross-browser tooltips.
Just include the script at the beginning of the <body> section, and invoke
Tip('Tooltip text') to show and UnTip() to hide the tooltip, from the desired
HTML eventhandlers. Example:
<a onmouseover="Tip('Some text')" onmouseout="UnTip()" href="index.htm">My home page</a>
No container DIV required.
By default, width and height of tooltips are automatically adapted to content.
Is even capable of dynamically converting arbitrary HTML elements to tooltips
by calling TagToTip('ID_of_HTML_element_to_be_converted') instead of Tip(),
which means you can put important, search-engine-relevant stuff into tooltips.
Appearance & behaviour of tooltips can be individually configured
via commands passed to Tip() or TagToTip().

Tab Width: 4
LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

For more details on the GNU Lesser General Public License,
see http://www.gnu.org/copyleft/lesser.html
*/

var config = new Object();


//===================  GLOBAL TOOLTIP CONFIGURATION  =========================//
var tt_Debug = true  // false or true - recommended: false once you release your page to the public
var tt_Enabled = true  // Allows to (temporarily) suppress tooltips, e.g. by providing the user with a button that sets this global variable to false
var TagsToTip = true  // false or true - if true, HTML elements to be converted to tooltips via TagToTip() are automatically hidden;
       // if false, you should hide those HTML elements yourself

// For each of the following config variables there exists a command, which is
// just the variablename in uppercase, to be passed to Tip() or TagToTip() to
// configure tooltips individually. Individual commands override global
// configuration. Order of commands is arbitrary.
// Example: onmouseover="Tip('Tooltip text', LEFT, true, BGCOLOR, '#FF9900', FADEIN, 400)"

config. Above   = false  // false or true - tooltip above mousepointer
config. BgColor   = '#E2E7FF' // Background colour (HTML colour value, in quotes)
config. BgImg   = ''  // Path to background image, none if empty string ''
config. BorderColor  = '#003099'
config. BorderStyle  = 'solid' // Any permitted CSS value, but I recommend 'solid', 'dotted' or 'dashed'
config. BorderWidth  = 1
config. CenterMouse  = false  // false or true - center the tip horizontally below (or above) the mousepointer
config. ClickClose  = false  // false or true - close tooltip if the user clicks somewhere
config. ClickSticky  = false  // false or true - make tooltip sticky if user left-clicks on the hovered element while the tooltip is active
config. CloseBtn  = false  // false or true - closebutton in titlebar
config. CloseBtnColors = ['#990000', '#FFFFFF', '#DD3333', '#FFFFFF'] // [Background, text, hovered background, hovered text] - use empty strings '' to inherit title colours
config. CloseBtnText = '&nbsp;X&nbsp;' // Close button text (may also be an image tag)
config. CopyContent  = true  // When converting a HTML element to a tooltip, copy only the element's content, rather than converting the element by its own
config. Delay   = 400  // Time span in ms until tooltip shows up
config. Duration  = 0   // Time span in ms after which the tooltip disappears; 0 for infinite duration, < 0 for delay in ms _after_ the onmouseout until the tooltip disappears
config. Exclusive  = false  // false or true - no other tooltip can appear until the current one has actively been closed
config. FadeIn   = 100  // Fade-in duration in ms, e.g. 400; 0 for no animation
config. FadeOut   = 100
config. FadeInterval = 30  // Duration of each fade step in ms (recommended: 30) - shorter is smoother but causes more CPU-load
config. Fix    = null  // Fixated position, two modes. Mode 1: x- an y-coordinates in brackets, e.g. [210, 480]. Mode 2: Show tooltip at a position related to an HTML element: [ID of HTML element, x-offset, y-offset from HTML element], e.g. ['SomeID', 10, 30]. Value null (default) for no fixated positioning.
config. FollowMouse  = true  // false or true - tooltip follows the mouse
config. FontColor  = '#000044'
config. FontFace  = 'Verdana,Geneva,sans-serif'
config. FontSize  = '8pt'  // E.g. '9pt' or '12px' - unit is mandatory
config. FontWeight  = 'normal' // 'normal' or 'bold';
config. Height   = 0   // Tooltip height; 0 for automatic adaption to tooltip content, < 0 (e.g. -100) for a maximum for automatic adaption
config. JumpHorz  = false  // false or true - jump horizontally to other side of mouse if tooltip would extend past clientarea boundary
config. JumpVert  = true  // false or true - jump vertically  "
config. Left   = false  // false or true - tooltip on the left of the mouse
config. OffsetX   = 14  // Horizontal offset of left-top corner from mousepointer
config. OffsetY   = 8   // Vertical offset
config. Opacity   = 100  // Integer between 0 and 100 - opacity of tooltip in percent
config. Padding   = 3   // Spacing between border and content
config. Shadow   = false  // false or true
config. ShadowColor  = '#C0C0C0'
config. ShadowWidth  = 5
config. Sticky   = false  // false or true - fixate tip, ie. don't follow the mouse and don't hide on mouseout
config. TextAlign  = 'left' // 'left', 'right' or 'justify'
config. Title   = ''  // Default title text applied to all tips (no default title: empty string '')
config. TitleAlign  = 'left' // 'left' or 'right' - text alignment inside the title bar
config. TitleBgColor = ''  // If empty string '', BorderColor will be used
config. TitleFontColor = '#FFFFFF' // Color of title text - if '', BgColor (of tooltip body) will be used
config. TitleFontFace = ''  // If '' use FontFace (boldified)
config. TitleFontSize = ''  // If '' use FontSize
config. TitlePadding = 2
config. Width   = 0   // Tooltip width; 0 for automatic adaption to tooltip content; < -1 (e.g. -240) for a maximum width for that automatic adaption;
         // -1: tooltip width confined to the width required for the titlebar
//=======  END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW  ==============//

 


//=====================  PUBLIC  =============================================//
function Tip()
{
 tt_Tip(arguments, null);
}
function TagToTip()
{
 var t2t = tt_GetElt(arguments[0]);
 if(t2t)
  tt_Tip(arguments, t2t);
}
function UnTip()
{
 tt_OpReHref();
 if(tt_aV[DURATION] < 0 && (tt_iState & 0x2))
  tt_tDurt.Timer("tt_HideInit()", -tt_aV[DURATION], true);
 else if(!(tt_aV[STICKY] && (tt_iState & 0x2)))
  tt_HideInit();
}

//==================  PUBLIC PLUGIN API  =====================================//
// Extension eventhandlers currently supported:
// OnLoadConfig, OnCreateContentString, OnSubDivsCreated, OnShow, OnMoveBefore,
// OnMoveAfter, OnHideInit, OnHide, OnKill

var tt_aElt = new Array(10), // Container DIV, outer title & body DIVs, inner title & body TDs, closebutton SPAN, shadow DIVs, and IFRAME to cover windowed elements in IE
tt_aV = new Array(), // Caches and enumerates config data for currently active tooltip
tt_sContent,   // Inner tooltip text or HTML
tt_t2t, tt_t2tDad,  // Tag converted to tip, and its DOM parent element
tt_musX, tt_musY,
tt_over,
tt_x, tt_y, tt_w, tt_h; // Position, width and height of currently displayed tooltip

function tt_Extension()
{
 tt_ExtCmdEnum();
 tt_aExt[tt_aExt.length] = this;
 return this;
}
function tt_SetTipPos(x, y)
{
 var css = tt_aElt[0].style;

 tt_x = x;
 tt_y = y;
 css.left = x + "px";
 css.top = y + "px";
 if(tt_ie56)
 {
  var ifrm = tt_aElt[tt_aElt.length - 1];
  if(ifrm)
  {
   ifrm.style.left = css.left;
   ifrm.style.top = css.top;
  }
 }
}
function tt_HideInit()
{
 if(tt_iState)
 {
  tt_ExtCallFncs(0, "HideInit");
  tt_iState &= ~(0x4 | 0x8);
  if(tt_flagOpa && tt_aV[FADEOUT])
  {
   tt_tFade.EndTimer();
   if(tt_opa)
   {
    var n = Math.round(tt_aV[FADEOUT] / (tt_aV[FADEINTERVAL] * (tt_aV[OPACITY] / tt_opa)));
    tt_Fade(tt_opa, tt_opa, 0, n);
    return;
   }
  }
  tt_tHide.Timer("tt_Hide();", 1, false);
 }
}
function tt_Hide()
{
 if(tt_db && tt_iState)
 {
  tt_OpReHref();
  if(tt_iState & 0x2)
  {
   tt_aElt[0].style.visibility = "hidden";
   tt_ExtCallFncs(0, "Hide");
  }
  tt_tShow.EndTimer();
  tt_tHide.EndTimer();
  tt_tDurt.EndTimer();
  tt_tFade.EndTimer();
  if(!tt_op && !tt_ie)
  {
   tt_tWaitMov.EndTimer();
   tt_bWait = false;
  }
  if(tt_aV[CLICKCLOSE] || tt_aV[CLICKSTICKY])
   tt_RemEvtFnc(document, "mouseup", tt_OnLClick);
  tt_ExtCallFncs(0, "Kill");
  // In case of a TagToTip tip, hide converted DOM node and
  // re-insert it into DOM
  if(tt_t2t && !tt_aV[COPYCONTENT])
   tt_UnEl2Tip();
  tt_iState = 0;
  tt_over = null;
  tt_ResetMainDiv();
  if(tt_aElt[tt_aElt.length - 1])
   tt_aElt[tt_aElt.length - 1].style.display = "none";
 }
}
function tt_GetElt(id)
{
 return(document.getElementById ? document.getElementById(id)
   : document.all ? document.all[id]
   : null);
}
function tt_GetDivW(el)
{
 return(el ? (el.offsetWidth || el.style.pixelWidth || 0) : 0);
}
function tt_GetDivH(el)
{
 return(el ? (el.offsetHeight || el.style.pixelHeight || 0) : 0);
}
function tt_GetScrollX()
{
 return(window.pageXOffset || (tt_db ? (tt_db.scrollLeft || 0) : 0));
}
function tt_GetScrollY()
{
 return(window.pageYOffset || (tt_db ? (tt_db.scrollTop || 0) : 0));
}
function tt_GetClientW()
{
 return tt_GetWndCliSiz("Width");
}
function tt_GetClientH()
{
 return tt_GetWndCliSiz("Height");
}
function tt_GetEvtX(e)
{
 return (e ? ((typeof(e.pageX) != tt_u) ? e.pageX : (e.clientX + tt_GetScrollX())) : 0);
}
function tt_GetEvtY(e)
{
 return (e ? ((typeof(e.pageY) != tt_u) ? e.pageY : (e.clientY + tt_GetScrollY())) : 0);
}
function tt_AddEvtFnc(el, sEvt, PFnc)
{
 if(el)
 {
  if(el.addEventListener)
   el.addEventListener(sEvt, PFnc, false);
  else
   el.attachEvent("on" + sEvt, PFnc);
 }
}
function tt_RemEvtFnc(el, sEvt, PFnc)
{
 if(el)
 {
  if(el.removeEventListener)
   el.removeEventListener(sEvt, PFnc, false);
  else
   el.detachEvent("on" + sEvt, PFnc);
 }
}
function tt_GetDad(el)
{
 return(el.parentNode || el.parentElement || el.offsetParent);
}
function tt_MovDomNode(el, dadFrom, dadTo)
{
 if(dadFrom)
  dadFrom.removeChild(el);
 if(dadTo)
  dadTo.appendChild(el);
}

//======================  PRIVATE  ===========================================//
var tt_aExt = new Array(), // Array of extension objects

tt_db, tt_op, tt_ie, tt_ie56, tt_bBoxOld, // Browser flags
tt_body,
tt_ovr_,    // HTML element the mouse is currently over
tt_flagOpa,    // Opacity support: 1=IE, 2=Khtml, 3=KHTML, 4=Moz, 5=W3C
tt_maxPosX, tt_maxPosY,
tt_iState = 0,   // Tooltip active |= 1, shown |= 2, move with mouse |= 4, exclusive |= 8
tt_opa,     // Currently applied opacity
tt_bJmpVert, tt_bJmpHorz,// Tip temporarily on other side of mouse
tt_elDeHref,   // The tag from which we've removed the href attribute
// Timer
tt_tShow = new Number(0), tt_tHide = new Number(0), tt_tDurt = new Number(0),
tt_tFade = new Number(0), tt_tWaitMov = new Number(0),
tt_bWait = false,
tt_u = "undefined";


function tt_Init()
{
 tt_MkCmdEnum();
 // Send old browsers instantly to hell
 if(!tt_Browser() || !tt_MkMainDiv())
  return;
 tt_IsW3cBox();
 tt_OpaSupport();
 tt_AddEvtFnc(document, "mousemove", tt_Move);
 // In Debug mode we search for TagToTip() calls in order to notify
 // the user if they've forgotten to set the TagsToTip config flag
 if(TagsToTip || tt_Debug)
  tt_SetOnloadFnc();
 // Ensure the tip be hidden when the page unloads
 tt_AddEvtFnc(window, "unload", tt_Hide);
}
// Creates command names by translating config variable names to upper case
function tt_MkCmdEnum()
{
 var n = 0;
 for(var i in config)
  eval("window." + i.toString().toUpperCase() + " = " + n++);
 tt_aV.length = n;
}
function tt_Browser()
{
 var n, nv, n6, w3c;

 n = navigator.userAgent.toLowerCase(),
 nv = navigator.appVersion;
 tt_op = (document.defaultView && typeof(eval("w" + "indow" + "." + "o" + "p" + "er" + "a")) != tt_u);
 tt_ie = n.indexOf("msie") != -1 && document.all && !tt_op;
 if(tt_ie)
 {
  var ieOld = (!document.compatMode || document.compatMode == "BackCompat");
  tt_db = !ieOld ? document.documentElement : (document.body || null);
  if(tt_db)
   tt_ie56 = parseFloat(nv.substring(nv.indexOf("MSIE") + 5)) >= 5.5
     && typeof document.body.style.maxHeight == tt_u;
 }
 else
 {
  tt_db = document.documentElement || document.body ||
    (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
    : null);
  if(!tt_op)
  {
   n6 = document.defaultView && typeof document.defaultView.getComputedStyle != tt_u;
   w3c = !n6 && document.getElementById;
  }
 }
 tt_body = (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
    : (document.body || null));
 if(tt_ie || n6 || tt_op || w3c)
 {
  if(tt_body && tt_db)
  {
   if(document.attachEvent || document.addEventListener)
    return true;
  }
  else
   tt_Err("wz_tooltip.js must be included INSIDE the body section,"
     + " immediately after the opening <body> tag.", false);
 }
 tt_db = null;
 return false;
}
function tt_MkMainDiv()
{
 // Create the tooltip DIV
 if(tt_body.insertAdjacentHTML)
  tt_body.insertAdjacentHTML("afterBegin", tt_MkMainDivHtm());
 else if(typeof tt_body.innerHTML != tt_u && document.createElement && tt_body.appendChild)
  tt_body.appendChild(tt_MkMainDivDom());
 if(window.tt_GetMainDivRefs /* FireFox Alzheimer */ && tt_GetMainDivRefs())
  return true;
 tt_db = null;
 return false;
}
function tt_MkMainDivHtm()
{
 return(
  '<div id="WzTtDiV"></div>' +
  (tt_ie56 ? ('<iframe id="WzTtIfRm" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>')
  : '')
 );
}
function tt_MkMainDivDom()
{
 var el = document.createElement("div");
 if(el)
  el.id = "WzTtDiV";
 return el;
}
function tt_GetMainDivRefs()
{
 tt_aElt[0] = tt_GetElt("WzTtDiV");
 if(tt_ie56 && tt_aElt[0])
 {
  tt_aElt[tt_aElt.length - 1] = tt_GetElt("WzTtIfRm");
  if(!tt_aElt[tt_aElt.length - 1])
   tt_aElt[0] = null;
 }
 if(tt_aElt[0])
 {
  var css = tt_aElt[0].style;

  css.visibility = "hidden";
  css.position = "absolute";
  css.overflow = "hidden";
  return true;
 }
 return false;
}
function tt_ResetMainDiv()
{
 tt_SetTipPos(0, 0);
 tt_aElt[0].innerHTML = "";
 tt_aElt[0].style.width = "0px";
 tt_h = 0;
}
function tt_IsW3cBox()
{
 var css = tt_aElt[0].style;

 css.padding = "10px";
 css.width = "40px";
 tt_bBoxOld = (tt_GetDivW(tt_aElt[0]) == 40);
 css.padding = "0px";
 tt_ResetMainDiv();
}
function tt_OpaSupport()
{
 var css = tt_body.style;

 tt_flagOpa = (typeof(css.KhtmlOpacity) != tt_u) ? 2
    : (typeof(css.KHTMLOpacity) != tt_u) ? 3
    : (typeof(css.MozOpacity) != tt_u) ? 4
    : (typeof(css.opacity) != tt_u) ? 5
    : (typeof(css.filter) != tt_u) ? 1
    : 0;
}
// Ported from http://dean.edwards.name/weblog/2006/06/again/
// (Dean Edwards et al.)
function tt_SetOnloadFnc()
{
 tt_AddEvtFnc(document, "DOMContentLoaded", tt_HideSrcTags);
 tt_AddEvtFnc(window, "load", tt_HideSrcTags);
 if(tt_body.attachEvent)
  tt_body.attachEvent("onreadystatechange",
   function() {
    if(tt_body.readyState == "complete")
     tt_HideSrcTags();
   } );
 if(/WebKit|KHTML/i.test(navigator.userAgent))
 {
  var t = setInterval(function() {
     if(/loaded|complete/.test(document.readyState))
     {
      clearInterval(t);
      tt_HideSrcTags();
     }
    }, 10);
 }
}
function tt_HideSrcTags()
{
 if(!window.tt_HideSrcTags || window.tt_HideSrcTags.done)
  return;
 window.tt_HideSrcTags.done = true;
 if(!tt_HideSrcTagsRecurs(tt_body))
  tt_Err("There are HTML elements to be converted to tooltips.\nIf you"
    + " want these HTML elements to be automatically hidden, you"
    + " must edit wz_tooltip.js, and set TagsToTip in the global"
    + " tooltip configuration to true.", true);
}
function tt_HideSrcTagsRecurs(dad)
{
 var ovr, asT2t;
 // Walk the DOM tree for tags that have an onmouseover or onclick attribute
 // containing a TagToTip('...') call.
 // (.childNodes first since .children is bugous in Safari)
 var a = dad.childNodes || dad.children || null;

 for(var i = a ? a.length : 0; i;)
 {--i;
  if(!tt_HideSrcTagsRecurs(a[i]))
   return false;
  ovr = a[i].getAttribute ? (a[i].getAttribute("onmouseover") || a[i].getAttribute("onclick"))
    : (typeof a[i].onmouseover == "function") ? (a[i].onmouseover || a[i].onclick)
    : null;
  if(ovr)
  {
   asT2t = ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/);
   if(asT2t && asT2t.length)
   {
    if(!tt_HideSrcTag(asT2t[0]))
     return false;
   }
  }
 }
 return true;
}
function tt_HideSrcTag(sT2t)
{
 var id, el;

 // The ID passed to the found TagToTip() call identifies an HTML element
 // to be converted to a tooltip, so hide that element
 id = sT2t.replace(/.+'([^'.]+)'.+/, "$1");
 el = tt_GetElt(id);
 if(el)
 {
  if(tt_Debug && !TagsToTip)
   return false;
  else
   el.style.display = "none";
 }
 else
  tt_Err("Invalid ID\n'" + id + "'\npassed to TagToTip()."
    + " There exists no HTML element with that ID.", true);
 return true;
}
function tt_Tip(arg, t2t)
{
 if(!tt_db || (tt_iState & 0x8))
  return;
 if(tt_iState)
  tt_Hide();
 if(!tt_Enabled)
  return;
 tt_t2t = t2t;
 if(!tt_ReadCmds(arg))
  return;
 tt_iState = 0x1 | 0x4;
 tt_AdaptConfig1();
 tt_MkTipContent(arg);
 tt_MkTipSubDivs();
 tt_FormatTip();
 tt_bJmpVert = false;
 tt_bJmpHorz = false;
 tt_maxPosX = tt_GetClientW() + tt_GetScrollX() - tt_w - 1;
 tt_maxPosY = tt_GetClientH() + tt_GetScrollY() - tt_h - 1;
 tt_AdaptConfig2();
 // Ensure the tip be shown and positioned before the first onmousemove
 tt_OverInit();
 tt_ShowInit();
 tt_Move();
}
function tt_ReadCmds(a)
{
 var i;

 // First load the global config values, to initialize also values
 // for which no command is passed
 i = 0;
 for(var j in config)
  tt_aV[i++] = config[j];
 // Then replace each cached config value for which a command is
 // passed (ensure the # of command args plus value args be even)
 if(a.length & 1)
 {
  for(i = a.length - 1; i > 0; i -= 2)
   tt_aV[a[i - 1]] = a[i];
  return true;
 }
 tt_Err("Incorrect call of Tip() or TagToTip().\n"
   + "Each command must be followed by a value.", true);
 return false;
}
function tt_AdaptConfig1()
{
 tt_ExtCallFncs(0, "LoadConfig");
 // Inherit unspecified title formattings from body
 if(!tt_aV[TITLEBGCOLOR].length)
  tt_aV[TITLEBGCOLOR] = tt_aV[BORDERCOLOR];
 if(!tt_aV[TITLEFONTCOLOR].length)
  tt_aV[TITLEFONTCOLOR] = tt_aV[BGCOLOR];
 if(!tt_aV[TITLEFONTFACE].length)
  tt_aV[TITLEFONTFACE] = tt_aV[FONTFACE];
 if(!tt_aV[TITLEFONTSIZE].length)
  tt_aV[TITLEFONTSIZE] = tt_aV[FONTSIZE];
 if(tt_aV[CLOSEBTN])
 {
  // Use title colours for non-specified closebutton colours
  if(!tt_aV[CLOSEBTNCOLORS])
   tt_aV[CLOSEBTNCOLORS] = new Array("", "", "", "");
  for(var i = 4; i;)
  {--i;
   if(!tt_aV[CLOSEBTNCOLORS][i].length)
    tt_aV[CLOSEBTNCOLORS][i] = (i & 1) ? tt_aV[TITLEFONTCOLOR] : tt_aV[TITLEBGCOLOR];
  }
  // Enforce titlebar be shown
  if(!tt_aV[TITLE].length)
   tt_aV[TITLE] = " ";
 }
 // Circumvents broken display of images and fade-in flicker in Geckos < 1.8
 if(tt_aV[OPACITY] == 100 && typeof tt_aElt[0].style.MozOpacity != tt_u && !Array.every)
  tt_aV[OPACITY] = 99;
 // Smartly shorten the delay for fade-in tooltips
 if(tt_aV[FADEIN] && tt_flagOpa && tt_aV[DELAY] > 100)
  tt_aV[DELAY] = Math.max(tt_aV[DELAY] - tt_aV[FADEIN], 100);
}
function tt_AdaptConfig2()
{
 if(tt_aV[CENTERMOUSE])
 {
  tt_aV[OFFSETX] -= ((tt_w - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0)) >> 1);
  tt_aV[JUMPHORZ] = false;
 }
}
// Expose content globally so extensions can modify it
function tt_MkTipContent(a)
{
 if(tt_t2t)
 {
  if(tt_aV[COPYCONTENT])
   tt_sContent = tt_t2t.innerHTML;
  else
   tt_sContent = "";
 }
 else
  tt_sContent = a[0];
 tt_ExtCallFncs(0, "CreateContentString");
}
function tt_MkTipSubDivs()
{
 var sCss = 'position:relative;margin:0px;padding:0px;border-width:0px;left:0px;top:0px;line-height:normal;width:auto;',
 sTbTrTd = ' cellspacing="0" cellpadding="0" border="0" style="' + sCss + '"><tbody style="' + sCss + '"><tr><td ';

 tt_aElt[0].style.width = tt_GetClientW() + "px";
 tt_aElt[0].innerHTML =
  (''
  + (tt_aV[TITLE].length ?
   ('<div id="WzTiTl" style="position:relative;z-index:1;">'
   + '<table id="WzTiTlTb"' + sTbTrTd + 'id="WzTiTlI" style="' + sCss + '">'
   + tt_aV[TITLE]
   + '</td>'
   + (tt_aV[CLOSEBTN] ?
    ('<td align="right" style="' + sCss
    + 'text-align:right;">'
    + '<span id="WzClOsE" style="position:relative;left:2px;padding-left:2px;padding-right:2px;'
    + 'cursor:' + (tt_ie ? 'hand' : 'pointer')
    + ';" onmouseover="tt_OnCloseBtnOver(1)" onmouseout="tt_OnCloseBtnOver(0)" onclick="tt_HideInit()">'
    + tt_aV[CLOSEBTNTEXT]
    + '</span></td>')
    : '')
   + '</tr></tbody></table></div>')
   : '')
  + '<div id="WzBoDy" style="position:relative;z-index:0;">'
  + '<table' + sTbTrTd + 'id="WzBoDyI" style="' + sCss + '">'
  + tt_sContent
  + '</td></tr></tbody></table></div>'
  + (tt_aV[SHADOW]
   ? ('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
    + '<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>')
   : '')
  );
 tt_GetSubDivRefs();
 // Convert DOM node to tip
 if(tt_t2t && !tt_aV[COPYCONTENT])
  tt_El2Tip();
 tt_ExtCallFncs(0, "SubDivsCreated");
}
function tt_GetSubDivRefs()
{
 var aId = new Array("WzTiTl", "WzTiTlTb", "WzTiTlI", "WzClOsE", "WzBoDy", "WzBoDyI", "WzTtShDwB", "WzTtShDwR");

 for(var i = aId.length; i; --i)
  tt_aElt[i] = tt_GetElt(aId[i - 1]);
}
function tt_FormatTip()
{
 var css, w, h, pad = tt_aV[PADDING], padT, wBrd = tt_aV[BORDERWIDTH],
 iOffY, iOffSh, iAdd = (pad + wBrd) << 1;

 //--------- Title DIV ----------
 if(tt_aV[TITLE].length)
 {
  padT = tt_aV[TITLEPADDING];
  css = tt_aElt[1].style;
  css.background = tt_aV[TITLEBGCOLOR];
  css.paddingTop = css.paddingBottom = padT + "px";
  css.paddingLeft = css.paddingRight = (padT + 2) + "px";
  css = tt_aElt[3].style;
  css.color = tt_aV[TITLEFONTCOLOR];
  if(tt_aV[WIDTH] == -1)
   css.whiteSpace = "nowrap";
  css.fontFamily = tt_aV[TITLEFONTFACE];
  css.fontSize = tt_aV[TITLEFONTSIZE];
  css.fontWeight = "bold";
  css.textAlign = tt_aV[TITLEALIGN];
  // Close button DIV
  if(tt_aElt[4])
  {
   css = tt_aElt[4].style;
   css.background = tt_aV[CLOSEBTNCOLORS][0];
   css.color = tt_aV[CLOSEBTNCOLORS][1];
   css.fontFamily = tt_aV[TITLEFONTFACE];
   css.fontSize = tt_aV[TITLEFONTSIZE];
   css.fontWeight = "bold";
  }
  if(tt_aV[WIDTH] > 0)
   tt_w = tt_aV[WIDTH];
  else
  {
   tt_w = tt_GetDivW(tt_aElt[3]) + tt_GetDivW(tt_aElt[4]);
   // Some spacing between title DIV and closebutton
   if(tt_aElt[4])
    tt_w += pad;
   // Restrict auto width to max width
   if(tt_aV[WIDTH] < -1 && tt_w > -tt_aV[WIDTH])
    tt_w = -tt_aV[WIDTH];
  }
  // Ensure the top border of the body DIV be covered by the title DIV
  iOffY = -wBrd;
 }
 else
 {
  tt_w = 0;
  iOffY = 0;
 }

 //-------- Body DIV ------------
 css = tt_aElt[5].style;
 css.top = iOffY + "px";
 if(wBrd)
 {
  css.borderColor = tt_aV[BORDERCOLOR];
  css.borderStyle = tt_aV[BORDERSTYLE];
  css.borderWidth = wBrd + "px";
 }
 if(tt_aV[BGCOLOR].length)
  css.background = tt_aV[BGCOLOR];
 if(tt_aV[BGIMG].length)
  css.backgroundImage = "url(" + tt_aV[BGIMG] + ")";
 css.padding = pad + "px";
 css.textAlign = tt_aV[TEXTALIGN];
 if(tt_aV[HEIGHT])
 {
  css.overflow = "auto";
  if(tt_aV[HEIGHT] > 0)
   css.height = (tt_aV[HEIGHT] + iAdd) + "px";
  else
   tt_h = iAdd - tt_aV[HEIGHT];
 }
 // TD inside body DIV
 css = tt_aElt[6].style;
 css.color = tt_aV[FONTCOLOR];
 css.fontFamily = tt_aV[FONTFACE];
 css.fontSize = tt_aV[FONTSIZE];
 css.fontWeight = tt_aV[FONTWEIGHT];
 css.textAlign = tt_aV[TEXTALIGN];
 if(tt_aV[WIDTH] > 0)
  w = tt_aV[WIDTH];
 // Width like title (if existent)
 else if(tt_aV[WIDTH] == -1 && tt_w)
  w = tt_w;
 else
 {
  // Measure width of the body's inner TD, as some browsers would expand
  // the container and outer body DIV to 100%
  w = tt_GetDivW(tt_aElt[6]);
  // Restrict auto width to max width
  if(tt_aV[WIDTH] < -1 && w > -tt_aV[WIDTH])
   w = -tt_aV[WIDTH];
 }
 if(w > tt_w)
  tt_w = w;
 tt_w += iAdd;

 //--------- Shadow DIVs ------------
 if(tt_aV[SHADOW])
 {
  tt_w += tt_aV[SHADOWWIDTH];
  iOffSh = Math.floor((tt_aV[SHADOWWIDTH] * 4) / 3);
  // Bottom shadow
  css = tt_aElt[7].style;
  css.top = iOffY + "px";
  css.left = iOffSh + "px";
  css.width = (tt_w - iOffSh - tt_aV[SHADOWWIDTH]) + "px";
  css.height = tt_aV[SHADOWWIDTH] + "px";
  css.background = tt_aV[SHADOWCOLOR];
  // Right shadow
  css = tt_aElt[8].style;
  css.top = iOffSh + "px";
  css.left = (tt_w - tt_aV[SHADOWWIDTH]) + "px";
  css.width = tt_aV[SHADOWWIDTH] + "px";
  css.background = tt_aV[SHADOWCOLOR];
 }
 else
  iOffSh = 0;

 //-------- Container DIV -------
 tt_SetTipOpa(tt_aV[FADEIN] ? 0 : tt_aV[OPACITY]);
 tt_FixSize(iOffY, iOffSh);
}
// Fixate the size so it can't dynamically change while the tooltip is moving.
function tt_FixSize(iOffY, iOffSh)
{
 var wIn, wOut, h, add, pad = tt_aV[PADDING], wBrd = tt_aV[BORDERWIDTH], i;

 tt_aElt[0].style.width = tt_w + "px";
 tt_aElt[0].style.pixelWidth = tt_w;
 wOut = tt_w - ((tt_aV[SHADOW]) ? tt_aV[SHADOWWIDTH] : 0);
 // Body
 wIn = wOut;
 if(!tt_bBoxOld)
  wIn -= (pad + wBrd) << 1;
 tt_aElt[5].style.width = wIn + "px";
 // Title
 if(tt_aElt[1])
 {
  wIn = wOut - ((tt_aV[TITLEPADDING] + 2) << 1);
  if(!tt_bBoxOld)
   wOut = wIn;
  tt_aElt[1].style.width = wOut + "px";
  tt_aElt[2].style.width = wIn + "px";
 }
 // Max height specified
 if(tt_h)
 {
  h = tt_GetDivH(tt_aElt[5]);
  if(h > tt_h)
  {
   if(!tt_bBoxOld)
    tt_h -= (pad + wBrd) << 1;
   tt_aElt[5].style.height = tt_h + "px";
  }
 }
 tt_h = tt_GetDivH(tt_aElt[0]) + iOffY;
 // Right shadow
 if(tt_aElt[8])
  tt_aElt[8].style.height = (tt_h - iOffSh) + "px";
 i = tt_aElt.length - 1;
 if(tt_aElt[i])
 {
  tt_aElt[i].style.width = tt_w + "px";
  tt_aElt[i].style.height = tt_h + "px";
 }
}
function tt_DeAlt(el)
{
 var aKid;

 if(el)
 {
  if(el.alt)
   el.alt = "";
  if(el.title)
   el.title = "";
  aKid = el.childNodes || el.children || null;
  if(aKid)
  {
   for(var i = aKid.length; i;)
    tt_DeAlt(aKid[--i]);
  }
 }
}
// This hack removes the native tooltips over links in Opera
function tt_OpDeHref(el)
{
 if(!tt_op)
  return;
 if(tt_elDeHref)
  tt_OpReHref();
 while(el)
 {
  if(el.hasAttribute && el.hasAttribute("href"))
  {
   el.t_href = el.getAttribute("href");
   el.t_stats = window.status;
   el.removeAttribute("href");
   el.style.cursor = "hand";
   tt_AddEvtFnc(el, "mousedown", tt_OpReHref);
   window.status = el.t_href;
   tt_elDeHref = el;
   break;
  }
  el = tt_GetDad(el);
 }
}
function tt_OpReHref()
{
 if(tt_elDeHref)
 {
  tt_elDeHref.setAttribute("href", tt_elDeHref.t_href);
  tt_RemEvtFnc(tt_elDeHref, "mousedown", tt_OpReHref);
  window.status = tt_elDeHref.t_stats;
  tt_elDeHref = null;
 }
}
function tt_El2Tip()
{
 var css = tt_t2t.style;

 // Store previous positioning
 tt_t2t.t_cp = css.position;
 tt_t2t.t_cl = css.left;
 tt_t2t.t_ct = css.top;
 tt_t2t.t_cd = css.display;
 // Store the tag's parent element so we can restore that DOM branch
 // when the tooltip is being hidden
 tt_t2tDad = tt_GetDad(tt_t2t);
 tt_MovDomNode(tt_t2t, tt_t2tDad, tt_aElt[6]);
 css.display = "block";
 css.position = "static";
 css.left = css.top = css.marginLeft = css.marginTop = "0px";
}
function tt_UnEl2Tip()
{
 // Restore positioning and display
 var css = tt_t2t.style;

 css.display = tt_t2t.t_cd;
 tt_MovDomNode(tt_t2t, tt_GetDad(tt_t2t), tt_t2tDad);
 css.position = tt_t2t.t_cp;
 css.left = tt_t2t.t_cl;
 css.top = tt_t2t.t_ct;
 tt_t2tDad = null;
}
function tt_OverInit()
{
 if(window.event)
  tt_over = window.event.target || window.event.srcElement;
 else
  tt_over = tt_ovr_;
 tt_DeAlt(tt_over);
 tt_OpDeHref(tt_over);
}
function tt_ShowInit()
{
 tt_tShow.Timer("tt_Show()", tt_aV[DELAY], true);
 if(tt_aV[CLICKCLOSE] || tt_aV[CLICKSTICKY])
  tt_AddEvtFnc(document, "mouseup", tt_OnLClick);
}
function tt_Show()
{
 var css = tt_aElt[0].style;

 // Override the z-index of the topmost wz_dragdrop.js D&D item
 css.zIndex = Math.max((window.dd && dd.z) ? (dd.z + 2) : 0, 1010);
 if(tt_aV[STICKY] || !tt_aV[FOLLOWMOUSE])
  tt_iState &= ~0x4;
 if(tt_aV[EXCLUSIVE])
  tt_iState |= 0x8;
 if(tt_aV[DURATION] > 0)
  tt_tDurt.Timer("tt_HideInit()", tt_aV[DURATION], true);
 tt_ExtCallFncs(0, "Show")
 css.visibility = "visible";
 tt_iState |= 0x2;
 if(tt_aV[FADEIN])
  tt_Fade(0, 0, tt_aV[OPACITY], Math.round(tt_aV[FADEIN] / tt_aV[FADEINTERVAL]));
 tt_ShowIfrm();
}
function tt_ShowIfrm()
{
 if(tt_ie56)
 {
  var ifrm = tt_aElt[tt_aElt.length - 1];
  if(ifrm)
  {
   var css = ifrm.style;
   css.zIndex = tt_aElt[0].style.zIndex - 1;
   css.display = "block";
  }
 }
}
function tt_Move(e)
{
 if(e)
  tt_ovr_ = e.target || e.srcElement;
 e = e || window.event;
 if(e)
 {
  tt_musX = tt_GetEvtX(e);
  tt_musY = tt_GetEvtY(e);
 }
 if(tt_iState & 0x4)
 {
  // Prevent jam of mousemove events
  if(!tt_op && !tt_ie)
  {
   if(tt_bWait)
    return;
   tt_bWait = true;
   tt_tWaitMov.Timer("tt_bWait = false;", 1, true);
  }
  if(tt_aV[FIX])
  {
   tt_iState &= ~0x4;
   tt_PosFix();
  }
  else if(!tt_ExtCallFncs(e, "MoveBefore"))
   tt_SetTipPos(tt_Pos(0), tt_Pos(1));
  tt_ExtCallFncs([tt_musX, tt_musY], "MoveAfter")
 }
}
function tt_Pos(iDim)
{
 var iX, bJmpMod, cmdAlt, cmdOff, cx, iMax, iScrl, iMus, bJmp;

 // Map values according to dimension to calculate
 if(iDim)
 {
  bJmpMod = tt_aV[JUMPVERT];
  cmdAlt = ABOVE;
  cmdOff = OFFSETY;
  cx = tt_h;
  iMax = tt_maxPosY;
  iScrl = tt_GetScrollY();
  iMus = tt_musY;
  bJmp = tt_bJmpVert;
 }
 else
 {
  bJmpMod = tt_aV[JUMPHORZ];
  cmdAlt = LEFT;
  cmdOff = OFFSETX;
  cx = tt_w;
  iMax = tt_maxPosX;
  iScrl = tt_GetScrollX();
  iMus = tt_musX;
  bJmp = tt_bJmpHorz;
 }
 if(bJmpMod)
 {
  if(tt_aV[cmdAlt] && (!bJmp || tt_CalcPosAlt(iDim) >= iScrl + 16))
   iX = tt_PosAlt(iDim);
  else if(!tt_aV[cmdAlt] && bJmp && tt_CalcPosDef(iDim) > iMax - 16)
   iX = tt_PosAlt(iDim);
  else
   iX = tt_PosDef(iDim);
 }
 else
 {
  iX = iMus;
  if(tt_aV[cmdAlt])
   iX -= cx + tt_aV[cmdOff] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0);
  else
   iX += tt_aV[cmdOff];
 }
 // Prevent tip from extending past clientarea boundary
 if(iX > iMax)
  iX = bJmpMod ? tt_PosAlt(iDim) : iMax;
 // In case of insufficient space on both sides, ensure the left/upper part
 // of the tip be visible
 if(iX < iScrl)
  iX = bJmpMod ? tt_PosDef(iDim) : iScrl;
 return iX;
}
function tt_PosDef(iDim)
{
 if(iDim)
  tt_bJmpVert = tt_aV[ABOVE];
 else
  tt_bJmpHorz = tt_aV[LEFT];
 return tt_CalcPosDef(iDim);
}
function tt_PosAlt(iDim)
{
 if(iDim)
  tt_bJmpVert = !tt_aV[ABOVE];
 else
  tt_bJmpHorz = !tt_aV[LEFT];
 return tt_CalcPosAlt(iDim);
}
function tt_CalcPosDef(iDim)
{
 return iDim ? (tt_musY + tt_aV[OFFSETY]) : (tt_musX + tt_aV[OFFSETX]);
}
function tt_CalcPosAlt(iDim)
{
 var cmdOff = iDim ? OFFSETY : OFFSETX;
 var dx = tt_aV[cmdOff] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0);
 if(tt_aV[cmdOff] > 0 && dx <= 0)
  dx = 1;
 return((iDim ? (tt_musY - tt_h) : (tt_musX - tt_w)) - dx);
}
function tt_PosFix()
{
 var iX, iY;

 if(typeof(tt_aV[FIX][0]) == "number")
 {
  iX = tt_aV[FIX][0];
  iY = tt_aV[FIX][1];
 }
 else
 {
  if(typeof(tt_aV[FIX][0]) == "string")
   el = tt_GetElt(tt_aV[FIX][0]);
  // First slot in array is direct reference to HTML element
  else
   el = tt_aV[FIX][0];
  iX = tt_aV[FIX][1];
  iY = tt_aV[FIX][2];
  // By default, vert pos is related to bottom edge of HTML element
  if(!tt_aV[ABOVE] && el)
   iY += tt_GetDivH(el);
  for(; el; el = el.offsetParent)
  {
   iX += el.offsetLeft || 0;
   iY += el.offsetTop || 0;
  }
 }
 // For a fixed tip positioned above the mouse, use the bottom edge as anchor
 // (recommended by Christophe Rebeschini, 31.1.2008)
 if(tt_aV[ABOVE])
  iY -= tt_h;
 tt_SetTipPos(iX, iY);
}
function tt_Fade(a, now, z, n)
{
 if(n)
 {
  now += Math.round((z - now) / n);
  if((z > a) ? (now >= z) : (now <= z))
   now = z;
  else
   tt_tFade.Timer(
    "tt_Fade("
    + a + "," + now + "," + z + "," + (n - 1)
    + ")",
    tt_aV[FADEINTERVAL],
    true
   );
 }
 now ? tt_SetTipOpa(now) : tt_Hide();
}
function tt_SetTipOpa(opa)
{
 // To circumvent the opacity nesting flaws of IE, we set the opacity
 // for each sub-DIV separately, rather than for the container DIV.
 tt_SetOpa(tt_aElt[5], opa);
 if(tt_aElt[1])
  tt_SetOpa(tt_aElt[1], opa);
 if(tt_aV[SHADOW])
 {
  opa = Math.round(opa * 0.8);
  tt_SetOpa(tt_aElt[7], opa);
  tt_SetOpa(tt_aElt[8], opa);
 }
}
function tt_OnCloseBtnOver(iOver)
{
 var css = tt_aElt[4].style;

 iOver <<= 1;
 css.background = tt_aV[CLOSEBTNCOLORS][iOver];
 css.color = tt_aV[CLOSEBTNCOLORS][iOver + 1];
}
function tt_OnLClick(e)
{
 //  Ignore right-clicks
 e = e || window.event;
 if(!((e.button && e.button & 2) || (e.which && e.which == 3)))
 {
  if(tt_aV[CLICKSTICKY] && (tt_iState & 0x4))
  {
   tt_aV[STICKY] = true;
   tt_iState &= ~0x4;
  }
  else if(tt_aV[CLICKCLOSE])
   tt_HideInit();
 }
}
function tt_Int(x)
{
 var y;

 return(isNaN(y = parseInt(x)) ? 0 : y);
}
Number.prototype.Timer = function(s, iT, bUrge)
{
 if(!this.value || bUrge)
  this.value = window.setTimeout(s, iT);
}
Number.prototype.EndTimer = function()
{
 if(this.value)
 {
  window.clearTimeout(this.value);
  this.value = 0;
 }
}
function tt_GetWndCliSiz(s)
{
 var db, y = window["inner" + s], sC = "client" + s, sN = "number";
 if(typeof y == sN)
 {
  var y2;
  return(
   // Gecko or Opera with scrollbar
   // ... quirks mode
   ((db = document.body) && typeof(y2 = db[sC]) == sN && y2 &&  y2 <= y) ? y2
   // ... strict mode
   : ((db = document.documentElement) && typeof(y2 = db[sC]) == sN && y2 && y2 <= y) ? y2
   // No scrollbar, or clientarea size == 0, or other browser (KHTML etc.)
   : y
  );
 }
 // IE
 return(
  // document.documentElement.client+s functional, returns > 0
  ((db = document.documentElement) && (y = db[sC])) ? y
  // ... not functional, in which case document.body.client+s
  // is the clientarea size, fortunately
  : document.body[sC]
 );
}
function tt_SetOpa(el, opa)
{
 var css = el.style;

 tt_opa = opa;
 if(tt_flagOpa == 1)
 {
  if(opa < 100)
  {
   // Hacks for bugs of IE:
   // 1.) Once a CSS filter has been applied, fonts are no longer
   // anti-aliased, so we store the previous 'non-filter' to be
   // able to restore it
   if(typeof(el.filtNo) == tt_u)
    el.filtNo = css.filter;
   // 2.) A DIV cannot be made visible in a single step if an
   // opacity < 100 has been applied while the DIV was hidden
   var bVis = css.visibility != "hidden";
   // 3.) In IE6, applying an opacity < 100 has no effect if the
   //    element has no layout (position, size, zoom, ...)
   css.zoom = "100%";
   if(!bVis)
    css.visibility = "visible";
   css.filter = "alpha(opacity=" + opa + ")";
   if(!bVis)
    css.visibility = "hidden";
  }
  else if(typeof(el.filtNo) != tt_u)
   // Restore 'non-filter'
   css.filter = el.filtNo;
 }
 else
 {
  opa /= 100.0;
  switch(tt_flagOpa)
  {
  case 2:
   css.KhtmlOpacity = opa; break;
  case 3:
   css.KHTMLOpacity = opa; break;
  case 4:
   css.MozOpacity = opa; break;
  case 5:
   css.opacity = opa; break;
  }
 }
}
function tt_Err(sErr, bIfDebug)
{
 if(tt_Debug || !bIfDebug)
  alert("Tooltip Script Error Message:\n\n" + sErr);
}

//============  EXTENSION (PLUGIN) MANAGER  ===============//
function tt_ExtCmdEnum()
{
 var s;

 // Add new command(s) to the commands enum
 for(var i in config)
 {
  s = "window." + i.toString().toUpperCase();
  if(eval("typeof(" + s + ") == tt_u"))
  {
   eval(s + " = " + tt_aV.length);
   tt_aV[tt_aV.length] = null;
  }
 }
}
function tt_ExtCallFncs(arg, sFnc)
{
 var b = false;
 for(var i = tt_aExt.length; i;)
 {--i;
  var fnc = tt_aExt[i]["On" + sFnc];
  // Call the method the extension has defined for this event
  if(fnc && fnc(arg))
   b = true;
 }
 return b;
}

tt_Init();
var olLoaded=0;var pmStart=10000000;var pmUpper=10001000;var pmCount=pmStart+1;var pmt='';var pms=new Array();var olInfo=new Info('4.21',1);var FREPLACE=0;var FBEFORE=1;var FAFTER=2;var FALTERNATE=3;var FCHAIN=4;var olHideForm=0;var olHautoFlag=0;var olVautoFlag=0;var hookPts=new Array(),postParse=new Array(),cmdLine=new Array(),runTime=new Array();registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass');if(typeof ol_fgcolor=='undefined')var ol_fgcolor="#CCCCFF";if(typeof ol_bgcolor=='undefined')var ol_bgcolor="#333399";if(typeof ol_textcolor=='undefined')var ol_textcolor="#000000";if(typeof ol_capcolor=='undefined')var ol_capcolor="#FFFFFF";if(typeof ol_closecolor=='undefined')var ol_closecolor="#9999FF";if(typeof ol_textfont=='undefined')var ol_textfont="Verdana,Arial,Helvetica";if(typeof ol_captionfont=='undefined')var ol_captionfont="Verdana,Arial,Helvetica";if(typeof ol_closefont=='undefined')var ol_closefont="Verdana,Arial,Helvetica";if(typeof ol_textsize=='undefined')var ol_textsize="1";if(typeof ol_captionsize=='undefined')var ol_captionsize="1";if(typeof ol_closesize=='undefined')var ol_closesize="1";if(typeof ol_width=='undefined')var ol_width="200";if(typeof ol_border=='undefined')var ol_border="1";if(typeof ol_cellpad=='undefined')var ol_cellpad=2;if(typeof ol_offsetx=='undefined')var ol_offsetx=10;if(typeof ol_offsety=='undefined')var ol_offsety=10;if(typeof ol_text=='undefined')var ol_text="Default Text";if(typeof ol_cap=='undefined')var ol_cap="";if(typeof ol_sticky=='undefined')var ol_sticky=0;if(typeof ol_background=='undefined')var ol_background="";if(typeof ol_close=='undefined')var ol_close="Close";if(typeof ol_hpos=='undefined')var ol_hpos=RIGHT;if(typeof ol_status=='undefined')var ol_status="";if(typeof ol_autostatus=='undefined')var ol_autostatus=0;if(typeof ol_height=='undefined')var ol_height=-1;if(typeof ol_snapx=='undefined')var ol_snapx=0;if(typeof ol_snapy=='undefined')var ol_snapy=0;if(typeof ol_fixx=='undefined')var ol_fixx=-1;if(typeof ol_fixy=='undefined')var ol_fixy=-1;if(typeof ol_relx=='undefined')var ol_relx=null;if(typeof ol_rely=='undefined')var ol_rely=null;if(typeof ol_fgbackground=='undefined')var ol_fgbackground="";if(typeof ol_bgbackground=='undefined')var ol_bgbackground="";if(typeof ol_padxl=='undefined')var ol_padxl=1;if(typeof ol_padxr=='undefined')var ol_padxr=1;if(typeof ol_padyt=='undefined')var ol_padyt=1;if(typeof ol_padyb=='undefined')var ol_padyb=1;if(typeof ol_fullhtml=='undefined')var ol_fullhtml=0;if(typeof ol_vpos=='undefined')var ol_vpos=BELOW;if(typeof ol_aboveheight=='undefined')var ol_aboveheight=0;if(typeof ol_capicon=='undefined')var ol_capicon="";if(typeof ol_frame=='undefined')var ol_frame=self;if(typeof ol_timeout=='undefined')var ol_timeout=0;if(typeof ol_function=='undefined')var ol_function=null;if(typeof ol_delay=='undefined')var ol_delay=0;if(typeof ol_hauto=='undefined')var ol_hauto=0;if(typeof ol_vauto=='undefined')var ol_vauto=0;if(typeof ol_closeclick=='undefined')var ol_closeclick=0;if(typeof ol_wrap=='undefined')var ol_wrap=0;if(typeof ol_followmouse=='undefined')var ol_followmouse=1;if(typeof ol_mouseoff=='undefined')var ol_mouseoff=0;if(typeof ol_closetitle=='undefined')var ol_closetitle='Close';if(typeof ol_compatmode=='undefined')var ol_compatmode=0;if(typeof ol_css=='undefined')var ol_css=CSSOFF;if(typeof ol_fgclass=='undefined')var ol_fgclass="";if(typeof ol_bgclass=='undefined')var ol_bgclass="";if(typeof ol_textfontclass=='undefined')var ol_textfontclass="";if(typeof ol_captionfontclass=='undefined')var ol_captionfontclass="";if(typeof ol_closefontclass=='undefined')var ol_closefontclass="";if(typeof ol_texts=='undefined')var ol_texts=new Array("Text 0","Text 1");if(typeof ol_caps=='undefined')var ol_caps=new Array("Caption 0","Caption 1");var o3_text="";var o3_cap="";var o3_sticky=0;var o3_background="";var o3_close="Close";var o3_hpos=RIGHT;var o3_offsetx=2;var o3_offsety=2;var o3_fgcolor="";var o3_bgcolor="";var o3_textcolor="";var o3_capcolor="";var o3_closecolor="";var o3_width=100;var o3_border=1;var o3_cellpad=2;var o3_status="";var o3_autostatus=0;var o3_height=-1;var o3_snapx=0;var o3_snapy=0;var o3_fixx=-1;var o3_fixy=-1;var o3_relx=null;var o3_rely=null;var o3_fgbackground="";var o3_bgbackground="";var o3_padxl=0;var o3_padxr=0;var o3_padyt=0;var o3_padyb=0;var o3_fullhtml=0;var o3_vpos=BELOW;var o3_aboveheight=0;var o3_capicon="";var o3_textfont="Verdana,Arial,Helvetica";var o3_captionfont="Verdana,Arial,Helvetica";var o3_closefont="Verdana,Arial,Helvetica";var o3_textsize="1";var o3_captionsize="1";var o3_closesize="1";var o3_frame=self;var o3_timeout=0;var o3_timerid=0;var o3_allowmove=0;var o3_function=null;var o3_delay=0;var o3_delayid=0;var o3_hauto=0;var o3_vauto=0;var o3_closeclick=0;var o3_wrap=0;var o3_followmouse=1;var o3_mouseoff=0;var o3_closetitle='';var o3_compatmode=0;var o3_css=CSSOFF;var o3_fgclass="";var o3_bgclass="";var o3_textfontclass="";var o3_captionfontclass="";var o3_closefontclass="";var o3_x=0;var o3_y=0;var o3_showingsticky=0;var o3_removecounter=0;var over=null;var fnRef,hoveringSwitch=false;var olHideDelay;var isMac=(navigator.userAgent.indexOf("Mac")!=-1);var olOp=(navigator.userAgent.toLowerCase().indexOf('opera')>-1&&document.createTextNode);var olNs4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4);var olNs6=(document.getElementById)?true:false;var olKq=(olNs6&&/konqueror/i.test(navigator.userAgent));var olIe4=(document.all)?true:false;var olIe5=false;var olIe55=false;var docRoot='document.body';if(olNs4){var oW=window.innerWidth;var oH=window.innerHeight;window.onresize=function(){if(oW!=window.innerWidth||oH!=window.innerHeight)location.reload();}}
if(olIe4){var agent=navigator.userAgent;if(/MSIE/.test(agent)){var versNum=parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]);if(versNum>=5){olIe5=true;olIe55=(versNum>=5.5&&!olOp)?true:false;if(olNs6)olNs6=false;}}
if(olNs6)olIe4=false;}
if(document.compatMode&&document.compatMode=='CSS1Compat'){docRoot=((olIe4&&!olOp)?'document.documentElement':docRoot);}
if(window.addEventListener)window.addEventListener("load",OLonLoad_handler,false);else if(window.attachEvent)window.attachEvent("onload",OLonLoad_handler);var capExtent;function overlib(){if(!olLoaded||isExclusive(overlib.arguments))return true;if(olCheckMouseCapture)olMouseCapture();if(over){over=(typeof over.id!='string')?o3_frame.document.all['overDiv']:over;cClick();}
olHideDelay=0;o3_text=ol_text;o3_cap=ol_cap;o3_sticky=ol_sticky;o3_background=ol_background;o3_close=ol_close;o3_hpos=ol_hpos;o3_offsetx=ol_offsetx;o3_offsety=ol_offsety;o3_fgcolor=ol_fgcolor;o3_bgcolor=ol_bgcolor;o3_textcolor=ol_textcolor;o3_capcolor=ol_capcolor;o3_closecolor=ol_closecolor;o3_width=ol_width;o3_border=ol_border;o3_cellpad=ol_cellpad;o3_status=ol_status;o3_autostatus=ol_autostatus;o3_height=ol_height;o3_snapx=ol_snapx;o3_snapy=ol_snapy;o3_fixx=ol_fixx;o3_fixy=ol_fixy;o3_relx=ol_relx;o3_rely=ol_rely;o3_fgbackground=ol_fgbackground;o3_bgbackground=ol_bgbackground;o3_padxl=ol_padxl;o3_padxr=ol_padxr;o3_padyt=ol_padyt;o3_padyb=ol_padyb;o3_fullhtml=ol_fullhtml;o3_vpos=ol_vpos;o3_aboveheight=ol_aboveheight;o3_capicon=ol_capicon;o3_textfont=ol_textfont;o3_captionfont=ol_captionfont;o3_closefont=ol_closefont;o3_textsize=ol_textsize;o3_captionsize=ol_captionsize;o3_closesize=ol_closesize;o3_timeout=ol_timeout;o3_function=ol_function;o3_delay=ol_delay;o3_hauto=ol_hauto;o3_vauto=ol_vauto;o3_closeclick=ol_closeclick;o3_wrap=ol_wrap;o3_followmouse=ol_followmouse;o3_mouseoff=ol_mouseoff;o3_closetitle=ol_closetitle;o3_css=ol_css;o3_compatmode=ol_compatmode;o3_fgclass=ol_fgclass;o3_bgclass=ol_bgclass;o3_textfontclass=ol_textfontclass;o3_captionfontclass=ol_captionfontclass;o3_closefontclass=ol_closefontclass;setRunTimeVariables();fnRef='';o3_frame=ol_frame;if(!(over=createDivContainer()))return false;parseTokens('o3_',overlib.arguments);if(!postParseChecks())return false;if(o3_delay==0){return runHook("olMain",FREPLACE);}else{o3_delayid=setTimeout("runHook('olMain', FREPLACE)",o3_delay);return false;}}
function nd(time){if(olLoaded&&!isExclusive()){hideDelay(time);if(o3_removecounter>=1){o3_showingsticky=0};if(o3_showingsticky==0){o3_allowmove=0;if(over!=null&&o3_timerid==0)runHook("hideObject",FREPLACE,over);}else{o3_removecounter++;}}
return true;}
function cClick(){if(olLoaded){runHook("hideObject",FREPLACE,over);o3_showingsticky=0;}
return false;}
function overlib_pagedefaults(){parseTokens('ol_',overlib_pagedefaults.arguments);}
function olMain(){var layerhtml,styleType;runHook("olMain",FBEFORE);if(o3_background!=""||o3_fullhtml){layerhtml=runHook('ol_content_background',FALTERNATE,o3_css,o3_text,o3_background,o3_fullhtml);}else{styleType=(pms[o3_css-1-pmStart]=="cssoff"||pms[o3_css-1-pmStart]=="cssclass");if(o3_fgbackground!="")o3_fgbackground="background=\""+o3_fgbackground+"\"";if(o3_bgbackground!="")o3_bgbackground=(styleType?"background=\""+o3_bgbackground+"\"":o3_bgbackground);if(o3_fgcolor!="")o3_fgcolor=(styleType?"bgcolor=\""+o3_fgcolor+"\"":o3_fgcolor);if(o3_bgcolor!="")o3_bgcolor=(styleType?"bgcolor=\""+o3_bgcolor+"\"":o3_bgcolor);if(o3_height>0)o3_height=(styleType?"height=\""+o3_height+"\"":o3_height);else o3_height="";if(o3_cap==""){layerhtml=runHook('ol_content_simple',FALTERNATE,o3_css,o3_text);}else{if(o3_sticky){layerhtml=runHook('ol_content_caption',FALTERNATE,o3_css,o3_text,o3_cap,o3_close);}else{layerhtml=runHook('ol_content_caption',FALTERNATE,o3_css,o3_text,o3_cap,"");}}}
if(o3_sticky){if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;}
o3_showingsticky=1;o3_removecounter=0;}
if(!runHook("createPopup",FREPLACE,layerhtml))return false;if(o3_autostatus>0){o3_status=o3_text;if(o3_autostatus>1)o3_status=o3_cap;}
o3_allowmove=0;if(o3_timeout>0){if(o3_timerid>0)clearTimeout(o3_timerid);o3_timerid=setTimeout("cClick()",o3_timeout);}
runHook("disp",FREPLACE,o3_status);runHook("olMain",FAFTER);return(olOp&&event&&event.type=='mouseover'&&!o3_status)?'':(o3_status!='');}
function ol_content_simple(text){var cpIsMultiple=/,/.test(o3_cellpad);var txt='<table width="'+o3_width+'" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass?'class="'+o3_bgclass+'"':o3_bgcolor+' '+o3_height)+'><tr><td><table width="100%" border="0" '+((olNs4||!cpIsMultiple)?'cellpadding="'+o3_cellpad+'" ':'')+'cellspacing="0" '+(o3_fgclass?'class="'+o3_fgclass+'"':o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass?' class="'+o3_textfontclass+'">':((!olNs4&&cpIsMultiple)?' style="'+setCellPadStr(o3_cellpad)+'">':'>'))+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>';set_background("");return txt;}
function ol_content_caption(text,title,close){var nameId,txt,cpIsMultiple=/,/.test(o3_cellpad);var closing,closeevent;closing="";closeevent="onmouseover";if(o3_closeclick==1)closeevent=(o3_closetitle?"title='"+o3_closetitle+"'":"")+" onclick";if(o3_capicon!=""){nameId=' hspace = \"5\"'+' align = \"middle\" alt = \"\"';if(typeof o3_dragimg!='undefined'&&o3_dragimg)nameId=' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';o3_capicon='<img src=\"'+o3_capicon+'\"'+nameId+' />';}
if(close!="")
closing='<td '+(!o3_compatmode&&o3_closefontclass?'class="'+o3_closefontclass:'align="RIGHT')+'"><a href="javascript:return '+fnRef+'cClick();"'+((o3_compatmode&&o3_closefontclass)?' class="'+o3_closefontclass+'" ':' ')+closeevent+'="return '+fnRef+'cClick();">'+(o3_closefontclass?'':wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass?'':wrapStr(1,o3_closesize,'close'))+'</a></td>';txt='<table width="'+o3_width+'" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass?'class="'+o3_bgclass+'"':o3_bgcolor+' '+o3_bgbackground+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td'+(o3_captionfontclass?' class="'+o3_captionfontclass+'">':'>')+(o3_captionfontclass?'':'<b>'+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass?'':wrapStr(1,o3_captionsize)+'</b>')+'</td>'+closing+'</tr></table><table width="100%" border="0" '+((olNs4||!cpIsMultiple)?'cellpadding="'+o3_cellpad+'" ':'')+'cellspacing="0" '+(o3_fgclass?'class="'+o3_fgclass+'"':o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass?' class="'+o3_textfontclass+'">':((!olNs4&&cpIsMultiple)?' style="'+setCellPadStr(o3_cellpad)+'">':'>'))+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>';set_background("");return txt;}
function ol_content_background(text,picture,hasfullhtml){if(hasfullhtml){txt=text;}else{txt='<table width="'+o3_width+'" border="0" cellpadding="0" cellspacing="0" height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'+o3_padxl+'"></td><td valign="TOP" width="'+(o3_width-o3_padxl-o3_padxr)+(o3_textfontclass?'" class="'+o3_textfontclass:'')+'">'+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>';}
set_background(picture);return txt;}
function set_background(pic){if(pic==""){if(olNs4){over.background.src=null;}else if(over.style){over.style.backgroundImage="none";}}else{if(olNs4){over.background.src=pic;}else if(over.style){over.style.width=o3_width+'px';over.style.backgroundImage="url("+pic+")";}}}
var olShowId=-1;function disp(statustext){runHook("disp",FBEFORE);if(o3_allowmove==0){runHook("placeLayer",FREPLACE);(olNs6&&olShowId<0)?olShowId=setTimeout("runHook('showObject', FREPLACE, over)",1):runHook("showObject",FREPLACE,over);o3_allowmove=(o3_sticky||o3_followmouse==0)?0:1;}
runHook("disp",FAFTER);if(statustext!="")self.status=statustext;}
function createPopup(lyrContent){runHook("createPopup",FBEFORE);if(o3_wrap){var wd,ww,theObj=(olNs4?over:over.style);theObj.top=theObj.left=((olIe4&&!olOp)?0:-10000)+(!olNs4?'px':0);layerWrite(lyrContent);wd=(olNs4?over.clip.width:over.offsetWidth);if(wd>(ww=windowWidth())){lyrContent=lyrContent.replace(/\ /g,' ');o3_width=ww;o3_wrap=0;}}
layerWrite(lyrContent);if(o3_wrap)o3_width=(olNs4?over.clip.width:over.offsetWidth);runHook("createPopup",FAFTER,lyrContent);return true;}
function placeLayer(){var placeX,placeY,widthFix=0;if(o3_frame.innerWidth)widthFix=18;iwidth=windowWidth();winoffset=(olIe4)?eval('o3_frame.'+docRoot+'.scrollLeft'):o3_frame.pageXOffset;placeX=runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix);if(o3_frame.innerHeight){iheight=o3_frame.innerHeight;}else if(eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')){iheight=eval('o3_frame.'+docRoot+'.clientHeight');}
scrolloffset=(olIe4)?eval('o3_frame.'+docRoot+'.scrollTop'):o3_frame.pageYOffset;placeY=runHook('verticalPlacement',FCHAIN,iheight,scrolloffset);repositionTo(over,placeX,placeY);}
function olMouseMove(e){var e=(e)?e:event;if(e.pageX){o3_x=e.pageX;o3_y=e.pageY;}else if(e.clientX){o3_x=eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft');o3_y=eval('e.clientY+o3_frame.'+docRoot+'.scrollTop');}
if(o3_allowmove==1)runHook("placeLayer",FREPLACE);if(hoveringSwitch&&!olNs4&&runHook("cursorOff",FREPLACE)){(olHideDelay?hideDelay(olHideDelay):cClick());hoveringSwitch=!hoveringSwitch;}}
function no_overlib(){return ver3fix;}
function olMouseCapture(){capExtent=document;var fN,str='',l,k,f,wMv,sS,mseHandler=olMouseMove;var re=/function[ ]*(\w*)\(/;wMv=(!olIe4&&window.onmousemove);if(document.onmousemove||wMv){if(wMv)capExtent=window;f=capExtent.onmousemove.toString();fN=f.match(re);if(fN==null){str=f+'(e); ';}else if(fN[1]=='anonymous'||fN[1]=='olMouseMove'||(wMv&&fN[1]=='onmousemove')){if(!olOp&&wMv){l=f.indexOf('{')+1;k=f.lastIndexOf('}');sS=f.substring(l,k);if((l=sS.indexOf('('))!=-1){sS=sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,'');if(eval("typeof "+sS+" == 'undefined'"))window.onmousemove=null;else str=sS+'(e);';}}
if(!str){olCheckMouseCapture=false;return;}}else{if(fN[1])str=fN[1]+'(e); ';else{l=f.indexOf('{')+1;k=f.lastIndexOf('}');str=f.substring(l,k)+'\n';}}
str+='olMouseMove(e); ';mseHandler=new Function('e',str);}
capExtent.onmousemove=mseHandler;if(olNs4)capExtent.captureEvents(Event.MOUSEMOVE);}
function parseTokens(pf,ar){var v,i,mode=-1,par=(pf!='ol_');var fnMark=(par&&!ar.length?1:0);for(i=0;i<ar.length;i++){if(mode<0){if(typeof ar[i]=='number'&&ar[i]>pmStart&&ar[i]<pmUpper){fnMark=(par?1:0);i--;}else{switch(pf){case'ol_':ol_text=ar[i].toString();break;default:o3_text=ar[i].toString();}}
mode=0;}else{if(ar[i]>=pmCount||ar[i]==DONOTHING){continue;}
if(ar[i]==INARRAY){fnMark=0;eval(pf+'text=ol_texts['+ar[++i]+'].toString()');continue;}
if(ar[i]==CAPARRAY){eval(pf+'cap=ol_caps['+ar[++i]+'].toString()');continue;}
if(ar[i]==STICKY){if(pf!='ol_')eval(pf+'sticky=1');continue;}
if(ar[i]==BACKGROUND){eval(pf+'background="'+ar[++i]+'"');continue;}
if(ar[i]==NOCLOSE){if(pf!='ol_')opt_NOCLOSE();continue;}
if(ar[i]==CAPTION){eval(pf+"cap='"+escSglQuote(ar[++i])+"'");continue;}
if(ar[i]==CENTER||ar[i]==LEFT||ar[i]==RIGHT){eval(pf+'hpos='+ar[i]);if(pf!='ol_')olHautoFlag=1;continue;}
if(ar[i]==OFFSETX){eval(pf+'offsetx='+ar[++i]);continue;}
if(ar[i]==OFFSETY){eval(pf+'offsety='+ar[++i]);continue;}
if(ar[i]==FGCOLOR){eval(pf+'fgcolor="'+ar[++i]+'"');continue;}
if(ar[i]==BGCOLOR){eval(pf+'bgcolor="'+ar[++i]+'"');continue;}
if(ar[i]==TEXTCOLOR){eval(pf+'textcolor="'+ar[++i]+'"');continue;}
if(ar[i]==CAPCOLOR){eval(pf+'capcolor="'+ar[++i]+'"');continue;}
if(ar[i]==CLOSECOLOR){eval(pf+'closecolor="'+ar[++i]+'"');continue;}
if(ar[i]==WIDTH){eval(pf+'width='+ar[++i]);continue;}
if(ar[i]==BORDER){eval(pf+'border='+ar[++i]);continue;}
if(ar[i]==CELLPAD){i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad'));continue;}
if(ar[i]==STATUS){eval(pf+"status='"+escSglQuote(ar[++i])+"'");continue;}
if(ar[i]==AUTOSTATUS){eval(pf+'autostatus=('+pf+'autostatus == 1) ? 0 : 1');continue;}
if(ar[i]==AUTOSTATUSCAP){eval(pf+'autostatus=('+pf+'autostatus == 2) ? 0 : 2');continue;}
if(ar[i]==HEIGHT){eval(pf+'height='+pf+'aboveheight='+ar[++i]);continue;}
if(ar[i]==CLOSETEXT){eval(pf+"close='"+escSglQuote(ar[++i])+"'");continue;}
if(ar[i]==SNAPX){eval(pf+'snapx='+ar[++i]);continue;}
if(ar[i]==SNAPY){eval(pf+'snapy='+ar[++i]);continue;}
if(ar[i]==FIXX){eval(pf+'fixx='+ar[++i]);continue;}
if(ar[i]==FIXY){eval(pf+'fixy='+ar[++i]);continue;}
if(ar[i]==RELX){eval(pf+'relx='+ar[++i]);continue;}
if(ar[i]==RELY){eval(pf+'rely='+ar[++i]);continue;}
if(ar[i]==FGBACKGROUND){eval(pf+'fgbackground="'+ar[++i]+'"');continue;}
if(ar[i]==BGBACKGROUND){eval(pf+'bgbackground="'+ar[++i]+'"');continue;}
if(ar[i]==PADX){eval(pf+'padxl='+ar[++i]);eval(pf+'padxr='+ar[++i]);continue;}
if(ar[i]==PADY){eval(pf+'padyt='+ar[++i]);eval(pf+'padyb='+ar[++i]);continue;}
if(ar[i]==FULLHTML){if(pf!='ol_')eval(pf+'fullhtml=1');continue;}
if(ar[i]==BELOW||ar[i]==ABOVE){eval(pf+'vpos='+ar[i]);if(pf!='ol_')olVautoFlag=1;continue;}
if(ar[i]==CAPICON){eval(pf+'capicon="'+ar[++i]+'"');continue;}
if(ar[i]==TEXTFONT){eval(pf+"textfont='"+escSglQuote(ar[++i])+"'");continue;}
if(ar[i]==CAPTIONFONT){eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'");continue;}
if(ar[i]==CLOSEFONT){eval(pf+"closefont='"+escSglQuote(ar[++i])+"'");continue;}
if(ar[i]==TEXTSIZE){eval(pf+'textsize="'+ar[++i]+'"');continue;}
if(ar[i]==CAPTIONSIZE){eval(pf+'captionsize="'+ar[++i]+'"');continue;}
if(ar[i]==CLOSESIZE){eval(pf+'closesize="'+ar[++i]+'"');continue;}
if(ar[i]==TIMEOUT){eval(pf+'timeout='+ar[++i]);continue;}
if(ar[i]==FUNCTION){if(pf=='ol_'){if(typeof ar[i+1]!='number'){v=ar[++i];ol_function=(typeof v=='function'?v:null);}}else{fnMark=0;v=null;if(typeof ar[i+1]!='number')v=ar[++i];opt_FUNCTION(v);}continue;}
if(ar[i]==DELAY){eval(pf+'delay='+ar[++i]);continue;}
if(ar[i]==HAUTO){eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0');continue;}
if(ar[i]==VAUTO){eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0');continue;}
if(ar[i]==CLOSECLICK){eval(pf+'closeclick=('+pf+'closeclick == 0) ? 1 : 0');continue;}
if(ar[i]==WRAP){eval(pf+'wrap=('+pf+'wrap == 0) ? 1 : 0');continue;}
if(ar[i]==FOLLOWMOUSE){eval(pf+'followmouse=('+pf+'followmouse == 1) ? 0 : 1');continue;}
if(ar[i]==MOUSEOFF){eval(pf+'mouseoff=('+pf+'mouseoff==0) ? 1 : 0');v=ar[i+1];if(pf!='ol_'&&eval(pf+'mouseoff')&&typeof v=='number'&&(v<pmStart||v>pmUpper))olHideDelay=ar[++i];continue;}
if(ar[i]==CLOSETITLE){eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'");continue;}
if(ar[i]==CSSOFF||ar[i]==CSSCLASS){eval(pf+'css='+ar[i]);continue;}
if(ar[i]==COMPATMODE){eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0');continue;}
if(ar[i]==FGCLASS){eval(pf+'fgclass="'+ar[++i]+'"');continue;}
if(ar[i]==BGCLASS){eval(pf+'bgclass="'+ar[++i]+'"');continue;}
if(ar[i]==TEXTFONTCLASS){eval(pf+'textfontclass="'+ar[++i]+'"');continue;}
if(ar[i]==CAPTIONFONTCLASS){eval(pf+'captionfontclass="'+ar[++i]+'"');continue;}
if(ar[i]==CLOSEFONTCLASS){eval(pf+'closefontclass="'+ar[++i]+'"');continue;}
i=parseCmdLine(pf,i,ar);}}
if(fnMark&&o3_function)o3_text=o3_function();if((pf=='o3_')&&o3_wrap){o3_width=0;var tReg=/<.*\n*>/ig;if(!tReg.test(o3_text))o3_text=o3_text.replace(/[ ]+/g,' ');if(!tReg.test(o3_cap))o3_cap=o3_cap.replace(/[ ]+/g,' ');}
if((pf=='o3_')&&o3_sticky){if(!o3_close&&(o3_frame!=ol_frame))o3_close=ol_close;if(o3_mouseoff&&(o3_frame==ol_frame))opt_NOCLOSE(' ');}}
function layerWrite(txt){txt+="\n";if(olNs4){var lyr=o3_frame.document.layers['overDiv'].document
lyr.write(txt)
lyr.close()}else if(typeof over.innerHTML!='undefined'){if(olIe5&&isMac)over.innerHTML='';over.innerHTML=txt;}else{range=o3_frame.document.createRange();range.setStartAfter(over);domfrag=range.createContextualFragment(txt);while(over.hasChildNodes()){over.removeChild(over.lastChild);}
over.appendChild(domfrag);}}
function showObject(obj){runHook("showObject",FBEFORE);var theObj=(olNs4?obj:obj.style);theObj.visibility='visible';runHook("showObject",FAFTER);}
function hideObject(obj){runHook("hideObject",FBEFORE);var theObj=(olNs4?obj:obj.style);if(olNs6&&olShowId>0){clearTimeout(olShowId);olShowId=0;}
theObj.visibility='hidden';theObj.top=theObj.left=((olIe4&&!olOp)?0:-10000)+(!olNs4?'px':0);if(o3_timerid>0)clearTimeout(o3_timerid);if(o3_delayid>0)clearTimeout(o3_delayid);o3_timerid=0;o3_delayid=0;self.status="";if(obj.onmouseout||obj.onmouseover){if(olNs4)obj.releaseEvents(Event.MOUSEOUT||Event.MOUSEOVER);obj.onmouseout=obj.onmouseover=null;}
runHook("hideObject",FAFTER);}
function repositionTo(obj,xL,yL){var theObj=(olNs4?obj:obj.style);theObj.left=xL+(!olNs4?'px':0);theObj.top=yL+(!olNs4?'px':0);}
function cursorOff(){var left=parseInt(over.style.left);var top=parseInt(over.style.top);var right=left+(over.offsetWidth>=parseInt(o3_width)?over.offsetWidth:parseInt(o3_width));var bottom=top+(over.offsetHeight>=o3_aboveheight?over.offsetHeight:o3_aboveheight);if(o3_x<left||o3_x>right||o3_y<top||o3_y>bottom)return true;return false;}
function opt_FUNCTION(callme){o3_text=(callme?(typeof callme=='string'?(/.+\(.*\)/.test(callme)?eval(callme):callme):callme()):(o3_function?o3_function():'No Function'));return 0;}
function opt_NOCLOSE(unused){if(!unused)o3_close="";if(olNs4){over.captureEvents(Event.MOUSEOUT||Event.MOUSEOVER);over.onmouseover=function(){if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;}}
over.onmouseout=function(e){if(olHideDelay)hideDelay(olHideDelay);else cClick(e);}}else{over.onmouseover=function(){hoveringSwitch=true;if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;}}}
return 0;}
function opt_MULTIPLEARGS(i,args,parameter){var k=i,re,pV,str='';for(k=i;k<args.length;k++){if(typeof args[k]=='number'&&args[k]>pmStart)break;str+=args[k]+',';}
if(str)str=str.substring(0,--str.length);k--;pV=(olNs4&&/cellpad/i.test(parameter))?str.split(',')[0]:str;eval(parameter+'="'+pV+'"');return k;}
function nbspCleanup(){if(o3_wrap){o3_text=o3_text.replace(/\ /g,' ');o3_cap=o3_cap.replace(/\ /g,' ');}}
function escSglQuote(str){return str.toString().replace(/'/g,"\\'");}
function OLonLoad_handler(e){var re=/\w+\(.*\)[;\s]+/g,olre=/overlib\(|nd\(|cClick\(/,fn,l,i;if(!olLoaded)olLoaded=1;if(window.removeEventListener&&e.eventPhase==3)window.removeEventListener("load",OLonLoad_handler,false);else if(window.detachEvent){window.detachEvent("onload",OLonLoad_handler);var fN=document.body.getAttribute('onload');if(fN){fN=fN.toString().match(re);if(fN&&fN.length){for(i=0;i<fN.length;i++){if(/anonymous/.test(fN[i]))continue;while((l=fN[i].search(/\)[;\s]+/))!=-1){fn=fN[i].substring(0,l+1);fN[i]=fN[i].substring(l+2);if(olre.test(fn))eval(fn);}}}}}}
function wrapStr(endWrap,fontSizeStr,whichString){var fontStr,fontColor,isClose=((whichString=='close')?1:0),hasDims=/[%\-a-z]+$/.test(fontSizeStr);fontSizeStr=(olNs4)?(!hasDims?fontSizeStr:'1'):fontSizeStr;if(endWrap)return(hasDims&&!olNs4)?(isClose?'</span>':'</div>'):'</font>';else{fontStr='o3_'+whichString+'font';fontColor='o3_'+((whichString=='caption')?'cap':whichString)+'color';return(hasDims&&!olNs4)?(isClose?'<span style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">':'<div style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">'):'<font face="'+eval(fontStr)+'" color="'+eval(fontColor)+'" size="'+(parseInt(fontSizeStr)>7?'7':fontSizeStr)+'">';}}
function quoteMultiNameFonts(theFont){var v,pM=theFont.split(',');for(var i=0;i<pM.length;i++){v=pM[i];v=v.replace(/^\s+/,'').replace(/\s+$/,'');if(/\s/.test(v)&&!/['"]/.test(v)){v="\'"+v+"\'";pM[i]=v;}}
return pM.join();}
function isExclusive(args){return false;}
function setCellPadStr(parameter){var Str='',j=0,ary=new Array(),top,bottom,left,right;Str+='padding: ';ary=parameter.replace(/\s+/g,'').split(',');switch(ary.length){case 2:top=bottom=ary[j];left=right=ary[++j];break;case 3:top=ary[j];left=right=ary[++j];bottom=ary[++j];break;case 4:top=ary[j];right=ary[++j];bottom=ary[++j];left=ary[++j];break;}
Str+=((ary.length==1)?ary[0]+'px;':top+'px '+right+'px '+bottom+'px '+left+'px;');return Str;}
function hideDelay(time){if(time&&!o3_delay){if(o3_timerid>0)clearTimeout(o3_timerid);o3_timerid=setTimeout("cClick()",(o3_timeout=time));}}
function horizontalPlacement(browserWidth,horizontalScrollAmount,widthFix){var placeX,iwidth=browserWidth,winoffset=horizontalScrollAmount;var parsedWidth=parseInt(o3_width);if(o3_fixx>-1||o3_relx!=null){placeX=(o3_relx!=null?(o3_relx<0?winoffset+o3_relx+iwidth-parsedWidth-widthFix:winoffset+o3_relx):o3_fixx);}else{if(o3_hauto==1){if((o3_x-winoffset)>(iwidth/2)){o3_hpos=LEFT;}else{o3_hpos=RIGHT;}}
if(o3_hpos==CENTER){placeX=o3_x+o3_offsetx-(parsedWidth/2);if(placeX<winoffset)placeX=winoffset;}
if(o3_hpos==RIGHT){placeX=o3_x+o3_offsetx;if((placeX+parsedWidth)>(winoffset+iwidth-widthFix)){placeX=iwidth+winoffset-parsedWidth-widthFix;if(placeX<0)placeX=0;}}
if(o3_hpos==LEFT){placeX=o3_x-o3_offsetx-parsedWidth;if(placeX<winoffset)placeX=winoffset;}
if(o3_snapx>1){var snapping=placeX%o3_snapx;if(o3_hpos==LEFT){placeX=placeX-(o3_snapx+snapping);}else{placeX=placeX+(o3_snapx-snapping);}
if(placeX<winoffset)placeX=winoffset;}}
return placeX;}
function verticalPlacement(browserHeight,verticalScrollAmount){var placeY,iheight=browserHeight,scrolloffset=verticalScrollAmount;var parsedHeight=(o3_aboveheight?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight));if(o3_fixy>-1||o3_rely!=null){placeY=(o3_rely!=null?(o3_rely<0?scrolloffset+o3_rely+iheight-parsedHeight:scrolloffset+o3_rely):o3_fixy);}else{if(o3_vauto==1){if((o3_y-scrolloffset)>(iheight/2)&&o3_vpos==BELOW&&(o3_y+parsedHeight+o3_offsety-(scrolloffset+iheight)>0)){o3_vpos=ABOVE;}else if(o3_vpos==ABOVE&&(o3_y-(parsedHeight+o3_offsety)-scrolloffset<0)){o3_vpos=BELOW;}}
if(o3_vpos==ABOVE){if(o3_aboveheight==0)o3_aboveheight=parsedHeight;placeY=o3_y-(o3_aboveheight+o3_offsety);if(placeY<scrolloffset)placeY=scrolloffset;}else{placeY=o3_y+o3_offsety;}
if(o3_snapy>1){var snapping=placeY%o3_snapy;if(o3_aboveheight>0&&o3_vpos==ABOVE){placeY=placeY-(o3_snapy+snapping);}else{placeY=placeY+(o3_snapy-snapping);}
if(placeY<scrolloffset)placeY=scrolloffset;}}
return placeY;}
function checkPositionFlags(){if(olHautoFlag)olHautoFlag=o3_hauto=0;if(olVautoFlag)olVautoFlag=o3_vauto=0;return true;}
function windowWidth(){var w;if(o3_frame.innerWidth)w=o3_frame.innerWidth;else if(eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientWidth=='number'")&&eval('o3_frame.'+docRoot+'.clientWidth'))
w=eval('o3_frame.'+docRoot+'.clientWidth');return w;}
function createDivContainer(id,frm,zValue){id=(id||'overDiv'),frm=(frm||o3_frame),zValue=(zValue||1000);var objRef,divContainer=layerReference(id);if(divContainer==null){if(olNs4){divContainer=frm.document.layers[id]=new Layer(window.innerWidth,frm);objRef=divContainer;}else{var body=(olIe4?frm.document.all.tags('BODY')[0]:frm.document.getElementsByTagName("BODY")[0]);if(olIe4&&!document.getElementById){body.insertAdjacentHTML("beforeEnd",'<div id="'+id+'"></div>');divContainer=layerReference(id);}else{divContainer=frm.document.createElement("DIV");divContainer.id=id;body.appendChild(divContainer);}
objRef=divContainer.style;}
objRef.position='absolute';objRef.visibility='hidden';objRef.zIndex=zValue;if(olIe4&&!olOp)objRef.left=objRef.top='0px';else objRef.left=objRef.top=-10000+(!olNs4?'px':0);}
return divContainer;}
function layerReference(id){return(olNs4?o3_frame.document.layers[id]:(document.all?o3_frame.document.all[id]:o3_frame.document.getElementById(id)));}
function isFunction(fnRef){var rtn=true;if(typeof fnRef=='object'){for(var i=0;i<fnRef.length;i++){if(typeof fnRef[i]=='function')continue;rtn=false;break;}}else if(typeof fnRef!='function'){rtn=false;}
return rtn;}
function argToString(array,strtInd,argName){var jS=strtInd,aS='',ar=array;argName=(argName?argName:'ar');if(ar.length>jS){for(var k=jS;k<ar.length;k++)aS+=argName+'['+k+'], ';aS=aS.substring(0,aS.length-2);}
return aS;}
function reOrder(hookPt,fnRef,order){var newPt=new Array(),match,i,j;if(!order||typeof order=='undefined'||typeof order=='number')return hookPt;if(typeof order=='function'){if(typeof fnRef=='object'){newPt=newPt.concat(fnRef);}else{newPt[newPt.length++]=fnRef;}
for(i=0;i<hookPt.length;i++){match=false;if(typeof fnRef=='function'&&hookPt[i]==fnRef){continue;}else{for(j=0;j<fnRef.length;j++)if(hookPt[i]==fnRef[j]){match=true;break;}}
if(!match)newPt[newPt.length++]=hookPt[i];}
newPt[newPt.length++]=order;}else if(typeof order=='object'){if(typeof fnRef=='object'){newPt=newPt.concat(fnRef);}else{newPt[newPt.length++]=fnRef;}
for(j=0;j<hookPt.length;j++){match=false;if(typeof fnRef=='function'&&hookPt[j]==fnRef){continue;}else{for(i=0;i<fnRef.length;i++)if(hookPt[j]==fnRef[i]){match=true;break;}}
if(!match)newPt[newPt.length++]=hookPt[j];}
for(i=0;i<newPt.length;i++)hookPt[i]=newPt[i];newPt.length=0;for(j=0;j<hookPt.length;j++){match=false;for(i=0;i<order.length;i++){if(hookPt[j]==order[i]){match=true;break;}}
if(!match)newPt[newPt.length++]=hookPt[j];}
newPt=newPt.concat(order);}
hookPt=newPt;return hookPt;}
function setRunTimeVariables(){if(typeof runTime!='undefined'&&runTime.length){for(var k=0;k<runTime.length;k++){runTime[k]();}}}
function parseCmdLine(pf,i,args){if(typeof cmdLine!='undefined'&&cmdLine.length){for(var k=0;k<cmdLine.length;k++){var j=cmdLine[k](pf,i,args);if(j>-1){i=j;break;}}}
return i;}
function postParseChecks(pf,args){if(typeof postParse!='undefined'&&postParse.length){for(var k=0;k<postParse.length;k++){if(postParse[k](pf,args))continue;return false;}}
return true;}
function registerCommands(cmdStr){if(typeof cmdStr!='string')return;var pM=cmdStr.split(',');pms=pms.concat(pM);for(var i=0;i<pM.length;i++){eval(pM[i].toUpperCase()+'='+pmCount++);}}
function registerNoParameterCommands(cmdStr){if(!cmdStr&&typeof cmdStr!='string')return;pmt=(!pmt)?cmdStr:pmt+','+cmdStr;}
function registerHook(fnHookTo,fnRef,hookType,optPm){var hookPt,last=typeof optPm;if(fnHookTo=='plgIn'||fnHookTo=='postParse')return;if(typeof hookPts[fnHookTo]=='undefined')hookPts[fnHookTo]=new FunctionReference();hookPt=hookPts[fnHookTo];if(hookType!=null){if(hookType==FREPLACE){hookPt.ovload=fnRef;if(fnHookTo.indexOf('ol_content_')>-1)hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef;}else if(hookType==FBEFORE||hookType==FAFTER){var hookPt=(hookType==1?hookPt.before:hookPt.after);if(typeof fnRef=='object'){hookPt=hookPt.concat(fnRef);}else{hookPt[hookPt.length++]=fnRef;}
if(optPm)hookPt=reOrder(hookPt,fnRef,optPm);}else if(hookType==FALTERNATE){if(last=='number')hookPt.alt[pms[optPm-1-pmStart]]=fnRef;}else if(hookType==FCHAIN){hookPt=hookPt.chain;if(typeof fnRef=='object')hookPt=hookPt.concat(fnRef);else hookPt[hookPt.length++]=fnRef;}
return;}}
function registerRunTimeFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){runTime=runTime.concat(fn);}else{runTime[runTime.length++]=fn;}}}
function registerCmdLineFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){cmdLine=cmdLine.concat(fn);}else{cmdLine[cmdLine.length++]=fn;}}}
function registerPostParseFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){postParse=postParse.concat(fn);}else{postParse[postParse.length++]=fn;}}}
function runHook(fnHookTo,hookType){var l=hookPts[fnHookTo],k,rtnVal=null,optPm,arS,ar=runHook.arguments;if(hookType==FREPLACE){arS=argToString(ar,2);if(typeof l=='undefined'||!(l=l.ovload))rtnVal=eval(fnHookTo+'('+arS+')');else rtnVal=eval('l('+arS+')');}else if(hookType==FBEFORE||hookType==FAFTER){if(typeof l!='undefined'){l=(hookType==1?l.before:l.after);if(l.length){arS=argToString(ar,2);for(var k=0;k<l.length;k++)eval('l[k]('+arS+')');}}}else if(hookType==FALTERNATE){optPm=ar[2];arS=argToString(ar,3);if(typeof l=='undefined'||(l=l.alt[pms[optPm-1-pmStart]])=='undefined'){rtnVal=eval(fnHookTo+'('+arS+')');}else{rtnVal=eval('l('+arS+')');}}else if(hookType==FCHAIN){arS=argToString(ar,2);l=l.chain;for(k=l.length;k>0;k--)if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0))break;}
return rtnVal;}
function FunctionReference(){this.ovload=null;this.before=new Array();this.after=new Array();this.alt=new Array();this.chain=new Array();}
function Info(version,prerelease){this.version=version;this.prerelease=prerelease;this.simpleversion=Math.round(this.version*100);this.major=parseInt(this.simpleversion/100);this.minor=parseInt(this.simpleversion/10)-this.major*10;this.revision=parseInt(this.simpleversion)-this.major*100-this.minor*10;this.meets=meets;}
function meets(reqdVersion){return(!reqdVersion)?false:this.simpleversion>=Math.round(100*parseFloat(reqdVersion));}
registerHook("ol_content_simple",ol_content_simple,FALTERNATE,CSSOFF);registerHook("ol_content_caption",ol_content_caption,FALTERNATE,CSSOFF);registerHook("ol_content_background",ol_content_background,FALTERNATE,CSSOFF);registerHook("ol_content_simple",ol_content_simple,FALTERNATE,CSSCLASS);registerHook("ol_content_caption",ol_content_caption,FALTERNATE,CSSCLASS);registerHook("ol_content_background",ol_content_background,FALTERNATE,CSSCLASS);registerPostParseFunction(checkPositionFlags);registerHook("hideObject",nbspCleanup,FAFTER);registerHook("horizontalPlacement",horizontalPlacement,FCHAIN);registerHook("verticalPlacement",verticalPlacement,FCHAIN);if(olNs4||(olIe5&&isMac)||olKq)olLoaded=1;registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode');var olCheckMouseCapture=true;if((olNs4||olNs6||olIe4)){olMouseCapture();}else{overlib=no_overlib;nd=no_overlib;ver3fix=true;}
/******************/
/**	AVAILABILITY **/
/******************/

var TendmeAvailability = {

	init: function() {
		var ref = this;
		var links = document.getElementsByName('availability_link');

		if (navigator.appName=="Microsoft Internet Explorer") {
			for(var i = 0; i < links.length; i++) {
				links[i].onclick = function(){ ref.checkDay(this); return true; };
			}
		} else {
			for(var i = 0; i < links.length; i++) {
				links[i].onchange = function(){ ref.checkDay(this); return false; };
			}
		}
		
		var all = document.getElementById("availability_all");
		
		if(all) {
			all.onclick = function(){ ref.checkAllOrNone("all"); return false; };
		}
		
		var none = document.getElementById("availability_none");
		
		if(none) {
			none.onclick = function(){ ref.checkAllOrNone("none"); return false; };
		}
	},
	
	checkDay: function(checkbox) {
		var id = checkbox.id;
		
		// for edit availability old (babysitter, seniorcare, tutor)
		var dayLinks = document.getElementsByName("provider.availability." + id);
		var checked =  checkbox.checked;
		
		for(var i = 0; i < dayLinks.length; i++) {
			if(checked == true) {
				dayLinks[i].checked = true;
			}
			else {
				dayLinks[i].checked = false;
			}
		}

		// for edit availability new (petcare)
		var dayLinksPet = document.getElementsByName(checkbox.value);
		for(var i = 0; i < dayLinksPet.length; i++) {
			if(checked == true) {
				dayLinksPet[i].checked = true;
			}
			else {
				dayLinksPet[i].checked = false;
			}
		}

		// for edit availability new (petcare)
		var dayLinksFilterSearch = document.getElementsByName("profile." + checkbox.value);
		for(var i = 0; i < dayLinksFilterSearch.length; i++) {
			if(checked == true) {
				dayLinksFilterSearch[i].checked = true;
			}
			else {
				dayLinksFilterSearch[i].checked = false;
			}
		}
		

	},
	
	checkAllOrNone: function(type) {
		var links = document.getElementsByName('availability_link');
		for(var i = 0; i < links.length; i++) {
			if (type == "all") {
				links[i].checked = true;
			} else {
				links[i].checked = false;
			}
			this.checkDay(links[i]);
		}
	}
};
Tendme.addPageLoadModule(TendmeAvailability);



/*************/
/**	SEARCH	**/
/*************/

var TendmeSearch = {

	init: function() {
		var ref = this;
		var form = document.getElementById("submitOnSelect");
		var form2 = document.getElementById("submitOnSelectSortlist");
		var form3 = document.getElementById("submitOnClickResults");
		
		if(form3) {
			// doesn't work, don't know why
			// var obj = jQuery(".blueLink", form);
			var obj1 = document.getElementById("resultsPerPage_1");
			var obj2 = document.getElementById("resultsPerPage_2");
			var obj3 = document.getElementById("resultsPerPage_3");
			var obj4 = document.getElementById("resultsPerPage_4");
			obj1.onclick = function(){ 
				document.getElementById("navigateList.resultsPerPage").value = document.getElementById("resultsPerPage_1").value;
				form3.submit(); return false; 
				};
			obj2.onclick = function(){ 
				document.getElementById("navigateList.resultsPerPage").value = document.getElementById("resultsPerPage_2").value;
				form3.submit(); return false; 
			};
			obj3.onclick = function(){ 
				document.getElementById("navigateList.resultsPerPage").value = document.getElementById("resultsPerPage_3").value;
				form3.submit(); return false; 
			};
			obj4.onclick = function(){ 
				document.getElementById("navigateList.resultsPerPage").value = document.getElementById("resultsPerPage_4").value;
				form3.submit(); return false; 
			};
		}
		
		/* a change on the select box causes a submit of the specified form */
		if(form) {
			// doesn't work, don't know why
			//var obj = jQuery(".selectBox", form);
			var obj = document.getElementById("numberResults");
			obj.onchange = function(){ ref.changeSearch(); return false; };
		}
		
		if(form2) {
			// doesn't work, don't know why
			//var obj = jQuery(".selectBox", form);
			var obj = document.getElementById("sortlist");
			obj.onchange = function(){ ref.changeSortlist(); return false; };
		}
		
		/* a click on the link causes a submit of the specified form */
		var form = document.getElementById("submitOnClick");
		if(form) {
			// doesn't work, don't know why
			// var obj = jQuery(".blueLink", form);
			var obj = document.getElementById("linkSearchResults");
			obj.onclick = function(){ ref.getMyNeighborhood(); return false; };
		}
		
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("linkAvailability");
		if(obj) {
			obj.onclick = function(){ ref.showAvailability();$('layer_bg').style.display='block'; return false; };
		}
		
		/* hides the availability box in the search page */
		var obj = document.getElementById("linkCloseAvailability");
		if(obj) {
			obj.onclick = function(){ ref.hideAvailability();$('layer_bg').style.display='none'; return false; };
		}

		
		/* makes the hidden box in the more jobs tab ( my account ) visible */
		var obj = document.getElementById("showFilterLayerMoreJobs");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerMoreJobs(); return false; };
		}
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerBabysitter");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerBabysitter(); return false; };
		}
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerBabysitterRequest");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerBabysitterRequest(); return false; };
		}
		/* hides the hidden box in the more jobs tab ( my account ) page */
		var obj = document.getElementById("closeFilterLayerMoreJobs");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerMoreJobs(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerBabysitter");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerBabysitter(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerBabysitterRequest");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerBabysitterRequest(); return false; };
		}
		
		
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerPetcare");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerPetcare(); return false; };
		}
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerPetcareRequest");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerPetcareRequest(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerPetcare");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerPetcare(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerPetcareRequest");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerPetcareRequest(); return false; };
		}
		
		
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerSeniorcare");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerSeniorcare(); return false; };
		}
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerSeniorcareRequest");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerSeniorcareRequest(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerSeniorcare");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerSeniorcare(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerSeniorcareRequest");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerSeniorcareRequest(); return false; };
		}
		
		
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerTutor");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerTutor(); return false; };
		}
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerTutorRequest");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerTutorRequest(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerTutor");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerTutor(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerTutorRequest");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerTutorRequest(); return false; };
		}
		
		
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerHomehelp");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerHomehelp(); return false; };
		}
		/* makes the hidden availability box in the search page visible */
		var obj = document.getElementById("showFilterLayerHomehelpRequest");
		if(obj) {
			obj.onclick = function(){ ref.showFilterLayerHomehelpRequest(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerHomehelp");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerHomehelp(); return false; };
		}
		/* hides the availability box in the search page */
		var obj = document.getElementById("closeFilterLayerHomehelpRequest");
		if(obj) {
			obj.onclick = function(){ ref.hideFilterLayerHomehelpRequest(); return false; };
		}
		
		
		/* sends a form if a static url was clicked 
		   (needed for sending key without the knowledge of the user) */
		var links = document.links;
		
		for (var i = 0; i < links.length; i++) {
			if (links[i].id.substr(0,5) == "link_") {
				links[i].onclick = function(){ ref.submitDetailForm(this); return false; };
			}
		}
		
		/* for detail page, link for sending message by clicking submit */
		var submitSendMessage = document.getElementById("submit_send_message");
		
		if(submitSendMessage) {
			submitSendMessage.onclick = function(){ ref.sendMessage(); return false; };
		}
	},
	
	changeSearch: function(){
		// damn JavaScript, can't submit form object to this method, should be fixed
		var form = document.getElementById("submitOnSelect");
		form.submit();
	},
	
	changeSortlist: function(){
		// damn JavaScript, can't submit form object to this method, should be fixed
		var form = document.getElementById("submitOnSelectSortlist");
		form.submit();
	},
	
	getMyNeighborhood: function(form1) {
		// damn JavaScript, can't submit form object to this method, should be fixed
		var form = document.getElementById("submitOnClick");
		form.submit();
	},
	
	showAvailability: function() {
		var div = document.getElementById("hiddenAvailability");
	
		if (navigator.appName == "Microsoft Internet Explorer") {
			var showEvent = window.event;
			
			var x = event.offsetX + 120;
			var y = event.offsetY - 40;
			
			div.style.position="absolute";
			div.style.width='660px';
			div.style.zIndex = 100;
			div.style.left = x+'px';
			div.style.top = y+'px';
			div.style.display = "block";
		}
		else {
			var obj = document.getElementById("linkAvailability");
			if (div.style.display == "none") {
				div.style.position="relative";
				div.style.zIndex = 100;
				div.style.marginTop = "-180px";
				div.style.marginLeft = "80px";
				div.style.display = "block";
			}
		}
	},
	
	hideAvailability: function() {
		var div = document.getElementById("hiddenAvailability");

		if (div.style.display == "block" || div.style.display == "") {
			div.style.display = "none";
		}
	},
	
	submitDetailForm: function(link) {
		var index = link.id.lastIndexOf('_');
		var counter = link.id.substr(index + 1); // gets index of search list
		
		var form = document.getElementById("form_details_" + counter);
		form.submit();
	},
	
	sendMessage: function() {
		var link = document.getElementById("link_send_message");
		
		window.location.href = link;
	},
	
	showFilterLayerMoreJobs: function() {
		var div = document.getElementById("filterLayerMoreJobs");
		
		if (div.style.display == "none") {
			div.style.position="relative";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},

	hideFilterLayerMoreJobs: function() {
		var div = document.getElementById("filterLayerMoreJobs");
		
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},
	
	
	showFilterLayerBabysitter: function() {
		var div = document.getElementById("filterLayerBabysitter");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},

	hideFilterLayerBabysitter: function() {
		var div = document.getElementById("filterLayerBabysitter");
		
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},

	showFilterLayerBabysitterRequest: function() {
		var div = document.getElementById("filterLayerBabysitterRequest");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},
	
	hideFilterLayerBabysitterRequest: function() {
		var div = document.getElementById("filterLayerBabysitterRequest");
	
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},
	
	
	
	showFilterLayerPetcare: function() {
		var div = document.getElementById("filterLayerPetcare");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},
	
	hideFilterLayerPetcare: function() {
		var div = document.getElementById("filterLayerPetcare");
		
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},

	showFilterLayerPetcareRequest: function() {
		var div = document.getElementById("filterLayerPetcareRequest");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},
	
	hideFilterLayerPetcareRequest: function() {
		var div = document.getElementById("filterLayerPetcareRequest");
	
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},
	
	
	
	showFilterLayerSeniorcare: function() {
		var div = document.getElementById("filterLayerSeniorcare");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},
	
	hideFilterLayerSeniorcare: function() {
		var div = document.getElementById("filterLayerSeniorcare");
		
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},

	showFilterLayerSeniorcareRequest: function() {
		var div = document.getElementById("filterLayerSeniorcareRequest");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},

	hideFilterLayerSeniorcareRequest: function() {
		var div = document.getElementById("filterLayerSeniorcareRequest");
	
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},
	
	
	
	showFilterLayerTutor: function() {
		var div = document.getElementById("filterLayerTutor");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},
	
	hideFilterLayerTutor: function() {
		var div = document.getElementById("filterLayerTutor");
		
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},

	showFilterLayerTutorRequest: function() {
		var div = document.getElementById("filterLayerTutorRequest");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},
	
	hideFilterLayerTutorRequest: function() {
		var div = document.getElementById("filterLayerTutorRequest");
	
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},	
	
	
	
	showFilterLayerHomehelp: function() {
		var div = document.getElementById("filterLayerHomehelp");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},
	
	hideFilterLayerHomehelp: function() {
		var div = document.getElementById("filterLayerHomehelp");
		
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	},

	showFilterLayerHomehelpRequest: function() {
		var div = document.getElementById("filterLayerHomehelpRequest");
		
		if (div.style.display == "none") {
			div.style.position="absolute";
			div.style.zIndex = 100;
			div.style.marginTop = "-180px";
			div.style.marginLeft = "80px";
			div.style.display = "block";
		}
	},
	
	hideFilterLayerHomehelpRequest: function() {
		var div = document.getElementById("filterLayerHomehelpRequest");
	
		if (div.style.display == "block") {
			div.style.display = "none";
		}
	}
	
};

Tendme.addPageLoadModule(TendmeSearch);



/*********************/
/**		SUBJECT	 	**/
/*********************/
	
var TendmeTutorSubjects = {

	experiencedWithScholarSubjectsSelected:false,
	experiencedWithStudentSubjectsSelected:false,
	
	teachesScholarSubjectsSelected:false,
	teachesStudentSubjectsSelected:false,

	init: function() {
		var ref = this;
		
		var experiencedWithScholarSubjects = document.getElementById('toggle.experiencedWithScholarSubjects');
		if(experiencedWithScholarSubjects) {
			experiencedWithScholarSubjects.onclick = function(){ ref.checkExperiencedWithScholarSubjects(); return false; };
		}
		
		var experiencedWithStudentSubjects = document.getElementById('toggle.experiencedWithStudentSubjects');
		if(experiencedWithStudentSubjects) {
			experiencedWithStudentSubjects.onclick = function(){ ref.checkExperiencedWithStudentSubjects(); return false; };
		}

		var teachesScholarSubjects = document.getElementById('toggle.teachesScholarSubjects');
		if(teachesScholarSubjects) {
			teachesScholarSubjects.onclick = function(){ ref.checkTeachesScholarSubjects(); return false; };
		}

		var teachesStudentSubjects = document.getElementById('toggle.teachesStudentSubjects');
		if(teachesStudentSubjects) {
			teachesStudentSubjects.onclick = function(){ ref.checkTeachesStudentSubjects(); return false; };
		}
		
	},
	
	checkExperiencedWithScholarSubjects: function() {
		this.experiencedWithScholarSubjectsSelected=!this.experiencedWithScholarSubjectsSelected;
		this.checkAllOrNone(this.experiencedWithScholarSubjectsSelected, 'experiencedWithScholarSubjects');
	},
	
	checkExperiencedWithStudentSubjects: function() {
		this.experiencedWithStudentSubjectsSelected=!this.experiencedWithStudentSubjectsSelected;
		this.checkAllOrNone(this.experiencedWithStudentSubjectsSelected, 'experiencedWithStudentSubjects');
	},
	
	checkTeachesScholarSubjects: function() {
		this.teachesScholarSubjectsSelected=!this.teachesScholarSubjectsSelected;
		this.checkAllOrNone(this.teachesScholarSubjectsSelected, 'teachesScholarSubjects');
	},
	
	checkTeachesStudentSubjects: function() {
		this.teachesStudentSubjectsSelected=!this.teachesStudentSubjectsSelected;
		this.checkAllOrNone(this.teachesStudentSubjectsSelected, 'teachesStudentSubjects');
	},
	
	
	checkAllOrNone: function(checked, id) {
		var elements = document.getElementsByName(id);
		if(elements) {
			for(var i = 0; i < elements.length; i++) {
				elements[i].checked = checked;
			}
		}
	}
	
};
Tendme.addPageLoadModule(TendmeTutorSubjects);



/*********************/
/**		PLACES	 	**/
/*********************/

var TendmeTutorPlaces = {

	selected:false,

	init: function() {
		var ref = this;
		var all = document.getElementById("dontcare");
		
		if(all) {
			all.onclick = function(){ ref.checkAllOrNone(); return false; };
		}
		
	},
	
	checkAllOrNone: function() {
		var checkbox = jQuery('.checkBox');
		
		this.selected=!this.selected;
		
		var all = document.getElementById("dontcare");
		if(all) {
			all.checked = this.selected;
		}
		
		// Check or uncheck
		for(var i = 0; i < checkbox.length; i++) {
			var name = checkbox[i].name;
			var isAvailability = name.search(/tutoringPlaces/);
			
			if(isAvailability != -1) {
				checkbox[i].checked = this.selected;
			}
		}
		
		
	}
};
Tendme.addPageLoadModule(TendmeTutorPlaces);



/*********************/
/**		EXPAND	 	**/
/*********************/

var TendmeExpand = {

	init: function() {
		var ref = this;
		
		//var c = jQuery('.minus');
		var c = jQuery('.minus');
		for(var i = 0; i < c.length; i++){
			c[i].onclick = function(){ ref.collapse(this, jQuery('.block_body', this.parentNode)[0]); };
		}
		
		var e = jQuery('.plus');
		for(var i = 0; i < e.length; i++){
			e[i].onclick = function(){ ref.expand(this, jQuery('.block_body', this.parentNode.parentNode)[0]); };
		}
		
		var x = jQuery('.minus_1');
		for(var i = 0; i < x.length; i++){
			x[i].onclick = function(){ ref.collapse_1(this, jQuery('.block_body_1', this.parentNode)[0]); };
		}
		
		var y = jQuery('.plus_1');
		for(var i = 0; i < y.length; i++){
			y[i].onclick = function(){ ref.expand_1(this, jQuery('.block_body_1', this.parentNode.parentNode)[0]); };
		}
	},
	
	collapse: function(link, obj){
		var ref = this;
		link.onclick = null;
		
		jQuery(obj).fadeOut(function(){
			obj.style.display="none";
			//obj.style.visibility="hidden";
			link.removeClassName('minus');
			link.addClassName('plus');
			link.onclick = function(){ ref.expand(link, obj); return false; };
			
		});
	},
	
	expand: function(link, obj){
		var ref = this;
		link.onclick = null;
		
		jQuery(obj).fadeIn(function(){
			obj.style.display="inline";
			//obj.style.visibility="visible";
			link.removeClassName('plus');
			link.addClassName('minus');
			link.onclick = function(){ ref.collapse(link, obj); return false; };
			
		});
	},
	
	collapse_1: function(link, obj){
		var ref = this;
		link.onclick = null;
		
		jQuery(obj).fadeOut(function(){
			obj.style.display="none";
			//obj.style.visibility="hidden";
			link.removeClassName('minus_1');
			link.addClassName('plus_1');
			link.onclick = function(){ ref.expand_1(link, obj); return false; };
			
		});
	},
	
	expand_1: function(link, obj){
		var ref = this;
		link.onclick = null;
		
		jQuery(obj).fadeIn(function(){
			obj.style.display="inline";
			//obj.style.visibility="visible";
			link.removeClassName('plus_1');
			link.addClassName('minus_1');
			link.onclick = function(){ ref.collapse_1(link, obj); return false; };
			
		});
	}
};

Tendme.addPageLoadModule(TendmeExpand);



/*********************/
/**		VALIDATE	**/
/*********************/

var TendmeValidateForm = {
	init: function() {
		/** 
		 * validates text fields within a form
		 *
		 * needed id's ( <id> to be set by programmer ):
		 * form_validate_<id> -> id of the form for submit
		 * div_validate_present_<id> -> id of the div which holds the error message for not present (empty field)
		 * div_validate_invalid_<id> -> id of the div which holds the error message for invalid
		 * field_validate_<id> -> id of the field to be validated
		 * submit_validate_<id> -> id of the submit button
		 *
		 * class of button: btnS
		 */ 
		var ref = this;
		
		var submits = jQuery(".btnS");
		
		for (var i = 0; i < submits.length; i++) {
			var index = submits[i].id.lastIndexOf('_');
			var firstPart = submits[i].id.substring(0, index);
			
			if (firstPart == 'submit_validate') {
				submits[i].onclick = function(){ref.validateField(this); return false;};
			}
		}
	},
	
	validateField: function(button) {
		var index = button.id.lastIndexOf('_');
		var submitId = button.id.substr(index + 1);
		
		var field = document.getElementById("field_validate_"+submitId);
		if (field) {
			var value = field.value;
			
			if (value == '') {
				document.getElementById("div_validate_present_"+submitId).style.display = "block";
				document.getElementById("field_validate_"+submitId).style.color = "#b0232a";
				document.getElementById("field_validate_"+submitId).style.borderColor = "#b0232a";
			}
			else {
				if (value.match(/\d{5}/)) {
					var form = document.getElementById("form_validate_"+submitId).submit();
				}
				else {
					document.getElementById("div_validate_invalid_"+submitId).style.display = "block";
					document.getElementById("field_validate_"+submitId).style.color = "#b0232a";
					document.getElementById("field_validate_"+submitId).style.borderColor = "#b0232a";
				}
			}
		}
		
	}
};

Tendme.addPageLoadModule(TendmeValidateForm);



/*********************/
/**	RATING LIST		**/
/*********************/

var TendmeNavigateList = {

	init: function() {
		// script for expanding and collapsing box for ratings
		var ref = this;
		
		var links = jQuery('.expand');
		
		for(var a = 0; a < links.length; a++){
			links[a].onclick = function() { ref.expand(this); return false; }
			
		}
		
		// if there was a rating submitted change the text in the box and show it for 3 seconds
		var userIds = jQuery('.userId');
		
		for (var b = 0; b < userIds.length; b++) {
			var flag = jQuery('.ratingFlag')[0];
			
			if (flag && userIds[b].value == flag.value) {
				var lastIndex = userIds[b].id.lastIndexOf('_');
				var id = userIds[b].id.substr(lastIndex + 1);
				
				// hide rating form
				var hide = document.getElementById('form_rate_' + id);
				if (hide) {
					hide.style.display = "none";
				}
			
				// show "thanks for rating" text
				var show = document.getElementById('submitted_rate_' + id);
				if (show) {
					show.style.display = "inline";
				}
				
				// display the wohole box
				var obj = document.getElementById("boxSlide_edit_rating_" + id);
				obj.style.display = "block";
				
				// scroll to rating box if we have more then 2 boxes
				if (userIds.length > 2) {
					obj.scrollIntoView(true);
				}
				
				// after 3 seconds close it
				window.setTimeout("TendmeNavigateList.collapseRating(" + id + ")", 3000);
			}
		}
	},
	
	expand: function(link){
		var ref = this;
			
		// ref.collapseAll(); ??
		
		var newId = "boxSlide_"+link.id;
		
		var obj = document.getElementById(newId);
		
		jQuery(obj).fadeIn();
		
		//ref.init();
		ref.initStars();
		ref.initCancel();
		ref.initSubmit();
		
		window.setTimeout("document.getElementById('" + newId + "').scrollIntoView(true)", 300);
	},
	
	setValue: function(star){
		var firstIndex = star.id.indexOf('_');
		var lastIndex = star.id.lastIndexOf('_');
		var value = star.id.substr(star.id.length-1);
		var id = star.id.substr(0, star.id.length-1);
		
		var hideid = star.id.substring(firstIndex+1, lastIndex);
		var hiddens = jQuery('.hide_' + hideid);
	
		var hidden = hiddens[0];
		
		var values;
		var ids;
		
		var stars = jQuery('.stars');
		
		for(var a = 0; a < stars.length; a++){
			stars[a].src="static_media/pics/content/stern_leer.png";
		}
		
		for(var b = 0; b < stars.length; b++){
			//stars[b].src="static_media/pics/content/stern_voll.gif";
			values = stars[b].id.substr(star.id.length-1);
			ids = stars[b].id.substr(0, star.id.length-1);
			
			if (ids = id) {
				if (values <= value) {
					stars[b].src="static_media/pics/content/stern_voll.png";
				}
			}
		}
		
		hidden.value=value;
	},
	
	initStars: function() {
		var ref = this;
		var stars = jQuery('.stars');
		
		for(var a = 0; a < stars.length; a++){
			stars[a].onclick = function() {ref.setValue(this);};
		}
	},
	
	initCancel: function() {
		// rateSubmitab
		var ref = this;
		var id;
		var index;
		
		var cancel = jQuery('.rateSubmitab');
		for(var b = 0; b < cancel.length; b++){
			index = cancel[b].id.lastIndexOf('_');
			id = cancel[b].id.substr(index + 1);
			cancel[b].onclick = function() {ref.collapseRating(id);};
		}
	},
	
	initSubmit: function() {
		var ref = this;
		
		// TODO send form
		
		var submit = jQuery('.rateSubmit');
		for(var b = 0; b < submit.length; b++){
			submit[b].onclick = function() {ref.submitForm(this);};
		}
	},
	
	collapseRating: function(id) {
			
		// rate_box
		var box = jQuery('.rate_box');
		for(var b = 0; b < box.length; b++){
			index = box[b].id.lastIndexOf('_');
			var boxid = box[b].id.substr(index + 1);
			
			if(boxid = id) {
				jQuery(box).fadeOut(box[b]);
			}
		}
		
		// reset text
		var hide = document.getElementById('notClicked_' + id);
		if (hide) {
			hide.style.display = "none";
		}
			
		var show = document.getElementById('clickStars_' + id);
		if (show) {
			show.style.display = "inline";
		}
	},
	
	submitForm: function(submit) {
		var index = submit.id.lastIndexOf('_');
		var id = submit.id.substr(index + 1);
		var ref = this;
		
		/*new Ajax.Request(document.getElementById('form_rate_box_' + id).action,
							{parameters: $('form_rate_box_' + id).serialize(true)});*/
							
		// , $('bean.description').serialize(true), $('bean.userIdOfProvider').serialize(true)
		
		
		// if the user don't have choosed a value we display only another text
		if (document.getElementById('rating.ratingValue_' + id).value == '') {
			var hide = document.getElementById('clickStars_' + id);
			if (hide) {
				hide.style.display = "none";
			}
			
			var show = document.getElementById('notClicked_' + id);
			if (show) {
				show.style.display = "inline";
			}
		}
		else {
			ref.collapseRating(id);
		
			//document.getElementById('form_rate_box_' + id).submit();
		}
	}
};

Tendme.addPageLoadModule(TendmeNavigateList);



function swapForms(formToBeDisplayed, formToBeHidden){
    document.getElementById(formToBeDisplayed).style.visibility = "visible";           
    document.getElementById(formToBeHidden).style.visibility= "hidden";
  }


function showCurasSearch() {
	document.getElementById("curasSearch").style.visibility='visible';
	document.getElementById("curasSearch").style.display='block';
	document.getElementById("seniorCareSearch").style.visibility='hidden';
	document.getElementById("seniorCareSearch").style.display='none';
	document.getElementById("seniorbox_o").style.marginTop='-10px';
	document.getElementById("seniorbox_u").style.marginTop='0px';
}

function showSeniorCareSearch() {
	document.getElementById("seniorCareSearch").style.visibility='visible';
	document.getElementById("seniorCareSearch").style.display='block';
	document.getElementById("curasSearch").style.visibility='hidden';
	document.getElementById("curasSearch").style.display='none';
	document.getElementById("seniorbox_o").style.marginTop='0px';
	document.getElementById("seniorbox_u").style.marginTop='15px';
}

function invokeAction(form, event, container) {
	if (!form.onsubmit) { form.onsubmit = function() { return false; }; };
	jQuery('#success').load('/ContactBox.action?submitCallback&name=' + document.getElementById("name").value  + '&tel=' + document.getElementById("tel").value + '&email=' + document.getElementById("email").value);
}


