
function trace(msg) {
	if (typeof(console) != 'undefined' && typeof(console.log) != 'undefined') { 
		console.log(msg);
	}
}

function replaceSubmitButtons() {
	// -- replace unsightly submit buttons with a nice link
	$('input[type="submit"]').replaceWith(function() {
		var $form = $(this).parents('form').eq(0);
		var $link = $('<a href="javascript:sendForm(\'' + $form.attr('id') + '\');">' + $(this).val() + '</a>');
		trace($(this).attr('class'));
		$link.addClass($(this).attr('class'));
		return $link;
	}).css({ 'visibility': 'visible' });
}

function makeFancyLinks() {
	$('a.fancyboxWindowLink').colorbox({
		innerWidth: '700px',
		innerHeight: '700px',
		height: false,
		//transition: 'fade',
		//speed: 100,
		opacity: '0.7',	
		onComplete: function(links, index) {
			makeFancyLinks();
		}
	});
}


/* ------------------------------------------------------------------------------------------------------*/

$(document).ready(function() {
	
	trace('ready ****');
	
	$('noscript').remove(); // IE 7 seems to need this
	
	var i = new Image();
	i.src = '_system/css/images/Shopnavi_mouseover.png';
	
	if ($('.slideshow').length > 0) {
		$('.slideshow').cycle({ 
	    	fx: 'scrollLeft',
			requeueOnImageNotLoaded: false,
	    	timeout: 5000}
		);
	}
	
	$('.blink').blink();
	
	if ($('#haftungsausschluss').length > 0) {
		trace('haftungsausschluss found');
		$('#haftungsausschluss *').not('h2').css({display: 'none'});
		$('#haftungsausschluss h2').css({cursor: 'pointer'}).click(function() {
			$('#haftungsausschluss *').not('h2').toggle();
		});
	};	
	
	makeFancyLinks();
	replaceSubmitButtons();
	
});


