
// PHP Calendar Class Version 1.0 (26 Apr 2009)
//  
// Copyright Raja MM 2009 - 2010. All Rights reserved.
// 
// This software may be used, modified and distributed freely
// providing this copyright notice remains intact at the head 
// of the file.
//
// This software is freeware. The author accepts no liability for
// any loss or damages whatsoever incurred directly or indirectly 
// from the use of this script. The author of this software makes 
// no claims as to its fitness for any purpose whatsoever. If you 
// wish to use this software you should first satisfy yourself that 
// it meets your requirements.
//
// URL:   http://www.PACECODE.com/blog/
// Email: pacecodes@gmail.com

// JavaScript Document
function showMonthViewCalender(str){
	
	var xmlHttp3;
	
	xmlHttp3 = GetXmlHttpObject();
	
	//If we cant do the request error out
	if (xmlHttp3==null) {
	 	alert ("Browser does not support HTTP Request")
	 	return
	}
	
	
		//First build the navigation panel
		var url="calender.php"
		url=url+"?sid="+Math.random()
		
	
	//Once the page finished loading put it into the div
	xmlHttp3.onreadystatechange=stateChanged 
	
	//Get the php page
	xmlHttp3.open("GET",url,true)
	xmlHttp3.send(null)



	
	function stateChanged() { 
		//IF this is getting called when the page is done loading the states then output the div
		if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete") { 
		
			document.getElementById("month_view_calender").innerHTML=xmlHttp3.responseText;
			
			
		} 
	}
	
	
	

	
}


function GetXmlHttpObject() {
	//Determine what browser we are on and make a httprequest connection for ajax
	var xmlHttp=null;

	try {
	 	// Firefox, Opera 8.0+, Safari
	 	xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
	 	//Internet Explorer
	 	try {
	  		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  	}
	 	catch (e) {
	  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
	}
	
	return xmlHttp;
}



function monthViewCalNavigation(mon,godina){
	
	//alert(godina);
	
	jQuery.ajax({
   type: "POST",
   url: "calendar/calender.php",
   data: "mon="+mon+"&godina="+godina+"&sid="+Math.random()+"&objekt="+ jQuery("#app").val(),
   success: function(html){
     jQuery("#call").html(html);
   }
 });

	
	
	
	/*var mon;
	
	var xmlHttp4;
	
	xmlHttp4 = GetXmlHttpObject();
	
	//If we cant do the request error out
	if (xmlHttp4==null) {
	 	alert ("Browser does not support HTTP Request")
	 	return
	}
	
	
		//First build the navigation panel
		var url="calender.php"
		url=url+"?mon="+mon
		url=url+"&sid="+Math.random();
		
	
	//Once the page finished loading put it into the div
	xmlHttp4.onreadystatechange = stateChanged;
	
	//Get the php page
	xmlHttp4.open("GET",url,true);
	xmlHttp4.send(null);



	
	function stateChanged() { 
		//IF this is getting called when the page is done loading the states then output the div
		if (xmlHttp4.readyState==4 || xmlHttp4.readyState=="complete") { 
		
			document.getElementById("month_view_calender").innerHTML=xmlHttp4.responseText;
			
		} 
	}*/
	

	
	
}





function klik_day(dan,mjesec,godina)
{
	jQuery.ajax({
			type: "POST",
			url: "calendar/trpaj.php",
			data: "dan="+dan+"&mjesec="+mjesec+"&godina="+godina+"&objekt="+jQuery("#app").val(),
			success: function(html){
			  jQuery("#tjedan").html(html);
				
				jQuery.ajax({
					type: "POST",
					url: "calendar/calender.php",
					data: "mon="+mjesec+"&godina="+godina+"&sid="+Math.random()+"&objekt="+jQuery("#app").val(),
					success: function(html){
						jQuery("#call").html(html);
					}
				});
				
			}
	});
	

}



