﻿$(document).ready(function() {


				/* drukowanie */
				$(".print ").click(function(){window.print()});
				/* checkboxy */
				$('.checkBox input').checkbox();
				/* formy */
				$(".textBox").each(function(){
					$(this).focus(function(){
						$(this).css("background-color","#c8c8c8");
					});
					$(this).blur(function(){
						$(this).css("background-color","#979797");
					});
				});
				
				
				/* wielkosc referencji */
				var height = 0;
				$(".referencesList .refItem img").each(function() {
					if ($(this).height() > height)
						height = $(this).height();
					});
				$(".referencesList .refItem").each(function() {
					var imgHeight = $(this).children("IMG").height();
					var paddTop = (height - imgHeight) / 2;
					$(this).css("padding-top",paddTop);
					$(this).css("padding-bottom",paddTop);
					});
					
					
				
				/* SIFR */
				if(typeof sIFR == "function")
				{
					/* tytul webparta */
					sIFR.replaceElement(named(
						{
						sSelector:".ms-standardheader",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
					
					/* tytuly na stronie */
					sIFR.replaceElement(named(
						{
						sSelector:".title",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
					
					/* tytuly na stronie z webpartow */
					sIFR.replaceElement(named(
						{
						sSelector:".oneColumnContent .ms-standardheader",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
				
					/* tytul cytatu */
					sIFR.replaceElement(named(
						{
						sSelector:".cytat .ms-standardheader",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
					
					/* zawartosc cytatu */
					sIFR.replaceElement(named(
						{
						sSelector:".cytat .ms-WPBody",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#cccccc",
						sWmode: 'transparent'
						}
					));
				
					/* tytul bloga */
					sIFR.replaceElement(named(
						{
						sSelector:".blogTitle",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
				
					/* sifr 24 */
					sIFR.replaceElement(named(
						{
						sSelector:".sifr_24",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
					
					/* tytuly na mapie strony */
					sIFR.replaceElement(named(
						{
						sSelector:".toc-layout-main .level-header",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
					
					/* sifr 18 */
					sIFR.replaceElement(named(
						{
						sSelector:".sifr_18",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
				
					/* sifr 22 */
					sIFR.replaceElement(named(
						{
						sSelector:".sifr_22",
						sFlashSrc:"/Style Library/_fIles/K2Font.swf",
						sColor:"#ffffff",
						sWmode: 'transparent'
						}
					));
				
				
				}
				
				function GetFontSize(obj)
				{
					var fontSize = obj.css("font-size");
					return parseInt(fontSize.split("px")[0]);
				}
				function GetLineHeight(obj)
				{
					var lineHeight = obj.css("line-height");
					return parseInt(lineHeight.split("px")[0]);
				}
				
				$(".smallFont").click(function () { 
					$(".medium").each(function () {
				    	var fontSize = GetFontSize($(this));
				    	var lineHeight = GetLineHeight($(this));
				    	fontSize -= 2;
				    	lineHeight -= 2;
				    	$(".medium").css("font-size",fontSize + "px");
				    	$(".medium").css("line-height",lineHeight + "px");
				    	$(".medium").addClass("small");
				    	$(".small").removeClass("medium");
				   	});
					$(".big").each(function () {
				    	var fontSize = GetFontSize($(this));
				    	var lineHeight = GetLineHeight($(this));
				    	fontSize -= 4;
				    	lineHeight -= 4;
				    	$(".big").css("font-size",fontSize + "px");
				    	$(".big").css("line-height",lineHeight + "px");
				    	$(".big").addClass("small");
				    	$(".small").removeClass("big");
				   	});
				   	//fontSize = "small";
				   	//$.cookie(fontSizeCookieName,fontSize, { expires: 7 });
				});
				
				$(".mediumFont").click(function () { 
				
					$(".small").each(function () {
				    	var fontSize = GetFontSize($(this));
				    	var lineHeight = GetLineHeight($(this));
				    	fontSize += 2;
				    	lineHeight += 2;
				    	$(".small").css("font-size",fontSize + "px");
				    	$(".small").css("line-height",lineHeight + "px");
				    	$(".small").addClass("medium");
				    	$(".medium").removeClass("small");
				   	});
				   	$(".big").each(function () {
				    	var fontSize = GetFontSize($(this));
				    	var lineHeight = GetLineHeight($(this));
				    	fontSize -= 2;
				    	lineHeight -= 2;
				    	$(".big").css("font-size",fontSize + "px");
				    	$(".big").css("line-height",lineHeight + "px");
				    	$(".big").addClass("medium");
				    	$(".medium").removeClass("big");
				   	});
				   	//fontSize = "medium";
				   	//$.cookie(fontSizeCookieName,fontSize, { expires: 7 });
				});
				
				$(".bigFont").click(function () { 
					$(".small").each(function () {
				    	var fontSize = GetFontSize($(this));
				    	var lineHeight = GetLineHeight($(this));
				    	fontSize += 4;
				    	lineHeight += 4;
				    	$(".small").css("font-size",fontSize + "px");
				    	$(".small").css("line-height",lineHeight + "px");
				    	$(".small").addClass("big");
				    	$(".big").removeClass("small");
				   	});
				   	$(".medium").each(function () {
				    	var fontSize = GetFontSize($(this));
				    	var lineHeight = GetLineHeight($(this));
				    	fontSize += 2;
				    	lineHeight += 2;
				    	$(".medium").css("font-size",fontSize + "px");
				    	$(".medium").css("line-height",lineHeight + "px");
				    	$(".medium").addClass("big");
				    	$(".big").removeClass("medium");
				   	});
				   	//fontSize = "big";
				   	//$.cookie(fontSizeCookieName,fontSize, { expires: 7 });
				});
				
				
				var titleLength = $(".titleTable .title .sIFR-alternate").text().replace(/\s+/g, '').length;
				if (titleLength < 3)
					$(".titleTable").hide();
				
				
				$(".cytat").each(function(){
					$(this).hide()	
				   	var text = $(this).text().replace(/\s+/g, '');
					var length = text.length;
					if (length > 6)
					{
						$(this).show();
					}
				});
					
				/* lista case'ow przewijana */
				var count = 0;
				var selectedIndex = 0;
				var id = null;
				
				function Paging()
				{
					if (selectedIndex == count - 1)
						selectedIndex = 0;
					else
						selectedIndex++;
					itemId = "csItem_" + selectedIndex;
					$(".csItems .csItem").hide();
					$(".bullet").removeClass("clicked");
					$("#" + itemId).fadeIn();
					$(".csItem_" + selectedIndex).addClass("clicked");
				}
				
				$(".csItems .csItem").each(function(){
					count++;
				});
				if (count > 1)
				{
					$(".dots").show();
					var string = '';
					for(var j=0;j<count;j++)
						string += "<span class=\"bullet csItem_" + j + "\">&bull;</span>"
					$(".dots").html(string);
					$(".dots .csItem_0").addClass("clicked");
					id = setInterval("Paging();", 4000);
				}
				$(".bullet").each(function(){
					$(this).click(function(){
						clearInterval(id);
						id = setInterval("Paging();", 4000);
						var itemId = $(this).attr("class").split(" ")[1];
						selectedIndex = itemId.split("_")[1];
						$(".csItems .csItem").hide();
						$("#" + itemId).fadeIn();
						$(".bullet").removeClass("clicked");
						$(this).addClass("clicked");
					});
				});
				
				$(".contentRight .left .lead").each(function(){
					if ($(this).text().trim().length < 3)
						$(this).hide();
				});




      });


