function write_mhref(user, domain, text)
{
	var at = '@';
	var mail = user + at + domain;
	document.write("<a href='mailto:" + mail + "' title='Napisz do nas'>" + ( text == undefined ? mail : text ) + "</a>");
}

function showGoogleMap(var_id,var_gps_x,var_gps_y,var_title,var_zoom)
{
	var myLatlng = new google.maps.LatLng(var_gps_x,var_gps_y);
	var myOptions = {
		zoom: var_zoom,
		center: myLatlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	var map = new google.maps.Map(document.getElementById(var_id), myOptions);
	
	if(var_title!=false)
	{
		var contentString = var_title;
      
		var infowindow = new google.maps.InfoWindow({
			content: contentString
		});
	}
	
	var marker = new google.maps.Marker({
		position: myLatlng,
		map: map
	});
	
	if(var_title!=false)
	{
		google.maps.event.addListener(marker, 'click', function() {
			infowindow.open(map,marker);
		});
	}
}

$(function() {
	$(".okienko").fancybox({'hideOnOverlayClick':true,padding:15,titleShow:false});
	$("a.lightbox").fancybox({titlePosition:'over'});
	$('.img').each(function() {
		$(this).hover(function() {
			$(this).stop().animate({ opacity: 0.6 }, 200);
			},
		function() {
			$(this).stop().animate({ opacity: 1.0 }, 500);
		});
	});
});

$(document).ready(function(){
	var originalFontSize = $('#content').css('font-size');
	$("#resizeLinkOrg").click(function(){
		$('#content').css('font-size', originalFontSize);
		return false;
	});
	$("#resizeLinkUp").click(function(){
		var currentFontSize = $('#content').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 12);
		var newFontSize = currentFontSizeNum+1;
		$('#content').css('font-size', newFontSize);
		return false;
	});
	$("#resizeLinkDown").click(function(){
		var currentFontSize = $('#content').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 12);
		var newFontSize = currentFontSizeNum-1;
		$('#content').css('font-size', newFontSize);
		return false;
	});
});
function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function show_hide_news()
{
	if(document.getElementById("footer_scroll").style.visibility == "hidden")
	{
		setCookie('footernews','on',365);	
		document.getElementById("footer_scroll_off").style.visibility = "hidden";
		document.getElementById("footer_scroll").style.visibility = "visible";
	}
	else
	{
		setCookie('footernews','off',365);	
		document.getElementById("footer_scroll_off").style.visibility = "visible";
		document.getElementById("footer_scroll").style.visibility = "hidden";
	}
}

$(document).ready(function(){
	// Reset Font Size
	var originalFontSize = $('.textContent').css('font-size');
	$(".resetFont").click(function(){
		$('.textContent').css('font-size', originalFontSize);
			return false;
	});
	// Increase Font Size
	$(".increaseFont").click(function(){
		var currentFontSize = $('.textContent').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*1.2;
		if(newFontSize < 24){        
			$('.textContent').css('font-size', newFontSize);
		}
		return false;
	});
	// Decrease Font Size
	$(".decreaseFont").click(function(){
		var currentFontSize = $('.textContent').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*0.8;
		if(newFontSize > 8) {
			$('.textContent').css('font-size', newFontSize);
		}
		return false;
	});
	
	var contrast = 0;
	$(".setContrast").click(function(){
		if(contrast==0)
		{
			contrast = 1;
			$("#contrast_css").attr("href","css/style_contrast.css");
		}
		else
		{
			contrast = 0;
			$("#contrast_css").attr("href","");
		}
		return false;
	});
});
