/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.03 (05-DEC-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl. 
 *           by default, all four corners are adorned. 
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (and yes, it must be pixels).
 *
 * @author Dave Methvin (http://methvin.com/jquery/jq-corner.html)
 * @author Mike Alsup   (http://jquery.malsup.com/corner/)
 */
;(function($) { 
var ua = navigator.userAgent;
var moz = $.browser.mozilla && /gecko/i.test(ua);
var webkit = $.browser.safari && /Safari\/[5-9]/.test(ua);
var expr = $.browser.msie && (function() {
    var div = document.createElement('div');
    try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
    catch(e) { return false; }
    return true;
})();
    
function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    var s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode ) {
        var v = $.css(node,'backgroundColor');
        if (v == 'rgba(0, 0, 0, 0)')
            continue; // webkit
        if (v.indexOf('rgb') >= 0) { 
            var rgb = v.match(/\d+/g); 
            return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
        }
        if ( v && v != 'transparent' )
            return v;
    }
    return '#ffffff';
};
function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
    case 'sharp':  return Math.round(width*(1-Math.cos(Math.acos(i/width))));
    case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
    case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
    case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
    case 'curl':   return Math.round(width*(Math.atan(i)));
    case 'tear':   return Math.round(width*(Math.cos(i)));
    case 'wicked': return Math.round(width*(Math.tan(i)));
    case 'long':   return Math.round(width*(Math.sqrt(i)));
    case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
    case 'dog':    return (i&1) ? (i+1) : width;
    case 'dog2':   return (i&2) ? (i+1) : width;
    case 'dog3':   return (i&3) ? (i+1) : width;
    case 'fray':   return (i%2)*width;
    case 'notch':  return width; 
    case 'bevel':  return i+1;
    }
};
$.fn.corner = function(options) {
    // in 1.3+ we can fix mistakes with the ready state
	if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(options);
            });
        }
        return this;
	}
    return this.each(function(index){
		var $this = $(this);
		var o = [ options || '', $this.attr($.fn.corner.defaults.metaAttr) || ''].join(' ').toLowerCase();
		//var o = (options || $this.attr($.fn.corner.defaults.metaAttr) || '').toLowerCase();
		var keep = /keep/.test(o);                       // keep borders?
		var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);  // corner color
		var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);  // strip color
		var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width
		var re = /round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;
		var fx = ((o.match(re)||['round'])[0]);
		var edges = { T:0, B:1 };
		var opts = {
			TL:  /top|tl|left/.test(o),       TR:  /top|tr|right/.test(o),
			BL:  /bottom|bl|left/.test(o),    BR:  /bottom|br|right/.test(o)
		};
		if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
			opts = { TL:1, TR:1, BL:1, BR:1 };
			
		// support native rounding
		if ($.fn.corner.defaults.useNative && fx == 'round' && (moz || webkit) && !cc && !sc) {
			if (opts.TL)
				$this.css(moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
			if (opts.TR)
				$this.css(moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
			if (opts.BL)
				$this.css(moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
			if (opts.BR)
				$this.css(moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
			return;
		}
			
		var strip = document.createElement('div');
		strip.style.overflow = 'hidden';
		strip.style.height = '1px';
		strip.style.backgroundColor = sc || 'transparent';
		strip.style.borderStyle = 'solid';
	
        var pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };
        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        var cssHeight = $.curCSS(this, 'height');
        for (var j in edges) {
            var bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                var d = document.createElement('div');
                $(d).addClass('jquery-corner');
                var ds = d.style;
                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);
                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        var bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                	ds.position = 'relative';
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }
                for (var i=0; i < width; i++) {
                    var w = Math.max(0,getWidth(fx,i, width));
                    var e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
            }
        }
    });
};
$.fn.uncorner = function() { 
	if (moz || webkit)
		this.css(moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
	$('div.jquery-corner', this).remove();
	return this;
};
// expose options
$.fn.corner.defaults = {
	useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
	metaAttr:  'data-corner' // name of meta attribute to use for options
};
    
})(jQuery);


(function(jQuery) {
	jQuery.fn.product_filter_gui = function(options) {
 	//debug(this);
 	// build main options before element iteration
 	var opts = jQuery.extend({}, jQuery.fn.product_filter_gui.defaults, options);
 	// iterate and reformat each matched element
 	return this.each(function() {
 		$this = jQuery(this);
 		$parent = jQuery(this).parent();
 		
 		//$this.html('<fieldset><legend>1. Um welchen Bodenbelag handelt es sich?</legend><select name="select1" class="select_level1"><option value="value1">Teppichböden</option><option value="value2">Polstermöbel</option><option value="value3">Parkett, Holz, Laminat</option><option value="value4">Elastische Böden</option><option value="value5">Hartböden</option></select><fieldset><select name="material-select1-value1" class="select_level2"><option value="value1">Synthetik</option><option value="value2">Wolle</option> <option value="value3">Sisal</option> <option value="value4">Jute</option> <option value="value5">Kokos</option> </select> <select name="material-select1-value2" class="select_level2"><option value="value1">Synthetik</option><option value="value2">Baumwolle</option><option value="value3">Wolle</option><option value="value4">Mischfaser</option></select><select name="material-select1-value3" class="select_level2"><option value="product2801">Parkett</option><option value="product2801">Holz</option><option value="product2801">Kork</option><option value="product2801">Laminat</option></select><select name="material-select1-value4" class="select_level2"><option value="product2801">PVC</option><option value="product2801">CV</option><option value="product2801">Gummi</option><option value="product2801">Linoleum</option><option value="product2801">Polyolefine</option></select><select name="material-select1-value5" class="select_level2"><option value="product2824">Naturstein</option><option value="product2824">Kunststein</option><option value="product2824">Keramik</option><option value="product2824">Feinsteinzeug</option><option value="product2823">Kunststoff, Glas, Metall</option><option value="product2822">WC, Sanitär</option><option value="product2823">Spezial</option></select></fieldset> </fieldset> <fieldset> <legend>2. Wodurch ist der Fleck entstanden?</legend> <select name="select3" class="select_level3"><option value="value1">Speisen</option><option value="value2">Getränke</option><option value="value3">Öle, Lacke, Farben</option><option value="value4">Hobby/Heimwerken</option><option value="value5">Haustiere</option><option value="value6">sonstiges</option> </select><fieldset> <select name="material-select3-value1" class="select_level2"><option value="product2800">Balsamico-Essig</option><option value="product2799">Butter, Fett</option><option value="product2800">Brotaufstrich</option><option value="product2800">Ei</option><option value="product2800">Eiscreme</option><option value="product2800">Gemüse</option><option value="product2799">Kaugummi</option><option value="product2800">Ketchup, Senf, Mayonnaise</option><option value="product2800">Obst</option><option value="product2800">Schokolade</option></select> <select name="material-select3-value2" class="select_level2"><option value="product2800">Bier</option><option value="product2800">Cola</option><option value="product2800">Fruchtsaft</option><option value="product2800">Kaffee, Kakao</option><option value="product2800">Milch</option><option value="product2800">Rotwein, Weißwein</option></select><select name="material-select3-value3" class="select_level2"><option value="product2799">Farbe</option><option value="product2799|product2800">Filzstift</option><option value="product2799|product2800">Kajalstift</option><option value="product2799">Kugelschreiber</option><option value="product2799">Lippenstift</option><option value="product2799|product2800">Make up</option><option value="product2799">Nagellack</option><option value="product2799">Öl</option><option value="product2799|product2800">Tinte</option><option value="product2799">Wimperntusche</option></select><select name="material-select3-value4" class="select_level2"><option value="product2799">Bitumenkleber</option><option value="product2799">Kunstharzkleber</option><option value="product2799">Neoprenkleber</option><option value="product2799">Pattex</option></select><select name="material-select3-value5" class="select_level2"><option value="product2800">Erbrochenes</option><option value="product2800">Kot</option><option value="product2800">Urin</option></select><select name="material-select3-value6" class="select_level2"><option value="product2800">Deo</option><option value="product2800">Erbrochenes</option><option value="product2800">Glas</option><option value="product2800">Parfüm</option><option value="product2799">Rost</option><option value="product2800">Schweißränder</option><option value="product2800">Urin</option><option value="product2799">Wachs</option><option value="product2799">Zahnpasta</option></select> </fieldset> </fieldset> <input type="submit" value="absenden" />');
 			
 		// build element specific options
   		var o = jQuery.meta ? jQuery.extend({}, opts, $this.data()) : opts;
   		var m = [];
   		var c = 0;
   		var old_level = 0;
   		$this.find('select').each(function(){
   			level = jQuery(this).attr('class').replace(/select_level/,'');
   			if (level!=old_level) {
   				c++;
   				m[c] = [];
   				d = 1;
   			}
   			m[c][d] = {};
   			m[c][d].name = jQuery(this).attr('name');
   			m[c][d].options = [];
   			var e = 1;
   			jQuery(this).find('option').each(function(){
   				m[c][d].options[e] = {};
   				m[c][d].options[e].value = jQuery(this).attr('value');
   				m[c][d].options[e].label = jQuery(this).text();
   				m[c][d].options[e].selected = jQuery(this).attr('selected');
   				if (jQuery(this).attr('selected')==true) {
   					m[c][d].option_selected = e;
   				}
   				e++;
   			});
   			d++;
   			old_level = level;
   		});
   		jQuery.fn.product_filter_gui.matrix = m;
   		window.console.log(m);
		
		$this.hide();
		//$this.before('<div class="tx-uzincontentelements-pi1"><h1>Flecken- und Pflegeprodukte finden</h1><p>Jeder Fleck läßt sich am leichtesten sofort entfernen. Kaffee-, Tee-, Cola- oder Rotweinflecken sollen sofort - noch in nassem Zustand - mit klarem Wasser ausgespült werden. Frische und noch feuchte Flecken wie verschüttete Flüssigkeiten oder ähnliches mit Küchenpapier oder saugfähigem Tuch abtupfen, nicht reiben. Grundsätzlich soll bei der Fleckenentfernung von außen nach innen gearbeitet werden, um den Fleck nicht zu vergrößern.</p><p><strong>Wichtig: Immer erst an unauffälliger Stelle auf Farb- und Materialbeständigkeit prüfen!</strong></p><p>Bei schwer entfernbaren Verschmutzungen ist es wichtig, die Ursache des Flecks zu kennen, um die richtige Methode für seine Entfernung anzuwenden. Das falsche Mittel oder eine fehlerhafte Anwendung kann das Problem sogar verschärfen und irreparable Schäden am Bodenbelag verursachen. Niemals Spülmittel, Feinwaschmittel oder ähnlich wirkende Substanzen einsetzen!</p></div>');
		
		var h = '<div class="jq_product_filter" id="jq_product_filter">';
		var old_level = 0;
		var fieldset_counter = 1;
		
		for (i=1;i<m.length;i++) {
			//alert (m[i].length);
			if (i==1||i==3||i==5) { 
				h+= '<div class="fieldset fieldset'+fieldset_counter+'"><h4>'+$this.find('legend').eq((i-1)/2).text()+'</h4>'; 
			}
			h += '<div class="select select_level_'+i+'"><div class="select_body">';
			for (j=1;j<m[i].length;j++) {
				//alert(i+','+j);
				option_id = 'options_'+m[i][j].name;
				h += '<div class="options" id="'+option_id+'">';
				for (k=1;k<m[i][j].options.length;k++) {
					if (i<5) {
						h += '<div class="option original_value['+m[i][j].options[k].value+']" id="jq_filter_option_'+k+'">'+m[i][j].options[k].label+'</div>';
					} else {
						if ((k-1)%12==0||k==1) h += '<div class="col">';
						h += '<div class="option original_value['+m[i][j].options[k].value+']" id="jq_filter_option_'+k+'">'+m[i][j].options[k].label+'</div>';
						if ((k)%12==0||k==m[i][j].options.length-1) h += '</div>';
					}
				}
				h += '</div>';
			}
			h += '</div><div class="select_bottom">&nbsp;</div></div>';
			// close fieldset
			if (i==2||i==4||i==5) { fieldset_counter++; h+= '</div>';  }
		}	
		
		h += '</div>';
		
		$this.after(h);
		//$this.after('<div class="jq_product_filter" id="jq_product_filter"><div class="fieldset fieldset1"><h4>'+$this.find('legend').eq(0).text()+'</h4><div class="select select_level_1"><div class="select_body"></div><div class="select_bottom">&nbsp;</div></div><div class="select select_level_2"><div class="select_body"></div><div class="select_bottom">&nbsp;</div></div></div><div class="fieldset fieldset2"><h4>'+$this.find('legend').eq(1).text()+'</h4><div class="select select_level_3"><div class="select_body"></div><div class="select_bottom">&nbsp;</div></div><div class="select select_level_4"><div class="select_body"></div><div class="select_bottom">&nbsp;</div></div></div><div class="fieldset fieldset3"><h4>3. Wodurch ist der Fleck entstanden?</h4><div class="select select_level_5"><div class="select_body"></div><div class="select_bottom">&nbsp;</div></div></div></div>');
		
		$parent.find('.jq_product_filter .option').hover(function(){ if (!jQuery(this).hasClass('option_selected')) set_selected(jQuery(this)); },function(){ if (!jQuery(this).hasClass('option_selected')) { unset_selected(jQuery(this)); } });
		
		$parent.find('.jq_product_filter .select_level_1 .option').click(function(){
			jQuery('.jq_product_filter .select_level_1 .option').removeClass('option_selected');
			jQuery(this).addClass('option_selected');
			var o = jQuery(this).attr('id').replace(/jq_filter_option_/,'');
			jQuery('.fieldset2,.fieldset3').hide();
			jQuery('.select_level_2').show();
			jQuery('.select_level_2 .options').hide();
			jQuery('.select_level_2 #options_material-'+o).show();
			jQuery('.rz_products_stain_table').hide();
		});
		$parent.find('.jq_product_filter .select_level_2 .option').click(function(){
			//var o = jQuery(this).attr('id').replace(/jq_filter_option_element/,'');
			jQuery('.jq_product_filter .select_level_2 .option').removeClass('option_selected');
			jQuery(this).addClass('option_selected');
			var type1 = eval(jQuery(this).parents('.fieldset1').find('.select_level_1 .option_selected').attr('id').replace(/jq_filter_option_/,''));
			var type2 = eval(jQuery(this).attr('id').replace(/jq_filter_option_/,''));
			jQuery('.jq_product_filter .fieldset3').hide();
			if (type1<6) {
				jQuery('.jq_product_filter .fieldset2').show();
				jQuery('.jq_product_filter .fieldset2 .option').removeClass('option_selected');
				unset_selected(jQuery('.fieldset2 .option'));
				jQuery('.jq_product_filter .select_level_3 .options').hide();
				var o = jQuery(this).attr('id').replace(/jq_filter_option_/,'');
				jQuery('.jq_product_filter .select_level_3 #options_application-'+type1+'-'+type2).show();
				jQuery('.jq_product_filter .select_level_4').hide();
				jQuery('.rz_products_stain_table').hide();
			} else {
				jQuery('.jq_product_filter .fieldset2').hide();
				showProducts(jQuery(this).attr('class'));				
			}
		});
		$parent.find('.jq_product_filter .select_level_3 .option').click(function(){
			jQuery('.jq_product_filter .fieldset3').hide();
			jQuery('.jq_product_filter .select_level_3 .option').removeClass('option_selected');
			jQuery(this).addClass('option_selected');
			var type1 = eval(jQuery(this).parents('.jq_product_filter').find('.select_level_1 .option_selected').attr('id').replace(/jq_filter_option_/,''));
			var type2 = eval(jQuery(this).parents('.jq_product_filter').find('.select_level_2 .option_selected').attr('id').replace(/jq_filter_option_/,''));
			var type3 = eval(jQuery(this).attr('id').replace(/jq_filter_option_/,''));
			//alert(type3);
			var suboptions = false;
			for (i=1;i<m[4].length;i++) {
				tmp = m[4][i].name.replace('application-','').split('-');
				if (tmp[0]==type1&&tmp[1]==type2&&tmp[2]==type3) suboptions = i;
			}
			if (suboptions!==false) {
				jQuery('.jq_product_filter .select_level_4').show();
				jQuery('.jq_product_filter .select_level_4 .options').hide();
				jQuery('.jq_product_filter .select_level_4 #options_application-'+type1+'-'+type2+'-'+type3).show();
				jQuery('.rz_products_stain_table').hide();
			} else {
				jQuery('.jq_product_filter .select_level_4').hide();
				showProducts(jQuery(this).attr('class'));	
			}			
		});
		$parent.find('.jq_product_filter .select_level_4 .option').click(function(){
			jQuery('.jq_product_filter .fieldset3').hide();
			jQuery('.jq_product_filter .select_level_4 .option').removeClass('option_selected');
			jQuery(this).addClass('option_selected');
			var type1 = eval(jQuery(this).parents('.jq_product_filter').find('.select_level_1 .option_selected').attr('id').replace(/jq_filter_option_/,''));
			var type2 = eval(jQuery(this).parents('.jq_product_filter').find('.select_level_2 .option_selected').attr('id').replace(/jq_filter_option_/,''));
			var type3 = jQuery(this).parents('.jq_product_filter').find('.select_level_3 .option_selected').text();
			var type4 = eval(jQuery(this).attr('id').replace(/jq_filter_option_/,''));
			if (type1==1&&type3=='Fleckentfernung') {
				jQuery('.jq_product_filter .select_level_5, .jq_product_filter .fieldset3').show();
				jQuery('.jq_product_filter .select_level_5 .options').hide();
				jQuery('.jq_product_filter .select_level_5 #options_substance-'+type4).show();
				jQuery('.rz_products_stain_table').hide();
			} else {
				//show products
				showProducts(jQuery(this).attr('class'));
			}	
		});
		
		$parent.find('.jq_product_filter .select_level_5 .option').click(function(){
			jQuery('.jq_product_filter .select_level_5 .option').removeClass('option_selected');
			jQuery(this).addClass('option_selected');
			showProducts(jQuery(this).attr('class'));	
		});
		
		$parent.find('.jq_product_filter .option').click(function(){
			jQuery(this).parents('.select').find('.option').removeClass('option_selected');
			jQuery(this).parents('.select').find('.option').removeClass('option_hovered');
			unset_selected(jQuery(this).parents('select').find('.option'));
			jQuery(this).addClass('option_selected');
			set_selected(jQuery(this));
		});
		
		//jQuery('.jq_product_filter .option').corner({ tl: { radius: 3 }, tr: { radius: 3 }, bl: { radius: 3 }, br: { radius: 3 }});
		
		$parent.find('.jq_product_filter .fieldset2, .jq_product_filter .fieldset3, .jq_product_filter .select_level_2').hide();
		
		$parent.find('.jq_filter input').focus(function(){
			jQuery(this).parents('.input_container').addClass('input_active');
			jQuery(this).parents('.input_container').addClass('input_initialised');
		});
		$parent.find('.jq_filter input').bind("change keyup", function() {
		   var n = jQuery(this).parents('.input_container').attr('id').replace(/jq_filter_input_/,'');
           jQuery(this).parents('form').find('input[name="'+m[n].name+'"]').val(jQuery(this).val());
      	}); 
		$parent.find('.jq_filter input').blur(function(){
			jQuery(this).parents('.input_container').removeClass('input_active');
		});
		
		// submit generieren
		
		var label_submit = jQuery(this).find('input[type="button"]').attr('value');
		$parent.find('.jq_filter .selects').append('<div class="submit"><div class="submit_label">'+label_submit+'</div><div class="submit_stub">&nbsp;</div></div>');
		$parent.find('.jq_filter .selects .submit').hover(function(){jQuery(this).addClass('submit_hover');},function(){jQuery(this).removeClass('submit_hover');});
		$parent.find('.jq_filter .selects .submit').click(function(){
			jQuery(this).parents('form').submit();
		});	
		
		jQuery('.tx_ddfiltergeneralmatrix_result__item_wrap').each(function(){
			if (!jQuery(this).attr('id').indexOf('product')>-1) {
				if (jQuery(this).find('a:first').length>0) {
					var u = jQuery(this).find('a:first').attr('href');
					var pos = u.indexOf('tx_ddproductmatrix_pi1[uidDetail]');
					var id = u.substring(pos).split('=');
					jQuery(this).attr('id','product'+id[1]);
				}
			}			
		});
		
 	});
  	};
  	 	
  	function adjust_inputs(target) {
  		var label_width = target.parents('.input_container').find('.label').width();
  		if (target.parents('form#tx_ddproductmatrix_pi1_form').length>0) {
  			target.width(270-label_width);
  		} else {
  			target.width(163-label_width);
  		}
  	}
  	
  	function set_selected(target) {
  		target.uncorner();
  		target.addClass('option_hovered'); 
  		if(jQuery.browser.msie) { 
  			var cc = '#ccc';
  			if (target.parents('.fieldset2').length>0||target.parents('.fieldset3').length>0) cc = '#fff';
  			target.corner('3px cc:'+cc);
  		} else { 
  			target.corner('3px'); 
  		}
  	}
  	
  	function showProducts(input) {
  		jQuery('.tx_ddfiltergeneralmatrix_result__item_wrap').hide();
		jQuery('.rz_products_stain_table').show();
  		var pos = jQuery('#jq_product_filter').offset();
		window.scrollTo(0,pos.top); 
		var c = input.split(' ');
  		for (i=0;i<c.length;i++) {
  			//var index = c[i].indexOf('original_value');
			if (c[i].substring(0,14)=='original_value') {
				var v = c[i].substring(15).replace(/]/,'').split('|');
			}
		}
		for (i=0;i<v.length;i++) {
			jQuery('.tx_ddfiltergeneralmatrix_result__item_wrap#'+v[i]).show();
		}
  	}
  	
  	function unset_selected(target) {
  		target.removeClass('option_hovered');
  		target.uncorner();
  	}
  	
  	//
  	// private function for debugging
  	//
  	function debug($obj) {
 		if (window.console && window.console.log)
   			window.console.log('hilight selection count: ' + $obj.size());
  	};
  	//
  	// plugin defaults
  	//
  	jQuery.fn.product_filter_gui.defaults = {
 		foreground: 'red',
 		background: 'yellow'
  	};
	//
	// end of closure
	//
})(jQuery);

jQuery(document).ready(function(){
	jQuery('form#rz_product_filter').product_filter_gui();
});