Number.prototype.pxToEm = String.prototype.pxToEm = function(settings){
	//set defaults
	settings = jQuery.extend({
		scope: 'body',
		reverse: false
	}, settings);
	
	var pxVal = (this == '') ? 0 : parseFloat(this);
	var scopeVal;
	var getWindowWidth = function(){
		var de = document.documentElement;
		return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
	};	
	
	/* When a percentage-based font-size is set on the body, IE returns that percent of the window width as the font-size. 
		For example, if the body font-size is 62.5% and the window width is 1000px, IE will return 625px as the font-size. 	
		When this happens, we calculate the correct body font-size (%) and multiply it by 16 (the standard browser font size) 
		to get an accurate em value. */
				
	if (settings.scope == 'body' && $.browser.msie && (parseFloat($('body').css('font-size')) / getWindowWidth()).toFixed(1) > 0.0) {
		var calcFontSize = function(){		
			return (parseFloat($('body').css('font-size'))/getWindowWidth()).toFixed(3) * 16;
		};
		scopeVal = calcFontSize();
	}
	else { scopeVal = parseFloat(jQuery(settings.scope).css("font-size")); };
			
	var result = (settings.reverse == true) ? (pxVal * scopeVal).toFixed(2) + 'px' : (pxVal / scopeVal).toFixed(2) + 'em';
	return result;
};

/*-------------------------------------------------------------------- 
 * JQuery Plugin: "EqualHeights"
 * by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
 *
 * Copyright (c) 2008 Filament Group
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Description: Compares the heights or widths of the top-level children of a provided element 
 		and sets their min-height to the tallest height (or width to widest width). Sets in em units 
 		by default if pxToEm() method is available.
 * Dependencies: jQuery library, pxToEm method	(article: 
		http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/)							  
 * Usage Example: $(element).equalHeights();
  		Optional: to set min-height in px, pass a true argument: $(element).equalHeights(true);
 * Version: 2.0, 08.01.2008
--------------------------------------------------------------------*/

$.fn.equalHeights = function(px) {
	$(this).each(function(){
		var currentTallest = 0;
		$(this).children().each(function(i){
			if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
		});
		if (!px || !Number.prototype.pxToEm) currentTallest = currentTallest.pxToEm(); //use ems unless px is specified
		// for ie6, set height since min-height isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
		$(this).children().css({'min-height': currentTallest}); 
	});
	return this;
};

$(function() {
    $('#content_right .acc').accordion({ autoHeight: false });
	$('#content_left .avatar_list').equalHeights();
	
	$('.rounded').each(function() {
		PIE.attach(this);
	});

	_gaq = [['_setAccount', 'UA-3694142-1'], ['_trackPageview'],
			['b._setDomainName', 'none'], ['b._setAllowLinker', true], ['b._setAccount', 'UA-16059909-16'], ['b._trackPageview']];
	
	if (window.location.hostname == 'www.cf-kunststofprofielen.nl') {
		_gaq.push(['c._setAccount', 'UA-28194675-3']);
		_gaq.push(['c._trackPageview']);
	}
	else if (window.location.hostname == 'www.cf-kunststofprofielen.de') {
		_gaq.push(['c._setAccount', 'UA-28194675-4']);
		_gaq.push(['c._trackPageview']);
	}
	else if (window.location.hostname == 'www.cf-kunststofprofielen.eu') {
		_gaq.push(['c._setAccount', 'UA-28194675-5']);
		_gaq.push(['c._trackPageview']);
	}
	
	(function(d, t) {
		var	g = d.createElement(t),
			s = d.getElementsByTagName(t)[0];
		g.async = true;
		g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		s.parentNode.insertBefore(g, s);
	})(document, 'script');
	
	$('#flags').delegate('a', 'click', function(e) {
		e.preventDefault();
		_gaq.push(['b._link', this.href]);
	});
	
	$('table.product_table').delegate('a', 'click', function(e) { 
		e.preventDefault();
		
		var linky = $(this).text();

		window.location.href = '/pagina/productinfo/product/'+linky;
		
	});
	
});




(function(b){var a;b.fn.jqprint=function(e){a=b.extend({},b.fn.jqprint.defaults,e);var d=(this instanceof jQuery)?this:b(this);if(a.operaSupport&&b.browser.opera){var f=window.open("","jqPrint-preview");f.document.open();var h=f.document}else{var g=b("<iframe  />");if(!a.debug){g.css({position:"absolute",width:"0px",height:"0px",left:"-600px",top:"-600px"})}g.appendTo("body");var h=g[0].contentWindow.document}if(a.importCSS){if(b("link[media=print]").length>0){b("link[media=print]").each(function(){h.write("<link type='text/css' rel='stylesheet' href='"+b(this).attr("href")+"' media='print' />")})}else{b("link").each(function(){h.write("<link type='text/css' rel='stylesheet' href='"+b(this).attr("href")+"' />")})}}if(a.printPrefix){var c=b(a.printPrefix);if(c){h.write(c.html())}}if(a.printContainer){h.write(d.outer())}else{d.each(function(){h.write(b(this).html())})}h.close();(a.operaSupport&&b.browser.opera?f:g[0].contentWindow).focus();setTimeout(function(){(a.operaSupport&&b.browser.opera?f:g[0].contentWindow).print();if(f){f.close()}},1000)};b.fn.jqprint.defaults={debug:false,importCSS:true,printContainer:true,operaSupport:true,printPrefix:"#printPrefix"};b.fn.outer=function(){return b(b("<div></div>").html(this.clone())).html()}})(jQuery);
