$(document).ready(function() {
	$("#id_nick").DefaultValue('Nazwa');
	$("#id_email").DefaultValue('Adres e-mail (nie zostanie opublikowany)');
	$("#id_body").DefaultValue('Komentarz');
	$("#odkto").DefaultValue('Imię lub e-mail');
	$("#co").DefaultValue('Treść pytania');
	$('div.pagination .prev').html('&lsaquo;&lsaquo; poprzednia');
	$('div.pagination .next').html('następna &rsaquo;&rsaquo;');			
	 
	$("span#full_text").hide();
    $("span#cut_text a").click(function() {
    	$("span#cut_text").hide();
        $("span#full_text").show();          
    });
				
	//$('.box_rotate').hide();
	//$('.first').show();
	$('.rotator li').each(function(nr){
		$(this).attr('id', 'rotate-'+nr);
	});
	$('li#rotate-0 a').addClass('active');
	$('.rotator li a').each(function(nr){
		$(this).attr('rotate_number', nr);
		$(this).click(function(){
			show_tab($(this).attr('rotate_number'));
			return false;
		});
	});
	$('.box_rotate').each(function(nr){
		$(this).attr('id', 'rotate'+nr)
	});				

	var skyscraper_offset = $('#left_column').offset()-70;
	$('#skyscraper').css("top", skyscraper_offset.top);
	var reklama_height = $('#adv1').height();
	if (reklama_height == 0) {
		$('#adv1').css('display','none');
	} 		
});
function showMore(){
	$("p#video_lead").hide();
	$("p#video_description").fadeIn();	
	return false;
}
function showLess(){
	$("p#video_lead").fadeIn();
    $("p#video_description").hide();
	return false;
}
function show_tab(nr){
	$('.box_rotate').hide();
	$('#rotate-'+nr).show();
	$('#rotate'+nr).show();
	$('ul.rotator li > a').removeClass('active');
	$('li#rotate-'+nr+' a').addClass('active');
}
$.fn.DefaultValue = function(text){
    return this.each(function(){
		//Make sure we're dealing with text-based form fields
		if(this.type != 'text' && this.type != 'password' && this.type != 'textarea')
			return;
		
		//Store field reference
		var fld_current=this;
		
		//Set value initially if none are specified
        if(this.value=='') {
			this.value=text;
		} else {
			//Other value exists - ignore
			return;
		}
		
		//Remove values on focus
		$(this).focus(function() {
			if(this.value==text || this.value=='')
				this.value='';
		});
		
		//Place values back on blur
		$(this).blur(function() {
			if(this.value==text || this.value=='')
				this.value=text;
		});
		
		//Capture parent form submission
		//Remove field values that are still default
		$(this).parents("form").each(function() {
			//Bind parent form submit
			$(this).submit(function() {
				if(fld_current.value==text) {
					fld_current.value='';
				}
			});
		});
    });
};
