function getHTTPRequest() {
	var xmlhttp = false;
	try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
	xmlhttp = false;
	}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function iecompattest(){
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function accessoryDetailsPop(sku, tab)	{
	var ns6=document.getElementById&&!document.all
	var xmlhttp = getHTTPRequest();
	var loadingDiv = document.getElementById("loadingDiv");
	var showTab = "";
	if (tab) {
		var showTab = "&q_tab="+tab;
	}
	xmlhttp.open("GET","/cell-phone-service/cell-phone-details/accessoryDetailsAJAX.jsp?q_sku=" + sku + showTab);
	
	xmlhttp.onreadystatechange = function()
	{
	if (xmlhttp.readyState == 4) {
		var accPreview = document.getElementById("accessoryPreviewDiv");
		accPreview.innerHTML = xmlhttp.responseText;
		// if the session expired, the AJAX div will try to load the expired session page. Test and redirect if so
		if (document.getElementById("expiredSession")) {
			window.location.href = "/cell-phone-service/get-started/expired-session.jsp";
			}
		else {
			loadingDiv.style.visibility = "hidden";
			accPreview.style.top=ns6? window.pageYOffset*1+50+"px" : iecompattest().scrollTop*1+50+"px"
			accPreview.style.visibility = "visible";
			}
		}
	}
	xmlhttp.send(null);
}

function showLoading(){
	var ns6 = document.getElementById&&!document.all;
	var loadingDiv = document.getElementById("loadingDiv");
	loadingDiv.style.top=ns6? window.pageYOffset*1+150+"px" : iecompattest().scrollTop*1+150+"px";
	loadingDiv.style.visibility = "visible";
}

