var xmlHttpRequest=init();

function init(){
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
}

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}


function loadTab(screen)
  {
   	// First Reset all  tabs
   	var currTabElem = document.getElementById("pgHome"); 
    currTabElem.setAttribute("class", "btn_inactive"); 
    currTabElem.setAttribute("className", "btn_inactive"); 
    
    
	currTabElem = document.getElementById("pgHome"); 
    currTabElem.setAttribute("class", "btn_inactive"); 
    currTabElem.setAttribute("className", "btn_inactive");    	

	currTabElem = document.getElementById("pgAboutUs"); 
    currTabElem.setAttribute("class", "btn_inactive"); 
    currTabElem.setAttribute("className", "btn_inactive");    	

	currTabElem = document.getElementById("pgNews"); 
    currTabElem.setAttribute("class", "btn_inactive"); 
    currTabElem.setAttribute("className", "btn_inactive");    	

	currTabElem = document.getElementById("pgTeam"); 
    currTabElem.setAttribute("class", "btn_inactive"); 
    currTabElem.setAttribute("className", "btn_inactive");    	

	currTabElem = document.getElementById("pgCarrers"); 
    currTabElem.setAttribute("class", "btn_inactive"); 
    currTabElem.setAttribute("className", "btn_inactive");    	

	currTabElem = document.getElementById("pgContactUs"); 
    currTabElem.setAttribute("class", "btn_inactive"); 
    currTabElem.setAttribute("className", "btn_inactive");    	
	
	
	// Set the current Tab
    currTabElem = document.getElementById(screen); 
    currTabElem.setAttribute("class", "btn_active"); 
    currTabElem.setAttribute("className", "btn_active"); 

	if(navigator.appName!='Netscape')
	{ 
	var ieversion
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	 ieversion=new Number(RegExp.$1)	
	 if(ieversion==6)
	   document.getElementById("tblMainMenu").style.marginBottom = "-12px";
	}
  }
  
if(window.attachEvent)
    window.attachEvent("onload",setListeners);

function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
        inputList[i].attachEvent("onpropertychange",restoreStyles);
        inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
        selectList[i].attachEvent("onpropertychange",restoreStyles);
        selectList[i].style.backgroundColor = "";
    }
}

function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
        event.srcElement.style.backgroundColor = "";
}  
