var isPlaying = false;

function PlayOrStopSound(soundobj) {
	if(!isPlaying){
		isPlaying = true;
		PlaySound(soundobj);
	}else{
		isPlaying = false;
		StopSound(soundobj);
	}
}

function PlaySound(soundobj) {
    var thissound=document.getElementById(soundobj);
    thissound.play();
}

function StopSound(soundobj) {
    var thissound=document.getElementById(soundobj);
    thissound.pause();
    thissound.currentTime = 0;
}

var zoom=1;

function IncreaseSize() {
	if ($('body').css('zoom')!=null) {
		zoom=zoom+0.05;
		$('body').css('zoom',zoom);			
		localStorage.setItem("zoom",zoom);	
	} else {
		$('p,h1,h2,h3,h4,button,a').each(function() {
			var fontSize = parseInt($(this).css("font-size"));
			fontSize = (fontSize + 1) + "px";
			$(this).css({'font-size':fontSize});
		});
	}

	// zoom=zoom+0.05;
	// $('body').css('zoom',zoom);
	// $('body').css('-moz-transform',"scale("+zoom+")");
}

function DecreaseSize() {
	if ($('body').css('zoom')!=null) {
		zoom=zoom-0.05;
		$('body').css('zoom',zoom);		
		localStorage.setItem("zoom",zoom);
	} else {
		$('p,h1,h2,h3,h4,button,a').each(function() {
			var fontSize = parseInt($(this).css("font-size"));
			fontSize = (fontSize - 1) + "px";
			$(this).css({'font-size':fontSize});
		});
	}
}

function setGrayscaleMode() {
	if (localStorage.grayscale) {
		localStorage.removeItem("grayscale")
	} else {
		localStorage.setItem("grayscale","1");
	}
	window.location=window.location;
}

function accesibilityMode() {
	if (localStorage.grayscale) {
		//alert("prendelo");
		$('html').css('background',"#000000");
		$('body').css('background',"#000000");
		$('.vertical-center').css('background',"#000000");
		$('#application')
			.css('border-color',"#FFFFFF")
			.css('background',"#000000");
		$('#application>nav')
			.css('border-color',"#FFFFFF")
			.css('background',"#000000");
		$('.container')
			.css('color','#FFFFFF')
			.css('background-color','#000000');
		$('#application > nav > div > div > a').css('color','#FFFFFF');
		$('#navbar-collapse-1 > ul > li > a').css('color','#FFFFFF');
		$('#bottom-nav > ul > li > a').css('color','#FFFFFF');
		$('.text > h2').css('color','#FFFFFF');
		$('button')
			.css('color','#FFFFFF')
			.css('border','3px solid #FFFFFF')
			.css('background-color','#000000');
		$('img').css('background-color','#000000');
		$('.modal-content')
			.css('color','#FFFFFF')
			.css('border','3px solid #FFFFFF')
			.css('background-color','#000000');
		$('.modal-body')
			.css('color','#FFFFFF')
			.css('border','3px solid #FFFFFF')
			.css('background-color','#000000');
		$('.time')
			.css('color','#FFFFFF')
			.css('border','3px solid #FFFFFF')
			.css('background-color','#000000');
		$('#welcome-message')
			.css('color','#FFFFFF')
			.css('background-color','#000000');
		$('input')
			.css('color','#FFFFFF')
			.css('background-color','#000000');
		$('.alert')
			.css('color','#FFFFFF')
			.css('background-color','#000000');
		var filterVal = 'grayscale(1)';
		$('img')
		  .css('border','3px solid #FFF');
	}

	if ($('body').css('zoom')!=null) {
		$('body').css('zoom',localStorage.zoom);
	}
}

accesibilityMode();