/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}

function activ_caledar(){
var http = createObject();
var nocache = 0;
document.getElementById('cont_calendar').innerHTML = "Va rugam asteptati...";
nocache = Math.random();

http.open('get', 'calendar_body.php?nocache = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);

function insertReply() {
if(http.readyState == 4){
var response = http.responseText;

document.getElementById('cont_calendar').innerHTML = ''+response;

}
}

}


function goLastMonth(month, year){
// If the month is January, decrement the year
if(month == 1){
--year;
month = 13;
}

var http = createObject();
var nocache = 0;
document.getElementById('cont_calendar').innerHTML = "Va rugam asteptati...";
nocache = Math.random();

http.open('get', 'calendar_body.php?month='+(month-1)+'&day=1&year='+year+'&nocache = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);

function insertReply() {
if(http.readyState == 4){
var response = http.responseText;

document.getElementById('cont_calendar').innerHTML = ''+response;

}
}

}//next function



function goNextMonth(month, year){
// If the month is December, increment the year
if(month == 12){
++year;
month = 0;
}

var http = createObject();
var nocache = 0;
document.getElementById('cont_calendar').innerHTML = "Va rugam asteptati...";
nocache = Math.random();

http.open('get', 'calendar_body.php?month='+(month+1)+'&day=1&year='+year+'&nocache = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);

function insertReply() {
if(http.readyState == 4){
var response = http.responseText;

document.getElementById('cont_calendar').innerHTML = ''+response;

}
}

} //end luna+

function remChars(txtControl, txtCount, intMaxLength)
{
if(txtControl.value.length > intMaxLength)
txtControl.value = txtControl.value.substring(0, (intMaxLength-1));
else
txtCount.value = intMaxLength - txtControl.value.length;
}

function checkFilled() {
var filled = 0
var x = document.form1.calName.value;
//x = x.replace(/^\s+/,""); // strip leading spaces
if (x.length > 0) {filled ++}

var y = document.form1.calDesc.value;
//y = y.replace(/^s+/,""); // strip leading spaces
if (y.length > 0) {filled ++}

if (filled == 2) {
document.getElementById("Submit").disabled = false;
}
else {document.getElementById("Submit").disabled = true} // in case a field is filled then erased

}
