$().ready(function() {
	$('a[target="coffeetable"]').removeAttr("onclick");
	$('a[target="coffeetable"]').click(function() {
		TB_show('', $(this).attr('href') + '?TB_iframe=true&width=865&height=605', false);
		return false;
	});

	thickbox_opener = {};

	$('a[target="thickbox"]').each(function(i) {
		result 				= $(this).attr('onclick').toString().match(/width=(\d*),height=(\d*)/i);
		thickbox_opener[i]	= $(this).attr('href') + '&width=' + result[1] + '&height=' + (parseInt(result[2])) + '&TB_iframe=true';

		$(this).removeAttr('onclick');

		$(this).click(function() {
			TB_show('', thickbox_opener[i], false);
			return false;
		});
	});
	
	if (typeof sIFR == 'function') {
		sIFR.replaceElement(
			named({
				bHideBrowserText: true,
				sSelector: '#ContentHead h1, #Main div.container>h1',
				sFlashSrc: '/page/inc/sifr/HandelGothic.swf',
				sColor: '#525252',
				sLinkColor: '#000000',
				sBgColor: '#FFFFFF',
				sHoverColor: '#CCCCCC',
				nPaddingTop: 0,
				nPaddingBottom: 6,
				sFlashVars: 'textalign=left&offsetTop=0&selectable=false',
				sWmode: 'transparent',
				selectable: false
			})
		);
	}
});
