function onloadCall()
	{
		var y = eval(document.getElementById('ddYear').value);
		var m = eval(document.getElementById('ddMonth').value);
		groupId = document.getElementById('groupName').value;
		document.getElementById('groupNameDropDown').value = groupId;

		//showCalendar(m,y,'-1');
	}
function showBigCalendar()
		{
			parent.document.getElementById('landingPageForm').action="showCalendar.do";
			parent.document.getElementById('landingPageForm').target="_blank";
			parent.document.getElementById('landingPageForm').submit();
		}	
function nextfetchdata()
	{
		var groupId = document.getElementById('groupNameDropDown').value;
		document.getElementById('groupName').value = groupId;
		var y = eval(document.getElementById('ddYear').value);
		var m = eval(document.getElementById('ddMonth').value);
		if(m==12)
		{
			m=eval(1);
			y=eval(y+1);
		}
		else
		{
			m=eval(m+1);
		}			
		document.getElementById('ddMonth').value = m;	
		document.getElementById('ddYear').value = y;
		//showCalendar(m,y,groupId);
		parent.document.getElementById('landingPageForm').target="_self";
		parent.document.getElementById('landingPageForm').action="sdwHome.do";
		document.getElementById('landingPageForm').submit();
	}
function prevfetchdata()
	{
		var groupId = document.getElementById('groupNameDropDown').value;
		document.getElementById('groupName').value = groupId;
		var y = eval(document.getElementById('ddYear').value);
		var m = eval(document.getElementById('ddMonth').value);
		if(m==1)
		{
			m=eval(12);
			y=eval(y-1);
		}
		else
		{
			m=eval(m-1);
		}
		
		document.getElementById('ddMonth').value = m;	
		document.getElementById('ddYear').value = y;
		//showCalendar(m,y,groupId);
		parent.document.getElementById('landingPageForm').target="_self";
		parent.document.getElementById('landingPageForm').action="sdwHome.do";
		document.getElementById('landingPageForm').submit();
	}
function fetchGroupData()
{
	var y = eval(document.getElementById('ddYear').value);
	var m = eval(document.getElementById('ddMonth').value);
	var groupId = document.getElementById('groupNameDropDown').value;
	document.getElementById('groupName').value = groupId;
	//showCalendar(m,y,groupId);
	parent.document.getElementById('landingPageForm').target="_self";
	parent.document.getElementById('landingPageForm').action="sdwHome.do";
	document.getElementById('landingPageForm').submit();
}


function showCalendar(m,y,groupId)
{	
	url='showCalendar.do?ddMonth='+m+'&ddYear='+y+'&isAjaxCall=Y'+'&groupName='+groupId;

	  //Do the Ajax call
      if (window.XMLHttpRequest){ // Non-IE browsers
                  req = new XMLHttpRequest()
                  //A call-back function is define so the browser knows which function to call after the server gives a reponse back
                  req.onreadystatechange = populateCalendar;
                try {
                        req.open("GET", url, true) //was get
                  } 
                  catch (e) {
                  alert("Cannot connect to server")
                  }
                  req.send(null)
      } 
      else if (window.ActiveXObject) { // IE      
                  req = new ActiveXObject("Microsoft.XMLHTTP");
                  if (req) {
                  req.onreadystatechange = populateCalendar;
                  req.open("GET", url, true);
                  req.send();
                  }
      }
}

function populateCalendar()
{
	 if(req.readyState == 4 && req.status==200)
     	{
			document.getElementById('calendarDiv').innerHTML = req.responseText;
		}
}
