function createAJAX()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				//alert("Your browser does not support AJAX!");
				xmlHttp = null;
			}
		}
	}

	return xmlHttp;
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function showFlashBannerDetailPopup(iID, sURL)
{
	var xmlHttp = createAJAX();

	if(xmlHttp != null) {
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var result = trim(xmlHttp.responseText);
				document.getElementById("flashbanner_popup_text").innerHTML = result;
				document.getElementById("flashbanner_popup").style.top = (getScrollY()+130)+"px";
				document.getElementById("flashbanner_popup").className = "brand_flash_popup_visible";
			}
		}
		
		//API:
		//oXMLHttpRequest.open(bstrMethod, bstrUrl, varAsync, bstrUser, bstrPassword);
		//oXMLHttpRequest.send(varBody);
		
		var url = sURL;
		url += "?mode=details";
		url += "&id="+iID;
		
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null); // (param = POST data)
	}
}

function hideFlashBannerDetailPopup()
{
	document.getElementById("flashbanner_popup").className = "flashbanner_popup_hidden";
}

function brand_flash_click(hint)
{
	showFlashBannerDetailPopup(hint, "/BrandFlashServlet");
}

function productgroup_flash_click(hint)
{
	showFlashBannerDetailPopup(hint, "/ProductGroupFlashServlet");
}
