function getRequest() {

	var mr=null;
	try {
		mr=new ActiveXObject("Msxml2.XMLHTTP");
	} catch(A) {
		try {
			mr=new ActiveXObject("Microsoft.XMLHTTP");
		} catch(B) {
			mr=null;
		}
	}
	if(!mr) {
		if(typeof XMLHttpRequest!="undefined") {
			mr=new XMLHttpRequest();
		}
	} 
	return mr;
}

function keepAlive( url, interval, repeat ) {
	keepAliveContainer = setInterval("hitURL( '" + url + "', '" + repeat + "')", interval);
}

function hitURL( url, repeat ) {
	
	
	if ( ( keepAliveIteration > repeat ) ){
		clearInterval( keepAliveContainer );
		return;
	}
	
	if(0 == keepAliveIteration){//dont hit the server on first call.
		keepAliveIteration += 1;
		return;
		}
	
				
	var pXMLHTTPRequest = getRequest();						
	if(pXMLHTTPRequest && pXMLHTTPRequest.readyState!=0) {						
		pXMLHTTPRequest.abort();
	}		

	pXMLHTTPRequest.open("GET", url, true);
	pXMLHTTPRequest.onreadystatechange = function() {
		if(pXMLHTTPRequest.readyState == 4 && pXMLHTTPRequest.status == 200) {			
			respHandler(pXMLHTTPRequest.responseXML);
		}
	};
	
	pXMLHTTPRequest.send(null);
	
}

function respHandler(respXML){
	
	keepAliveIteration += 1;	
	
}

// to enable buttons after page is loaded for Button Customization - TTP: 4018
function setMouseActions(i_pButtonHolder, i_sAction, i_sValue) {
	//do nothing since the Homepage buttons are just regular buttons in this skin.
}

//enableDisable the button and change the class name to match that. - TTP: 4018
function enableDisableTextInClassName(i_pButtonHolder, i_bEnable) {
	var cn = i_pButtonHolder.className;
	if (i_bEnable) {
		i_pButtonHolder.disabled = false;
		cn = cn.replace(/-disabled/, '');
	}else {
		i_pButtonHolder.disabled = true;
		cn = cn + '-disabled';	
	}
	i_pButtonHolder.className = cn;
}

