$(document).ready(function (){

	Shadowbox.init({players: ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv']});

	/* Hovermenu */
	$('#main-menu ul li').mouseenter(function() {

		//$('#hovermenu').css('display', 'block');



		if ($(this).find('a.main').hasClass('selected')) {

			//$(this).find('a.main').attr('style', 'background-position: 0 -80 !IMPORTANT');

		} else {

			$(this).find('a.main').attr('style', 'background-position: 0 -40px !IMPORTANT');
		}

		/*
		var id = $(this).attr('id');
		id = id.substr(2,1);

		if ($('#hovermenu_' + id).length > 0 )
			$('#hovermenu_' + id).css('display', 'block');

		$(this).find('.hover_placeholder').css('display' , 'block');
		*/

	}).mouseleave(function() {

		//$('#hovermenu').css('display', 'none');

		if ($(this).find('a.main').hasClass('selected')) {

			$(this).find('a.main').attr('style', 'background-position: 0 -80 !IMPORTANT');

		} else {

			$(this).find('a.main').attr('style', 'background-position: 0 0 !IMPORTANT');
		}

		/*
		var id = $(this).attr('id');
		id = id.substr(2,1);

		if ($('#hovermenu_' + id).length > 0 )
			$('#hovermenu_' + id).css('display', 'none');

		$(this).find('.hover_placeholder').css('display' , 'none');
		*/
	});

	/* Page block images */

	// Init default _normal image
	var globals_pbi = [];
	$('.page_block_images').each (function () {

		var id = $(this).find('.pbi_container').attr('id');
		globals_pbi[id] = $(this).find('img').attr('src');
	});

	// Mouse interaction
	$('.page_block_images .hover').mouseenter (function () {

		var src = $(this).find('.thumb').attr('src');
		var dst = src.replace('_thumb', '_normal');
		$(this).parents('.page_block_images').find('.pbi_container img').attr('src', dst);

	}).mouseleave (function () {

		// Get id from container
		var id = $(this).parents('.page_block_images').find('.pbi_container').attr('id');
		var dst = globals_pbi[id];
		$(this).parents('.page_block_images').find('.pbi_container img').attr('src', dst);
	});
});

function submitForm(url){
    var form_url = $("#orderform").attr("action");
    $("#orderform").attr("action",url);
    $("#orderform").submit();
}

