$(document).ready(function(){
	$('#calendar').datePicker({
		inline:true
		
	})
	.bind('dateSelected',
		function(e, selectedDate, $td)
		{
			var day = selectedDate.getDay();
			if (day > 0 && day < 7) {
				getGlist(day)	;
			}
		}
	);
	
	var today = new Date();
	getGlist(today.getDay());	
})

function getGlist(day) {
	$("#time_table").fadeOut("fast", function(){
		$.post(siteadress + 'inc/gydytojai_list.php', {day:day}, function(data) {
			$("#time_table").html(data);					
			$("#time_table").fadeIn("slow");
		})				
	})		
}

function shadowOpen(file_name, title) {
	
	Shadowbox.open({
		type: 'img',
		title: title,
		content: siteadress + file_name,
		overlayOpacity: 0
	});
}



jQuery.jPrintArea=function(el) {
	var title = $('#content_title').html();
	var print_area = window.open(siteadress+'print.html', 'print_a', 'top=10, left=10, width=800, height=600, scrollbars=1, titlebar=0, toolbar=0, location=0, menubar=0, resizable=1, channelmode1=0, directories=0, status=0');
	var links=window.document.getElementsByTagName('link');
	print_area.document.write('<head>');
	print_area.document.write('<script type="text/javascript" src="js/print.js"></script>');
	print_area.document.write('<style type="text/css">.no_show{display:none}</style><style type="text/css" media="print">#pbut{display:none}.no_show{display:none}</style>');
	
	
	
	
	for(var i=0;i<links.length;i++)
		if(links[i].rel.toLowerCase()=='stylesheet')
			print_area.document.write('<link type="text/css" rel="stylesheet" href="'+links[i].href+'"></link>');
	print_area.document.write('</head>');
	print_area.document.write('<body onLoad="self.print()">');
	print_area.document.write('<p style="font-weight:bold">'+ title +'</p>');
	print_area.document.write('<hr>');
	print_area.document.write('<div id="content" style="margin:0">');
	
	print_area.document.write('<div class="'+$(el).attr("class")+'">'+$(el).html()+'</div>');
	
	print_area.document.write('<div id="pbut" style="page-break-before:always">');
	print_area.document.write('<a  style="float:right;font-size:10px;clear:both;width:80px;height:16px;line-height:16px;text-align:center;color:#000;display:block;text-decoration:none;border:1px solid;black" href="javascript:printP();">Spausdinti</a>');
	print_area.document.write('</div></div></body>');
	print_area.document.close();
	print_area.focus();

}

