var xmlhttp,alerted;
var userstr;
var originalLine;
var english = 0;
var dayForEnglish;
var monForEnglish;


/*============================================================================*/
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.

try {
    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
} catch (e) {
    try {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    } catch (E) {
        alert("You must have Microsofts XML parsers available")
    }//End of inner TRY-CATCH BLOCK of checking IE
}//End of TRY-CATCH BLOCK of checking Firefox

@else
    alert("You must have JScript version 5 or above.")
xmlhttp=false
alerted=true
@end @*/
/*============================================================================*/

if (!xmlhttp && !alerted) {
    // Non ECMAScript Ed. 3 will error here (IE<5 ok), nothing I can 
    // realistically do about it, blame the w3c or ECMA for not
    // having a working versioning capability in  <SCRIPT> or
    // ECMAScript.
    try {
        xmlhttp = new XMLHttpRequest();
    } catch (e) {
        alert("You need a browser which supports an XMLHttpRequest Object.\nMozilla build 0.9.5 has this Object and IE5 and above, others may do, I don't know, any info jim@jibbering.com")
    }
}//End of Condition - if (!xmlhttp && !alerted)

function getHtml(day, mon_var) {
    
    dayForEnglish = day;
    monForEnglish = mon_var;
    if (xmlhttp) {   
       //alert('day   '+day + 'mon_var  '+mon_var + 'selectedTab' + selectedTab + xmlhttp);
       var first="home";
       var filePath;

            if (selectedTab == 0 && english == 0) {
                //alert('processing===>0');
                filePath =  'Sangeetham/'+mon_var+day+'.html'; 
			//	alert("1"+filePath);
            } else if(selectedTab == 1 && english == 0){
                filePath =  'Nattiyam/'+mon_var+day+'.html'; 
				 }else if(selectedTab == 0 && english == 1){                
                filePath =  'SangeethamE/'+mon_var+day+'.html';
				 } else{
                filePath =  'NattiyamE/'+mon_var+day+'.html';
				 }
//alert(filePath);
        xmlhttp.open("GET", filePath, true);
        xmlhttp.setRequestHeader("Content-Type", "text/html; charset=utf-8");
        xmlhttp.onreadystatechange=RSchange1
        xmlhttp.send(null)
    }
}//End of Function - processFile(usrQuery)

function RSchange1() {
    var userstr1;
	if (xmlhttp.readyState==4) {
       if(english == 0){
           userstr = "<a style=\"float:right;\" href=\"javascript: changeValueOfEnglish()\">English</a><br> ";
       }
       else{
           userstr = "<a style=\"float:right;\" href=\"javascript: changeValueOfEnglish()\">தமிழ்</a><br> ";
       }
       if(monForEnglish == 'home'){
           userstr = xmlhttp.responseText; 
       }
       else{
           //alert('userstr' + monForEnglish );
           userstr += xmlhttp.responseText;
       }
       //alert(userstr);
       
       var clearString = " ";
      document.getElementById("putHtmlHere").innerHTML = userstr;
		document.getElementById("DisplayNumOfResults").innerHTML = clearString;
		//alert( userstr)
       document.getElementById("pageNumber").innerHTML = clearString;
 }//End of Function - (xmlhttp.readyState==4)
}//End of Function - RSchange()	

function changeValueOfEnglish(){
    if(english == 0){
        english = 1;
    }
    else{
        english = 0;
    }
    getHtml(dayForEnglish, monForEnglish);
}
