function sendForm(div, action){
	var form = $("#"+div);
	if(action) form.attr('action', action);
	form.submit();
}

function implode (glue, pieces) {
    var i = '', retVal='', tGlue='';
    if (arguments.length === 1) {        pieces = glue;
        glue = '';
    }
    if (typeof(pieces) === 'object') {
        if (pieces instanceof Array) {            return pieces.join(glue);
        }
        else {
            for (i in pieces) {
                retVal += tGlue + pieces[i];                tGlue = glue;
            }
            return retVal;
        }
    }    else {
        return pieces;
    }
}

function addToFavorites(){
	var url = "http://fajne-gry.eu"; 
	var title = "Fajne Gry"; 

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}

$(document).ready(function(){
	
    $('.tip').mouseover(function(){

  	  var id = this.id;
  	  var tresc = $("#tresc_"+id).html();
  	  
  	  var a = $("#"+id);
	  var offset = a.offset();	
	  
	  $("#info_"+id).remove();
	  $("body").append("<div id=\"info_"+id+"\" class=\"tooltip\" style=\"top:"+(offset.top+20)+"px;left:"+(offset.left+5)+"px;\"></div>");
      $("#info_"+id).html(tresc);
		

    });
    
   	$('.tip').mouseout(function(){
  	  var id = this.id;
  	  var tresc = this.title;	  
	  $("#info_"+id).remove();
    });  
    
	
    $(".wyniki tr:even").addClass("def");
	$(".wyniki tr:odd").addClass("abc");
	$(".wyniki tr").mouseover(function() {
    	$(this).addClass("tr_hover");
	}).mouseout(function() {
    	$(this).removeClass("tr_hover");
	});
		
	$('a.rodzice').click(function(){
  	  var buf = $(this).attr('id');
  	  var buf = buf.split("_");
  	  $("#dzieci_"+buf[1]).toggle('slow');
    });  
 	
 	$(".cosik").each(function(i) { 
		var buf = $(this).attr('id');
  	  	var buf = buf.split("_");
  	  	if($("#dzieci_"+buf[1]+" li a.selected").length > 0) {
    		$("#dzieci_"+buf[1]).show();
    	}
 	});

 	
 	if(parseInt($("#left").height()) < 570) $("#left").height(570);
 	if(parseInt($("#right").height()) < 570) $("#right").height(570);
});

