var base_url = "";

function checkRequiredFields(formObj)
{
	ok = true;
    $(formObj).find(".requiredField").each(function(){
			if (this.value=='')
	        {
          		ok=false;
          		$(this).css("background", "#fdd");
        	}
        	else
        	{
          		$(this).css("background", "#fff");
        	};                    
      	});
	if (ok)
		return true;
	alert('Nie wypełniono wszystkich wymaganych pól!');
    return false;
}


function lightBox_init()
{
	var groups = {};
	var groups_n = 0;
	var orig_rel = 'lightbox';
	// Create the groups
	$.each($('[@rel*='+orig_rel+']'), function(index, obj){
		// Get the group
		var rel = $(obj).attr('rel');
		// Are we really a group
		if ( rel === orig_rel )
		{	// We aren't
			rel = groups_n; // we are individual
		}
		// Does the group exist
		if ( typeof groups[rel] === 'undefined' )
		{	// Make the group
			groups[rel] = [];
			groups_n++;
		}
		// Append the image
		groups[rel].push(obj);
	});
	// Lightbox groups
	$.each(groups, function(index, group){
		$(group).lightBox();
	});
	// Done
	return true;
}

$(document).ready(function(){
	$(".requiredField[@type!='hidden']").after('<span class="redStar">*</span>');
	$(".new-window").attr("target", "_blank");
	lightBox_init();
	$("#top-menu ul li a").each(function(){$(this).clone().css({top: "1px", left: "1px", border: "none", color: "#d9ad38"}).prependTo($(this).parent());});
});

