/*
 * jQuery replaceText - v1.1 - 11/21/2009
 * http://benalman.com/projects/jquery-replacetext-plugin/
 * 
 * Copyright (c) 2009 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($){$.fn.replaceText=function(b,a,c){return this.each(function(){var f=this.firstChild,g,e,d=[];if(f){do{if(f.nodeType===3){g=f.nodeValue;e=g.replace(b,a);if(e!==g){if(!c&&/</.test(e)){$(f).before(e);d.push(f)}else{f.nodeValue=e}}}}while(f=f.nextSibling)}d.length&&$(d).remove()})}})(jQuery);

$.extend({
  getUrlVars: function(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
    }
    return vars;
  },
  getUrlVar: function(name){
    return $.getUrlVars()[name];
  }
});

jQuery.fn.activeXOverlap = function() {
	$(this).each(function(i){
	  var h   = $(this).outerHeight();
	  var w   = $(this).outerWidth();
	  var iframe  = '<!--[if IE 6]>' +
	                '<iframe src="javascript:false;" style="height: ' +
	                h +
	                'px; width: ' +
	                w +
	                'px" class="selectOverlap">' +
	                '</iframe>' +
	                '<![endif]-->'
	  $(this).prepend(iframe);
	});
}

$(function() {
	$('.iefix').activeXOverlap();

	var getWert = $.getUrlVar('wert');
	if (getWert != '') {
		$('body *').replaceText(/###WERT###/, getWert);
	}

	var getAnteile = $.getUrlVar('anteile');
	if (getAnteile != '' && getAnteile != undefined) {
		$('body *').replaceText(/###ANTEILE###/, getAnteile);
	}
});
