var gDispatchDir = "";
var gLinkExt = "";
var gImgPath = "";
var gShowBanners = "";
var gURI = "";

function init(HTTPURL,SHOW_BANNERS)
{
	gDispatchDir = HTTPURL+"dispatch/";
	gLinkExt = "?page=0";
	gImgPath = HTTPURL+"images/hider_bg.gif";
	gShowBanners = SHOW_BANNERS;
	gURI = HTTPURL;
}

function ChkSameTabAndXMLProcess(classN,divid,activate,deactivate,phplink,overdiv,prefix)
{
  xmllink = gDispatchDir+"dispatch/"+phplink;
  document.getElementById(activate).className = 'active';
  document.getElementById(deactivate).className = 'nonactive';
  XMLProcess(xmllink,divid,overdiv);
}

function XMLProcess(xmllink,divid,overdiv)
{
	//RefreshBanners(gShowBanners);
	//DoWait(divid, overdiv);
	setTimeout("delay()",2000);
	loadXMLDoc(xmllink,"DoEnable('"+overdiv+"')",divid);
}

function DoEnable(overdiv)
{
	if(document.getElementById(overdiv)) document.getElementById(overdiv).style.display='none';
}

function DoWait(divel,overdiv)
{
	divid = document.getElementById(divel);
	
	//***************************************************//
	//if divel is in HTMLLiElement i.e. draging available//
	//NOTE: getAttribute('parentLiId') <-> parentLiId have to be the id of li element NOT the attribute itemID of the li element//
	//***************************************************//
	var liObjOffsetLeft=0;
	var liObjOffsetTop=0;
	try
	{
		var liId = divid.getAttribute('parentLiId');
		var liObj = document.getElementById(liId);
		liObjOffsetLeft = liObj.offsetLeft;
		liObjOffsetTop = liObj.offsetTop;
	}
	catch (err) {}
	
	if(document.getElementById(overdiv))
	{
		//if is dragable destroy the overdiv ... will be create a new one later to update the new offsets after drag's end
		if(liObjOffsetLeft > 0)
			document.body.removeChild(document.getElementById(overdiv));
		//else just show the old one 
		else 
			document.getElementById(overdiv).style.display='block';
		
		return;
	}
	
	img = gImgPath;
	
	if(divid.style.position == 'absolute') divid.style.position='absolute';
	else divid.style.position='relative';
	
	if(liObjOffsetLeft > 0)
	{
		parentDivTop = parseInt(liObjOffsetTop + 30);
		parentDivLeft = parseInt(liObjOffsetLeft + 5);
	}
	else
	{
		parentDivTop = divid.offsetTop;
		parentDivLeft = divid.offsetLeft;
	}
	
	parentDivWidth = divid.style.width;
	parentDivHeight = divid.style.height;
	//divid.style.position='abosolute';
	
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id',overdiv);
	
	newdiv.style.position='absolute';
	newdiv.style.left = parentDivLeft;
	newdiv.style.top = parentDivTop;
	newdiv.style.width = parentDivWidth;
	newdiv.style.height = parentDivHeight;
	//newdiv.style.background='url('+img+')';
	newdiv.style.backgroundColor='#E3E3E3';
	newdiv.style.backgroundRepeat='repeat';
	newdiv.style.zIndex=1;
	
	newdiv.style.MozOpacity='70';
	newdiv.style.opacity='0.7';
	newdiv.style.filter='alpha(opacity=70)';
	newdiv.style.overflow='auto';
	newdiv.style.display="block";
	
	//set load load in circle icon
	loadCircleImg = gURI + "images/loadingcircle.gif";
	imgTop = parseInt((parseInt(parentDivHeight)/2) - 18) + "px";
	imgLeft = parseInt((parseInt(parentDivWidth)/2) - 18) + "px";
	
	var newImg = document.createElement('img');
	newImg.setAttribute('src',loadCircleImg);
	newImg.style.position="absolute";
	newImg.style.top=imgTop;
	newImg.style.left=imgLeft;

	newdiv.appendChild(newImg);
	
	document.body.appendChild(newdiv);
}

function delay() {}