	var flag = false;
	jQuery.fn.extend({
		slideContents: function(id, size, dir){
			
			if(flag == true) {
				return false;
			}

			flag = true;

			var obj = $("#" + id);
	
			if(dir == undefined) {
				var dir = 1;
				var child = $("#" + id + " li:last-child");
			} else if (dir == -1) {
				var child = $("#" + id + " li:first-child");
			}
	
			var _left = parseInt(obj.css("left").replace(/px/, ''));
			var clone = child.clone(true);

	
			if (dir == 1) {
				_left = _left + dir * size;
 		
				$(obj).animate({left: _left + "px"}, "slow", function(){
					child.remove();
					_left = _left - dir * size;
					$(this).css({left: _left + "px"});
					clone.prependTo(this);
					flag = false;
				});
			} else {
				_left = _left + dir * size;
	
				$(obj).animate({left: _left + "px"}, "slow", function(){
					child.remove();
					_left = _left - dir * size;
					$(this).css({left: _left + "px"});
					clone.appendTo(this);
					flag = false;
				});
			}
		}
	});

	$(function(){
		var h = $("#view").html();
		$("#view").html("<div id='view-outer'>"+h+"</div>");

		var li_width = 120;
		
		$("#right").click(function(){
			$(this).slideContents("images", li_width);
		});

		$("#left").click(function(){
			$(this).slideContents("images", li_width, -1);
		});

		$("#images li").hover(function() {
			var _x = $(this).find("img").attr("title");
			var isMSIE = /*@cc_on!@*/false;
			if (!isMSIE) {
				var leftOffset = ($(this).prevAll().length + 1) * $(this).width() - $(this).width()/2 - $(this).width();
			} else {
				var leftOffset = ($(this).prevAll().length + 1) * $(this).width() - $(this).width()/2 + 15 - $(this).width();
			}
			$("#ic").text(_x).css("left", leftOffset).fadeIn('fast');
		}, function() {
			$("#ic").hide();
		});
	var OSName="Unknown OS";
		var _pxos = "120px";
	if (navigator.appVersion.indexOf("Win")!=-1) { OSName="Windows";
		$("#page #top_menu .last").css("width", _pxos);

	}
	var isMSIE = /*@cc_on!@*/false;
			if (isMSIE) {
			var _pxos = "154px";
			$("#page #top_menu .last").css("width", _pxos);
			}
	


				var arrPageSizes = ___getPageSize();
// 				if ($.browser.msie) { 
// 					var padding = 0;
// 					if ( $.browser.version == "7.0" ) {
// 						var wSzR = arrPageSizes[2] / 2 - 1;
// 						$('#wrap_r').css({
// 							width:	wSzR
// 						});
// 						$('#wrap_l').css({
// 							width:	arrPageSizes[2]
// 						});
// 						var padding = 0;
// 						
// 					}
// 				} else {
// 					var padding = 50;
// 				}
				$('#page').css({
				height: arrPageSizes[1]
				});
				var conHeight = $('#page').height() - $('#header').height() - $('#top_menu').height() - $('#flash').height();/*padding;*/
				$('#content').css({
						height:		conHeight
				});
				var lconHeight = conHeight - 20;
				$('#lcon').css({
						height:		lconHeight
				});
				$('#prr').css({
						height:		lconHeight
				});
function ___getPageSize() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = window.innerWidth + window.scrollMaxX;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth; 
				} else {
					windowWidth = self.innerWidth;
				}
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}	
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){	
				pageWidth = xScroll;		
			} else {
				pageWidth = windowWidth;
			}
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
			return arrayPageSize;
		};

	$("#formularz").submit( function() {
		$("#error").remove();
		//console.log($("#firma").val().length);
		$("#formularz input").css("border-color","#a2a2a2");
		$("#formularz textarea").css("border-color","#a2a2a2");
		var err = false;
		var error = "";
		if ( $("#firma").val().length < 2 && $("#name").val().length < 3 ) {
			error = "Podaj nazwę firmy lub imię i nazwisko";
			$("#firma").css("border-color","#cc0000");
			$("#name").css("border-color","#cc0000");
			err=true;
		}
		var mail = $("#email").val();
		var regmail = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i;
		var wynmail = mail.match(regmail);
		if (wynmail==null && $("#telefon").val().length < 6 ) {
			error += "<br/>Podaj prawidłowy adres email lub numer telefonu";
			$("#email").css("border-color","#cc0000");
			$("#telefon").css("border-color","#cc0000");
			err=true;
		}
		if ( $("#tresc").val().length < 10 ) {
			error +="<br/>Wypełnij pole treścią...";
			$("#tresc").css("border-color","#cc0000");
			err=true;
		}
		if (err) {
			$("#formularz").append("<div id=\"error\">"+error+"</div>");
			return false;
		}
	});

	$("#formularz1").submit( function() {
		$("#error").remove();
		//console.log($("#firma").val().length);
		$("#formularz1 input").css("border-color","#a2a2a2");
		var err = false;
		var error = "";
		if ( $("#name").val().length < 3 ) {
			error = "Podaj imię i nazwisko";
			$("#name").css("border-color","#cc0000");
			err=true;
		}
		var mail = $("#email").val();
		var regmail = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i;
		var wynmail = mail.match(regmail);
		if (wynmail==null && $("#telefon").val().length < 6 ) {
			error += "<br/>Podaj prawidłowy adres email lub numer telefonu";
			$("#email").css("border-color","#cc0000");
			$("#telefon").css("border-color","#cc0000");
			err=true;
		}
		if ( $("#prefdate").val().length < 6 ) {
			error +="<br/>Podaj preferowaną datę...";
			$("#prefdate").css("border-color","#cc0000");
			err=true;
		}
		if (err) {
			$("#formularz1").append("<div id=\"error\">"+error+"</div>");
			return false;
		}
	});
    
    $("#czesci").submit( function() {
        $("#error").remove();
        //console.log($("#firma").val().length);
        $("#czesci input").css("border-color","#a2a2a2");
        $("#czesci textarea").css("border-color","#a2a2a2");
        var err = false;
        var error = "";

        if ( $("#czesci_name").val().length < 7 ) {
            error +="Podaj imię i nazwisko";
            $("#czesci_name").css("border-color","#cc0000");
            err=true;
        }

        var telefon = $("#czesci_phone").val();
        var regtel = /^([0-9\-\ +()]){7,24}$/i;
        var telwalid = telefon.match(regtel);
        if (telwalid==null) {
            error += "<br />Podaj prawidłowy numer telefonu";
            $("#czesci_phone").css("border-color","#cc0000");
            err=true;
        }

        var mail = $("#czesci_email").val();
        var regmail = /^[a-z0-9]([._-]?[a-z0-9]+)*@[a-z0-9]+([-.]?[a-z0-9]+)*\.[a-z]{2,4}$/i;
        var mailwalid = mail.match(regmail);
        if (mailwalid==null) {
            error += "<br/>Podaj prawidłowy adres e-mail";
            $("#czesci_email").css("border-color","#cc0000");
            err=true;
        }

        if ( $("#czesci_nadwozie").val().length < 3 ) {
            error +="<br/>Podaj numer nadwozia";
            $("#czesci_nadwozie").css("border-color","#cc0000");
            err=true;
        }

        if ( $("#czesci_content").val().length < 4 ) {
            error +="<br/>Wypełnij pole treścią...";
            $("#czesci_content").css("border-color","#cc0000");
            err=true;
        }

        if (err) {
            $("#czesci").prepend('<div id="error">'+error+'</div>');
            return false;
        }
    });

    $("#serwis").submit( function() {
        $("#error").remove();
        //console.log($("#firma").val().length);
        $("#serwis input").css("border-color","#a2a2a2");
        $("#serwis textarea").css("border-color","#a2a2a2");
        var err = false;
        var error = "";
        
        var telefon = $("#service_phone").val();
        var regtel = /^([0-9\-\ +()]){7,24}$/i;
        var telwalid = telefon.match(regtel);
        if (telwalid==null) {
            error += "Podaj prawidłowy numer telefonu";
            $("#service_phone").css("border-color","#cc0000");
            err=true;
        }
        if (err) {
            $("#serwis").prepend('<div id="error">'+error+'</div>');
            return false;
        }
    });
// 	if ( $("#galleryOuter") ) {
// 		 $(function() {
			$("#galleryOuter a.thickbox").lightBox();
// 		});

// 	}

});
function ulubione(obj) {
	title = document.title;
	url = document.location;
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) {
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) {
		/**
		 * Opera wymaga ustawienia parametru REL dla linku
		 * Firefox także wspiera takie rozwiązanie, jednak w typ wypadku
		 * spowodowało by to wywołanie 2 okienek dodania - jednego pustego
		 * dlatego ustawiamy parametr poprzez JavaScript
		 */
		obj.rel = 'sidebar';
		return true;
	}
	return false;
}
function _GET(nazwa_zmiennej) {
adresStrony = document.URL; //1
query = adresStrony.substring( adresStrony.indexOf('?') + 1 ) //2
zmienne = query.split('&'); //3
for (i=0; i<zmienne.length; i++) { //4
nazwa = zmienne[i].split("=")[0]; //5
wartosc = zmienne[i].split("=")[1]; //6
if (nazwa == nazwa_zmiennej) return unescape(wartosc) //7
}
}

if (_GET("_send_") == "ok" ) alert("Dziękujemy\nWiadomość została do nas wysłana");
