Cufon.set('fontFamily', 'Whitman RomanLF','fontStyle','normal').replace('#head h2');
                     Cufon.replace('.ready li span,.ready li h3 a,#send_error_popup h3,#fpswitcher li,.cufon-tx,.fb-sg span,.descr h3,.nagl-akredytacje,.cufon_sub,.cufon_r,.nagl-news,.op-os h3,.oswiad h3,.news-related h3,.list-trans h3,.list-galery h3,#history #history-text li h3,#history #history-text li h4,#history .history-list-text li .info-txt h3 ');
                     Cufon.replace('#sitemap > li > h3 a');
                     Cufon.replace('#tabs li a', {
                    		hover: true
                    	});
                     Cufon('#tabs li a', {
                    		hover: {
                    			color: '#000000'
                    		}
                    	});

                     function initInputLabelFromLabel(input_id,label_id) {

                    		var text = $(label_id).text(); 

                    		$(input_id).val(text);

                    		$(input_id).focus( function() {

                    			if ($(this).val() == text) {

                    				$(this).val("");

                    			}

                    		} );

                    		  $(input_id).blur( function() {

                    			if ($(this).val() == '') {

                    				$(this).val(text);

                    			}

                    		} );

                    	}
function initInputLabelFromInput(input_id) {
	var text = $(input_id).val(); 
	$(input_id).val(text);
	$(input_id).focus( function() {
		if ($(this).val() == text) {
			$(this).addClass('focus');
			$(this).val("");
		}
	} );
	  $(input_id).blur( function() {
		if ($(this).val() == '') {
			$(this).removeClass('focus');
			$(this).val(text);
		}
	} );
}

function initPrint() {
	$(".a_print").click(function() {
		window.print();
		return false;
	});
}

function initBack() {
	$(".back a").click(function() {
		history.back();
		return false;
	});
}

function initUp() {
	$('.up').click(
	function(){
		$.scrollTo($("#branding"),1000);
		return false;
	}		
	);
	$('.up-li').click(
			function(){
				$.scrollTo($("#branding"),1000);
				$('#go_to_item select').val('');
				return false;
			}		
			);
	
}

function initGoTo(){
	$('#go_to_item select').change(
			function(){
				var Gotonr = $('#go_to_item select').val();
				$.scrollTo($('#'+Gotonr+''),1000);
			}
	);
}


function hover() {
	$('.gal-list li').hover(
			function(){$(this).find('a').addClass('hover');},
			function(){$(this).find('a').removeClass('hover');}
	
	);

}


function sTarget(slink){
	$(slink).attr('target','_blank');
}

function ResizeText(){
	$('.size .c2').css('opacity','0.5');
	$('.size a').click(
			function(event){
				event.preventDefault();
				_this = $(this);
				var cls = _this.attr('class');
				var originalFontSize = $('.edytor').css('font-size');
				var originalLineHeight = $('.edytor').css('line-height');
				if(cls=="c1"){

					$('.size .c2').css('opacity','1');
							var currentFontSizeNum = parseFloat(originalFontSize, 10);
							var currentLineHeightNum = parseFloat(originalLineHeight, 10);
							
							if(currentFontSizeNum <= 19){var newFontSize = currentFontSizeNum * 1.5;
							var newLineHeight = currentLineHeightNum * 1.5;
							
							if(newFontSize>19){_this.css('opacity','0.5');}
							
							 var cssObj = {
								      'line-height' : newLineHeight + 'px',
								      'font-size' : newFontSize
								    }
							$('.edytor').css(cssObj); }
							else {_this.css('opacity','0.5');}
							
				}
				else if(cls=='c2'){
					$('.size .c1').css('opacity','1');
					var currentFontSizeNum = parseFloat(originalFontSize, 10);
					var currentLineHeightNum = parseFloat(originalLineHeight, 10);
					
					if(currentFontSizeNum == 12){_this.css('opacity','0.5');}
					else {var newFontSize = currentFontSizeNum / 1.5;
					var newLineHeight = currentLineHeightNum / 1.5;
					if(newFontSize < 13){_this.css('opacity','0.5');}
					 var cssObj = {
						      'line-height' : newLineHeight + 'px',
						      'font-size' : newFontSize
						    }
					$('.edytor').css(cssObj);
					 }
				}
				else {}
			}
	);
	$('input:text').addClass('fcs');
	$('textarea').addClass('fcs');
}

function initfocus(input_id) {
	var text = $(input_id).val(); 
	$(input_id).focus( function() {
			$(this).addClass('focus');	
	} );
	  $(input_id).blur( function() {
			$(this).removeClass('focus');
	} );
}

function initialize() {
	initInputLabelFromInput("#search");
	initInputLabelFromInput(".newsletter .inp input");
	initInputLabelFromInput("#log-for-log");
	initInputLabelFromInput("#log-for-pass1");
	initInputLabelFromInput("#log-for-log");
	initInputLabelFromLabel("#log-for-log","#log-for-log-l");
	initInputLabelFromLabel("#log-for-pass1","#log-for-pass1-l");
	hover();
	initPrint();
	initUp();
	initGoTo();
	ResizeText();
	initBack();
	initfocus(".fcs");
	
	sTarget('.a_prezydencja')
}
$(document).ready(initialize);



