function fnPlaceData(oXml, sTarget, nType, sName) {
	var xmlDoc = oXml.XMLDocument.documentElement;
	
	if (nType == 5) {
		for (var nFields = 0; nFields < xmlDoc.childNodes.length; nFields++) {
			var oOption = new Option();
			oOption.value = xmlDoc.childNodes[nFields].childNodes[0].text;
			oOption.text = xmlDoc.childNodes[nFields].childNodes[0].text;
			document.all[sTarget].options[document.all[sTarget].options.length] = oOption;
		}
	}
	else if (nType == 4) {
		var sHTML = "";
		for (var nFields = 0; nFields < xmlDoc.childNodes.length; nFields++) {
			if (nFields > 0)
				sHTML += " &nbsp;";
			sHTML += "<nobr><input style=\"height:15px;\" type=\"checkbox\" name=\"" + sName + "\" value=\"" + xmlDoc.childNodes[nFields].childNodes[0].text + "\" id=\"fld" + nType+""+nFields + "\"><label for=\"fld" + nType+""+nFields + "\">" + xmlDoc.childNodes[nFields].childNodes[0].text + "</label></nobr>";
		}
		document.all[sTarget].innerHTML = sHTML;
	}
	else if (nType == 3) {
		var sHTML = "";
		for (var nFields = 0; nFields < xmlDoc.childNodes.length; nFields++) {
			if (nFields > 0)
				sHTML += " &nbsp;";
			sHTML += "<nobr><input style=\"height:15px;\" type=\"radio\" name=\"" + sName + "\" value=\"" + xmlDoc.childNodes[nFields].childNodes[0].text + "\" id=\"fld" + nType+""+nFields + "\"><label for=\"fld" + nType+""+nFields + "\">" + xmlDoc.childNodes[nFields].childNodes[0].text + "</label></nobr>";
		}
		document.all[sTarget].innerHTML = sHTML;
	}
}

function expand_bar(bar_Id) {
	var bar = document.getElementById("bar_"+bar_Id);
	if (bar != null) {
		bar.style.display = ("block" == bar.style.display ? "none" : "block");
		/*for (i=1;i<bar_length;i++){
			if (i!=bar_Id){
				bar = document.getElementById("bar_"+i);
				bar.style.display = 'none';
				}
		}*/
	}
}

function changeClass(obj,opr) {
	if (opr==1) {
		obj.style.font = "bold 12px";
		obj.style.color = "#ff9393";
	}
	else {
		obj.style.font = "bold 12px";
		obj.style.color = "#000000";
	}
}

function fnSetAction(oSelect) {
	var sValue = oSelect[oSelect.selectedIndex].value;
	if (sValue != "-1") {
		var saValue = sValue.split("||");
		
		if (saValue[0] == "1")
			window.open(saValue[1],"_blank");
		else
			window.location = saValue[1];
	}
	else {
		oSelect.selectedIndex = 0;
	}
	return;
}

function fnShowFullImg(sFile) {
	window.open("ViewImage.asp?Image="+sFile,"image","top=50,left=50,width="+(screen.availWidth-100)+",height="+(screen.availHeight-100)+",scrollbars");
}

function fnShowGallery(iCatID,iArticleID) {
	window.open("ViewGallery.asp?CategoryID="+iCatID+"&ArticleID="+iArticleID,"gallery","top=50,left=50,width="+(screen.availWidth-100)+",height="+(screen.availHeight-100)+",scrollbars=no");
}

function fnPlaceMailData(oXml, sTarget) {
	var xmlDoc = oXml.XMLDocument.documentElement;
	var sHTML = "";
	for (var nFields = 0; nFields < xmlDoc.childNodes.length; nFields++) {
		var oOption = new Option();
		oOption.value = xmlDoc.childNodes[nFields].childNodes[1].text;
		oOption.text = xmlDoc.childNodes[nFields].childNodes[0].text;
		try {
			document.getElementById(sTarget).options[document.getElementById(sTarget).options.length] = oOption;
		} catch (e) {
		}
	}
}

function dbsSetURL(sName) {
	window.location.hash = sName.replace("#","");
}

function dbsMail(box,server) {
	window.location = "mailto:" + box + "@" + server;
}

function fnSetQuickNavState(sCatID) {
	var selQuickNav = document.getElementById("ctlQuickNav");
	for (var i=0; i<selQuickNav.options.length; i++) {
		if (selQuickNav.options[i].id == "opt" + sCatID) {
			selQuickNav.options[i].selected = true;
			break;
		}
	}
}

function fnTalkBack(nCategoryID,nArticleID,sTitle) {
	window.open("_TalkBack/AddResponse.asp?CategoryID=" + nCategoryID + "&ArticleID=" + nArticleID + "&Title=" + sTitle,"talkback","top=60,left=30,width=400,height=436")
}

function fnTellFriend(sURL,sCategoryID) {
	window.open("TellFriendPopUp.asp?CategoryID="+sCategoryID+"&URL="+escape(sURL),"tellfriend","top=60,left=30,width=400,height=412")
}

function fnOpenWin(sURL,nWidth,nHeight) {
	window.open(sURL,"tellfriend","top="+((window.screen.height-nHeight)/2)+",left="+((window.screen.width-nWidth)/2)+",width="+nWidth+",height="+nHeight+",scrollbars")
}

function dbsGetContent(sModule,vParam,sPg,sCategoryID,sArticleID) {
	try {
		var xmlHTTP;
		// code for Mozilla, etc.
		if (window.XMLHttpRequest) {
			xmlHTTP = new XMLHttpRequest();
			xmlHTTP.open("GET","_modules/XML/"+sModule+".asp?pg="+sPg+"&CategoryID="+sCategoryID+"&Param="+vParam+"&ArticleID="+sArticleID+"&DMode=1", false);
			xmlHTTP.send(null);
			document.write(xmlHTTP.responseXML.documentElement.textContent);
		}
		// code for IE
		else if (window.ActiveXObject) {
			xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
			xmlHTTP.open("GET","_modules/XML/"+sModule+".asp?pg="+sPg+"&CategoryID="+sCategoryID+"&Param="+vParam+"&ArticleID="+sArticleID+"&DMode=1", false);
			xmlHTTP.send();
			document.write(xmlHTTP.responseXML.documentElement.text);
		}		
	}
	 catch (e) {
	}
}

/******************************** Horizontal Navigation Functions *********************************/
var interval, oCurrentDiv;
function fnShowNodes(td, ID) {
	var oDiv = document.getElementById("Sub_"+ID);
	if (oDiv != null) {
		oDiv.style.visibility = "visible";
		oDiv.style.top = td.offsetHeight + td.offsetTop - oDiv.offsetParent.offsetTop;
		// RTL
		oDiv.style.left = td.offsetLeft - (oDiv.offsetWidth-td.offsetWidth) - oDiv.offsetParent.offsetLeft;
		//LTR
		//oDiv.style.left = td.offsetLeft - oDiv.offsetParent.offsetLeft;
	}
}

function fnHideNodes(ID) {
	var oDiv = document.getElementById("Sub_"+ID);
	if (oDiv != null) {
		oDiv.style.visibility = "hidden";
	}
}


/******************************** Fixing Flash Problemi in IE *********************************/
// Universal event handler
// Please don't use "onload = functionName" etc
// use instead this "addEvent(window, 'load', functionName);"
function addEvent(obj, strEvent, objFunction)
{ 
	if (obj.addEventListener)
	{ 
		obj.addEventListener(strEvent, objFunction, true); 
		return true; 
	}
	else if (obj.attachEvent)
	{ 
		var returnValue = obj.attachEvent("on"+strEvent, objFunction); 
		return returnValue; 
	} 
	else return false; 
}

// be careful: this script erases the "FlashVars" content, 
// you can send vars in the file name after "?" like in asp
function startObjects()
{
	objects = document.getElementsByTagName("OBJECT");
	for (var i = 0; i < objects.length; i++)
	{
		objects[i].outerHTML = objects[i].outerHTML;
	}
}

if (navigator.appName == "Microsoft Internet Explorer") addEvent(window, 'load', startObjects);


