function startModalLoginWindow() {
	$.nyroModalManual({
		width: 576,
		height: 282,
		minWidth: 576,
		minHeight: 282,
		url: '#login-modal',
		closeSelector: '#closeBut',
		endFillContent: function(elts, settings, callback) {
			fixSecureModal();
		}
	});
	
}

function fixSecureModal() {
	$('#nyroModalContent').css({'overflow': 'hidden'});
	$('#nyroModalWrapper').css({'border': 0, 'background': 'none'});
	$('a#closeBut').css({'background': 'none', 'right': '20px', 'top': '12px', 'text-indent': 0, 'width': 'auto'});
}

function startModalWindow(url, selector, data, heightVal, widthVal) {
	if (heightVal == null) {
		heightVal = 690;
	}
	if (widthVal == null) {
		widthVal = 580;
	}
	if (!baseIsMobileUserAgent) {
		$.nyroModalManual({
			height: heightVal,
			minHeight: heightVal,
			width: widthVal,
			minWidth: widthVal,
			url: url,
			closeButton: null,
			closeSelector: '.close',
			hideContent: function(elts, settings, callback) {
				elts.contentWrapper.hide();
				callback();
			}
		});
		
		if(selector == 'removeUser') {
			var href = $(".btn-remove-user").attr("href");
			href = href.match(".*\?=") + data;
			$(".btn-remove-user").attr("href", href);
		}
	} else {
		window.location = url;
	}
}

function startCompetitionModalWindow(url, selector, data) {
	if (!baseIsMobileUserAgent) {
		$.ajaxSetup({ cache: true });
		jQuery.getScript('javascript/epolyv3.min.js');
		jQuery.getScript('javascript/LatLon.min.js');
		jQuery.getScript('javascript/excanvas.min.js');
		jQuery.getScript('javascript/jquery.flot.min.js');
		$.ajaxSetup({ cache: false });
		$.nyroModalManual({
			minHeight: 690,
			width: 600,
			url: url,
			closeButton: null,
			closeSelector: '.close',
			hideContent: function(elts, settings, callback) {
				stopModalCounting();
				elts.contentWrapper.hide();
				callback();
			}
		});
	} else {
		window.location = url;
	}
}

function startPremiumCompetitionModalWindow(url, selector, data) {
	if (!baseIsMobileUserAgent) {
		$.ajaxSetup({ cache: true });
		jQuery.getScript('javascript/epolyv3.min.js');
		jQuery.getScript('javascript/LatLon.min.js');
		jQuery.getScript('javascript/excanvas.min.js');
		jQuery.getScript('javascript/jquery.flot.min.js');
		$.ajaxSetup({ cache: false });
		$.nyroModalManual({
			minHeight: 690,
			width: 580,
			url: url,
			closeButton: null,
			closeSelector: '.close',
			hideContent: function(elts, settings, callback) {
				elts.contentWrapper.hide();
				callback();
			},
			endShowContent: function(elts, settings, callback) {
				if(typeof workoutId != undefined && workoutId != null && workoutId > 0) {
					getRoute(workoutId);
				}
			}
		});
	} else {
		window.location = url;
	}
}
