$(document).ready(function() {
	
	// wyszarzone teksty w inputach
	$('input[title!=""]').hint();
	
	$('.lupka').hover(function() {
		$(this).css('background', 'url("img/lupka.gif") no-repeat scroll -2px 0 transparent');
	},function() {
		$(this).css('background', 'url("img/global.gif") no-repeat scroll -205px -74px transparent');
	})
	$('.lupka a').click(function(){ $('form[name="search"]').submit(); return false; });
	
	// menu
	$(".mr, .mk, .mr2").hover(function() {
		$(this).attr("class", $(this).attr("class").toString()+'_sel');
	},function() {
		$(this).attr("class", $(this).attr("class").toString().replace('_sel',''));
	}).click(function() {
		document.location = $('a',this).attr("href");
	});

	//-----
	
	
	//przyciski 
	$('.jq_hover_green').hover(function() {
		$(this).addClass("btn_hover_green");
	}, function() {
		$(this).removeClass("btn_hover_green");
	}).click(function() {
		document.location = $('a',this).attr("href");
	});
	
	$('.jq_hover_pink').hover(function() {
		$(this).addClass("btn_hover_pink");
	}, function() {
		$(this).removeClass("btn_hover_pink");
	}).click(function() {
		document.location = $('a',this).attr("href");
	});
	
	$('.jq_bright_hover_green').hover(function() {
		$(this).addClass("btn_bright_hover_green");
	}, function() {
		$(this).removeClass("btn_bright_hover_green");
	}).click(function() {
		document.location = $('a',this).attr("href");
	});
	
	
	
	//strzalki up down
	$("a[rel^='jq_toggle|']").click(function() {
		var sClass = $(this).attr("class");
		var aRel = $(this).attr("rel").split("|");
		
		if(sClass.indexOf("_up") == -1) {
			$('#'+aRel[1]).slideDown();
			$(this).attr("class",sClass.replace("_down","_up"));
		} else {
			$('#'+aRel[1]).slideUp();
			$(this).attr("class",sClass.replace("_up","_down"));
		}
		return false;
	});
	
	
	//lewe menu
	$('.jq_lmenu').hover(function() {
		$(this).addClass("lm_hover");
		$(this).prev('div.hr').attr("class","hr_prev");
		$(this).next('div.hr').attr("class","hr_next");
	},function() {
		$(this).removeClass("lm_hover");
		$(this).prev('div.hr_prev').attr("class","hr");
		$(this).next('div.hr_next').attr("class","hr");
	}).click(function() {
		document.location = $('a',this).attr("href");
	});

	
	//hover do galerii 
	$('.img_box').hover(function() {
		$(this).addClass("ib_hover");
	}, function() {
		$(this).removeClass("ib_hover");
	});

	//radio buttony
	$('.jq_rf_radio').hover(function() {
		if ( $(this).hasClass('rf_frame') )
			$(this).removeClass('rf_frame').addClass('rf_frame_hover');
	}, function() {
		if ( $(this).hasClass('rf_frame_hover') )
			$(this).removeClass('rf_frame_hover').addClass('rf_frame');
	}).click(function() {
		$(this).parent().find('.rf_frame_sel').removeClass('rf_frame_sel').addClass('rf_frame');
		$(this).addClass('rf_frame_sel');
	});
	
	//checkboxy
	$('.jq_rf_checkbox').hover(function() {
		//if ( $(this).hasClass('rf_frame') )
			//$(this).removeClass('rf_frame').addClass('rf_frame_hover');
	}, function() {
		//if ( $(this).hasClass('rf_frame_hover') )
			//$(this).removeClass('rf_frame_hover').addClass('rf_frame');
	}).click(function() {
		if ( $(this).hasClass('rf_frame') )
			$(this).removeClass('rf_frame').addClass('rf_frame_sel');
		else
			$(this).removeClass('rf_frame_sel').addClass('rf_frame');
		
		
	});
	
	
	
	//oczka w ustawieniach wygladu
	$('.jq_oczko').click(function() {
		if($(":first-child",this).attr("class") == "uklad_ico_sel") {
			$(".uklad_ico_sel",this).attr("class","uklad_ico");
		} else {
			$(".uklad_ico",this).attr("class","uklad_ico_sel");
		}
	});
	
	
	
	
	if($('#digartfolio_widget').is("div") && $.browser.msie && $.browser.version=="6.0")	$('#digartfolio_widget').bottomLeft();

	//przycisk regulaminu
	$(".jq_reg_pink").hover(function() {
		$(this).addClass("reg_pink_sel");
	}, function() {
		$(this).removeClass("reg_pink_sel");
	});
	
	$(".jq_reg_green").hover(function() {
		$(this).addClass("reg_green_sel");
	}, function() {
		$(this).removeClass("reg_green_sel");
	});
	
	$(".profil_text a, .r_doswiadczenie a").hover( function(){
		$(this).css('color', $('.user_color').css('color'));
	}, function(){
		$(this).css('color', $('.profil_text').css('color') );
	    //$(".profil_text a, .r_doswiadczenie a").removeAttr('style');
	});
	
 });
 
 
 
jQuery.fn.extend({

	bottomLeft: function() {
		var t = $(this);
		$(window).scroll(function() {
			t.css('top', ($(this).scrollTop() + $(this).height() -t.css("bottom").substr(0,2) - t.height()) + 'px');
		});
	}
	
});


function makeActive(selector) {
	$(selector).mouseenter().unbind('mouseenter mouseleave');
}

$(function(){ $('#my_folio').unbind('click'); });

function urlencode(str) {
	str = str.replace("ó","o").replace("Ó","O").replace("ł","l").replace("Ł","L").replace("ń","n").replace("Ń","N").replace("ż","z").replace("Ż","Z").replace("ź","z").replace("Ź","Z").replace("Ć","C").replace("ć","c").replace("ę","e").replace("Ę","E").replace("Ś","S").replace("ś","s");	
	str = escape(str);
	str = str.replace('+', '%2B');
	str = str.replace('%20', '+');
	str = str.replace('*', '%2A');
	str = str.replace('/', '%2F');
	str = str.replace('@', '%40');
	return str;
}
function socialLinks( url, title, selector ) {
	url = urlencode(url);
	title = urlencode(title);
	$( (selector ? selector + ' ' : '') + '.social-networks .facebook').attr('href', 'http://www.facebook.com/sharer.php?u='+url+'&t='+title);
	$( (selector ? selector + ' ' : '') + '.social-networks .twitter').attr('href', 'http://twitter.com/share?text='+title+'&url='+url);
	$( (selector ? selector + ' ' : '') + '.social-networks .email').attr('href', 'mailto:?subject='+title+'&body='+url);
	$( (selector ? selector + ' ' : '') + '.social-networks .stumbleupon').attr('href', 'http://www.stumbleupon.com/submit?url='+url+'&title='+title);
}

function addslashes(str) {
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\0/g,'\\0');
	return str;
}
