function showSpecialContent (menuItemId, url, langId) {
	var specialContentDiv = document.getElementById("specialContent");
	specialContentDiv.innerHTML = "<div id=\"specialContentLoading\">&nbsp;Loading...</div>";
	var fullUrl = url + "/" + langId + "/special_content.go?menuItemId=" + menuItemId;
	doAjax(fullUrl, "", "specialContent");
	specialContentDiv.style.display = "block";	
	centerSpecialContent ();
	return false;
}

function closeSpecialContentDiv () {
	var specialContentDiv = document.getElementById("specialContent");
	specialContentDiv.innerHTML = "";
	specialContentDiv.style.display = "none";
}

function centerSpecialContent () {
	var specialContentDiv = document.getElementById("specialContent");
	var windowWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    windowWidth = window.innerWidth;
    windowHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
  }

	if (windowHeight > specialContentDiv.clientHeight) {
		var step1 = windowHeight - specialContentDiv.clientHeight;
		step1 = step1 / 2; 
		specialContentDiv.style.top = step1 + "px";
	} else {
		specialContentDiv.style.top = "0px";
	}

	if (windowWidth > specialContentDiv.clientWidth) {
		var step1 = windowWidth - specialContentDiv.clientWidth;
		step1 = step1 / 2; 
		specialContentDiv.style.left = (windowWidth - specialContentDiv.clientWidth) / 2 + "px";
	} else {
		specialContentDiv.style.left = "0px";
	}
}

function proccess(target, text){	
	document.getElementById(target).innerHTML = text;
	runScripts(target);
}

function runScripts(id) {
	var e = document.getElementById(id).getElementsByTagName("script");
	for(var i=0;i<e.length;i++) {
		 eval(e[i].innerHTML);
	}
}

function doAjax(url, params, target) {
//	proccess(target, 'Please wait...');

	req = GetXmlHttpObject();
	req.onreadystatechange = function(){
		if (req.readyState == 4) {
			if (req.status == 200) {
				var text = req.responseText;
				proccess(target, text);
			} else {
//				alert("Problem: " + req.statusText);
			}
		}
	}
	req.open('POST', url, true);
	req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	req.setRequestHeader("Content-length", params.length);
	req.setRequestHeader("Connection", "close");
	req.send(params);
}

function GetXmlHttpObject(){ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest){
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}