var cUID = null;
var uUID = null;

function showCalendar(user, connection){
	cUID = connection;
	uUID = user;
	var elm = document.getElementById(uUID+'date');
	secoya.calendar.createCalendar(true);
	secoya.calendar.setCallback(updateDate);
	secoya.calendar.showDbValue('nteg',elm.innerHTML);
}

function updateDate(date){
	var d = new Date(date);	
	ms.invokeMethod('m-19',cUID,'invoke','setExpiration',d.phpFormat('Y-m-d H:i:s'),uUID)
	var elm = document.getElementById(uUID+'date');
	elm.innerHTML = d.phpFormat('Y-m-d H:i:s');
}

window.gynzone = (function(w, d){
	function getId(id) {
		return d.getElementById(id);
	};

	return {
		cycleCites: function () {
			var e = getId('patients_news');
			if (!w.core && e) {
				var quotes = e.getElementsByTagName('blockquote');
				for (var i = 1; i < quotes.length; i++) {
					quotes[i].style.display = 'none';
				}
				i = 0;
				var func = function(x) {
					lightCore.setOpacity(quotes[i], x);
				};
				var fadein, fadeout = new secoya.fx({
					from: 100,
					to: 0,
					duration: 0.5,
					callback: func,
					finish: function() {
						quotes[i].style.display = 'none';
						i++;
						if (i >= quotes.length)
							i = 0;
						quotes[i].style.display = 'block';
						fadein.start();
					}
				});
				fadein = new secoya.fx({
					from: 0,
					to: 100,
					duration: 0.5,
					callback: func,
					finish: function() {
						setTimeout(function(){
							fadeout.start();
						}, 10000);
					}
				});
				setTimeout(function(){
					fadeout.start();
				}, 10000);
			}
		}
	};
})(window, document);