// JavaScript Document





$(document).ready(function () {
	$('.lightbox').lightBox(); 
	
		function eqalHeights()
		{
			var tempD = new Array();
					var ile = $("#eq > div").length;
					var minW = 0
					for (i=0; i < ile; i++)
					{
						tempD[i] = $("#eq > div").eq(i).height();
						
						
					}
					
					var maxi =  Math.max.apply(null, tempD);
					
					for (i=0; i < ile; i++){
					
						$("#eq > div").eq(i).css('min-height',maxi);
					}
		}
		
		eqalHeights();
		
		$("#main").bind("resize", function(){ 
                  
					
				eqalHeights()
				});

	
		/*function uruchom()
		{	
			 $("a.pageResults").click(function(){	
				$('#towary').html('<img src="/gfx/loader.gif" class="loader"/>')							   
				
				$('#towary').fadeOut("fast");						   
			 	// $('#towary').load('/gate.php?brama=sklep&' + $(this).attr('alt')+'&ileprod=5',uruchom ).fadeIn(1000);
				 $('#towary').load('/gate.php?brama=sklep&' + $(this).attr('alt')+'&ileprod=5',uruchom ).fadeIn(1000);
			  
			  return false;
			 });

		}
	
     $('#towary').load('/gate.php?brama=sklep&ileprod=5',uruchom ).fadeIn(1000);
	 $('#towary').html('<img src="/gfx/loader.gif" class="loader" />')*/

		function get_rss_feed() {
			$('#towary').html('<img src="/gfx/loader.gif" class="loader"/>');
			//clear the content in the div for the next feed.
			$("#feedContent").empty();
			
			//use the JQuery get to grab the URL from the selected item, put the results in to an argument for parsing in the inline function called when the feed retrieval is complete
			$.get('ajax.php?url=http://dono.pl/sklep/modules/feeder/rss-leszek.php', function(d) {
				var il = 0;
				//find each 'item' in the file and parse it
				$(d).find('item').each(function() {
					il++;
					//name the current found item this for this particular loop run
					var $item = $(this);
					// grab the post title
					var title = $item.find('title').text();
					// grab the post's URL
					var link = $item.find('link').text();
					// next, the description
					var description = $item.find('description').text();
					//don't forget the pubdate
					var pubDate = $item.find('pubDate').text();
					var img = $item.find('image').text();
					var cenabrutto = $item.find('price').text();
					// now create a var 'html' to store the markup we're using to output the feed to the browser window
					var html = "<div class=\"towar\">"
					html +='<div class="img"> <a href="'+link+'">'+img+'</a> </div>'
					html += '<div class="tytul"> <a href="'+link+'">'+title+'</a> </div>';
					html += '<div class="cena"> <span class="brutto">'+cenabrutto+' brutto</span></div>'
					html += '<div class="butony"><a href="'+link+'"><img alt="wiecej" src="/gfx/wiecej.gif" title="więcej"></a></div>'
					
					//put that feed content on the screen!
					$('#towary').append(html);  
				});
				
					$('.loader').fadeOut("fast");
			});
			
		};

	 get_rss_feed();
});


var site = function() {
	this.navLi = $('#nav li').children('ul').hide().end();
	this.init();
};

site.prototype = {
 	
 	init : function() {
 		this.setMenu();
 	},
 	
 	// Enables the slidedown menu, and adds support for IE6
 	
 	setMenu : function() {
 	$("#nav li:last-child").css("background","none")

 	$.each(this.navLi, function() {
 		if ( $(this).children('ul')[0] ) {
 			//$(this).append('<span class="hasChildren" />');
		

 		}
 	});
 	
 		this.navLi.hover(function() {
 			// mouseover
			//$(this).find('> ul').css('display','block')
			$(this).find('> ul').stop(true, true).slideDown('fast');
 		}, function() {
 			// mouseout
 			$(this).find('> ul').stop(true, true).hide(); 		
		});
 		
 	}
 
}


new site();





