var domainroot="www.msmedi-chennai.gov.in";
	
function Gsitesearch(curobj)
{
	curobj.q.value="site:"+domainroot+" "+curobj.qfront.value;
}



/********************************** New E-NewsLetter ******************************/

function fnchangecolor()
{
document.getElementById("jan").style.backgroundColor = "#cccccc"; 
}

function fnenewsclickleft()
{
var year1=document.getElementById('eyear').value;
var origin=parseFloat(year1)-1;
document.getElementById('eyear').value=origin;

fnloadENewsRequest(origin);
/*var option1=new Option();
option1.text=origin;
option1.value=origin;
var select = document.getElementById("eyear");
if(select.options.length > 0) 
{
  t=select.options.length;
  if(origin<2010)
  {

    return;
  }
  else
  {
  document.getElementById('eyear').value=origin;
  }
}**/
//document.getElementById('eyear').options[document.getElementById('eyear').length]=option1;
//
//var select = document.getElementById("eyear");
//if(select.options.length > 0) {
//t=select.options.length;
//}
//else
//{
//    window.alert("Select box is empty");
//}
//for(var i=0;i<t;i++)
//{
//    document.getElementById('eyear').options[i].selected=true;
//}
}

function fnenewsclickright()
{
var year1=document.getElementById('eyear').value;
var origin=parseFloat(year1)+1;
document.getElementById('eyear').value=origin
fnloadENewsRequest(origin);
/**var option1=new Option();
option1.text=origin;
option1.value=origin;**/


///document.getElementById('eyear').options[document.getElementById('eyear').length]=option1;

/**var select = document.getElementById("eyear");

if(select.options.length > 0) 
{
  t=select.options.length;
  if(origin>2016)
  {

    return;
  }
  else
  {
  document.getElementById('eyear').value=origin;
  }
}
else
{
    window.alert("Select box is empty");
}

  **/


}

function fnsubmitflashnews()
{
//window.location.href="/MSME/morenews.jsp";
alert('sdsds');;
//location.href=document.getElementById('feb').value;
location.href="/MSME/moreflash.jsp?tdate=";

}

function fnsubmitmonthyear(val,mon)
{
//window.location.href="/MSME/morenews.jsp";

//location.href=document.getElementById('feb').value;

location.href="/MSME/morenews.jsp?tdate="+val+"&year1="+document.getElementById('eyear').value+"";
fnENewsRequest(val);
}

function fnENewsRequest(val)
{
	/** declare variable , used to server url*/
	var queryString="/MSME/enews.do";
	
	var meth="getFilePath";
		queryString =queryString+"?sbuttonaction="+meth+"&month="+val+"&year="+document.getElementById('eyear').value;	
	
		AJAXrequest("XML",queryString,"0",fnENewsAresponse,[meth]);
	
}
function fnloadENewsRequest(val)
{
	/** declare variable , used to server url*/
	var queryString="/MSME/enews.do";
	
			var meth="loadenewsvalue";
		queryString =queryString+"?sbuttonaction="+meth+"&year="+val;	
		//alert(queryString)	
		AJAXrequest1("XML",queryString,"0",fnENewsAresponse,[meth]);
	
}
function fnENewsAresponse(result,indesx,method) 
{

if(method=='getFilePath')
{
var size = result.getElementsByTagName("enews_id").length;

	var inhtml ="";
	var inhtml ="<table align='center' style='border-collapse:collapse;border-color:black' border='1'>";
	
	inhtml = inhtml + "<tr>";
	inhtml = inhtml + "<th>S.No</th>";
	inhtml = inhtml + "<th>E-News Letter</th>";
	inhtml = inhtml + "</tr>";
	for (var i = 0; i < Number(size); i++) 
	{
	
	inhtml = inhtml + "<tr>";
	
		var result1 = result.getElementsByTagName("enews_path")[i].text;
		inhtml = inhtml+"<td style='border-bottom:none;'>"+(parseInt(i)+1)+"</td>"
		inhtml = inhtml+"<td style='border-bottom:none;'><a href='"+result.getElementsByTagName("enews_path")[i].text+"'>"+result.getElementsByTagName("enews_name")[i].text+"</a></td>";
		//inhtml = inhtml+"<td style='border-bottom:none;'>"+result.getElementsByTagName("enews_path")[i].text+"</td>";
		inhtml = inhtml + "</tr>";
	}
	inhtml = inhtml + "</table>";
	}
	else
	if(method=='loadenewsvalue')
	{
	var size = result.getElementsByTagName("flag").length;
	for(var i=1;i<13;i++)
	{
	//var pgm = result.getElementsByTagName("PrgList"+(i))[0].childNodes[0].nodeValue;
	//var styleid=result.getElementsByTagName("name")[i].childNodes[0].nodeValue;
	document.getElementById("mon"+i).style.background="#EEEEEE";
	document.getElementById("mon"+i).style.color="#000000";
	var l=i-1;
	if(result.getElementsByTagName("flag")[l].childNodes[0].nodeValue=='1')
	
	{
document.getElementById("mon"+i).style.background="green";
	//document.getElementById(styleid).src="images/butoongree.jpg";
	document.getElementById("mon"+i).style.color="white";
	 //document.getElementById(styleid).onClick="";
	}
	else
	{
	document.getElementById("mon"+i).title='No data found';
	}
	//else
	//document.getElementById(styleid).style.background="red";
	}
	
	}
	//document.getElementById("res").innerHTML=inhtml;
	
}


