
$(document).ready(function() {
	//i_utils.js
	CheckIframe();
	mapBaseActions();
	
	var col_max_height = 0;
	
	$(".col_check").each(function() {
		if ($(this).height()>col_max_height) {
			col_max_height = $(this).height();
		}
	});
	
	if (col_max_height>0) {
		$(".maxheight").each(function() {
			$(this).css('height',col_max_height + 'px');
		});
	}
	$('#flash_title').flash({
        src: 'css/swf/title.swf',
        width: 600,
        height: 35,
        name: 'flash_title_',
		flashvars: {title: $('#pagetitle').text(), link_url: $('#pagetitlelink').text()}
    });
	
	
	setTimeout("oblicz_cene_zamowienia()",1000);
	

	$("input.contact").focus(function() {
		$(this).removeClass("contact");
		$(this).val("");
	});
	
	$("textarea.contact").focus(function() {
		$(this).removeClass("contact");
		$(this).val("");
	});
	
	$("div#btn_send").click(function() {
		$("#contact_form").submit();
	});
	
	$(".required").change(function() {
		if ($(this).val()=="" || $(this).val()=="treść wiadomości" || $(this).val()=="twój adres e-mail" || $(this).val()==0) {
			$(this).addClass("alert_bg");
		}
		else {
			$(this).removeClass("alert_bg");
		}
	});
	
	$("#contact_form").submit(function() {
		var submit = true;
		
		$(".required").each(function() {
			$(this).removeClass("alert_bg");
			if ($(this).val()=="" || $(this).val()=="treść wiadomości" || $(this).val()=="twój adres e-mail" || $(this).val()==0) {
				$(this).addClass("alert_bg");
				submit = false;
			}
		});
		
		if (submit==false) {
			alert($("div#alert_msg").html());
		}
		
		return submit;
	});	
});

//przeładuj obrazkin a stronie głównej
function oblicz_cene_zamowienia() {
	var suma=0;
	$(".elementy_zamowienie_tab1_2").each(function() {
	
		var id = $(this).attr('rel');	
		var cena = $(this).val();	
		cena=cena/1;
		
		if ($("input[name=elementy_zamowienie_tab1_1["+id+"]]").attr('checked') == true) {
			suma=suma+cena;	
		}
	})	
	var suma_brutto=suma*1.23;
	$("#suma_zamowienia").html(suma);
	$("#suma_zamowienia_brutto").html(suma_brutto);
	$("#suma_zamowienia_hidden").val(suma);

	setTimeout("oblicz_cene_zamowienia()",1000);
}










