function fnPlaceData(url,nType,sName) {
	try {
		var xmlHTTP = fnHTTPGetRequest(url);
		if (xmlHTTP != null) {
			var xmlDoc = xmlHTTP.responseXML.documentElement;
			var sHTML = ""
			for (var nFields = 0; nFields < xmlDoc.childNodes.length; nFields++) {
				if (nType == 5) {
					if (window.XMLHttpRequest)
						sHTML += "<option value=\""+xmlDoc.childNodes[nFields].childNodes[0].textContent+"\">"+xmlDoc.childNodes[nFields].childNodes[0].textContent+"</option>";
					else
						sHTML += "<option value=\""+xmlDoc.childNodes[nFields].childNodes[0].text+"\">"+xmlDoc.childNodes[nFields].childNodes[0].text+"</option>"
				}
				else if (nType == 4) {
					if (nFields > 0)
						sHTML += " &nbsp;";
					if (window.XMLHttpRequest)
						sHTML += "<nobr><input style=\"height:15px;\" type=\"checkbox\" name=\"" + sName + "\" value=\"" + xmlDoc.childNodes[nFields].childNodes[0].textContent + "\" id=\"fld" + nType+""+nFields + "\"><label for=\"fld" + nType+""+nFields + "\">" + xmlDoc.childNodes[nFields].childNodes[0].textContent + "</label></nobr>";
					else
						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>";
				}
				else if (nType == 3) {
					if (nFields > 0)
						sHTML += " &nbsp;";
					if (window.XMLHttpRequest)
						sHTML += "<nobr><input style=\"height:15px;\" type=\"radio\" name=\"" + sName + "\" value=\"" + xmlDoc.childNodes[nFields].childNodes[0].textContent + "\" id=\"fld" + nType+""+nFields + "\"><label for=\"fld" + nType+""+nFields + "\">" + xmlDoc.childNodes[nFields].childNodes[0].textContent + "</label></nobr>";
					else
						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.write(sHTML);
		}
	} catch (e) {
	}
}

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 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) {
	}
}

function fnHTTPGetRequest(sURL) {
	try {
		var xmlHTTP;
		// code for Mozilla, etc.
		if (window.XMLHttpRequest) {
			xmlHTTP = new XMLHttpRequest();
			xmlHTTP.open("GET",sURL, false);
			xmlHTTP.send(null);
			return xmlHTTP;
		}
		// code for IE
		else if (window.ActiveXObject) {
			xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
			xmlHTTP.open("GET",sURL, false);
			xmlHTTP.send();
			return xmlHTTP;
		}		
	}
	 catch (e) {
	 	return null;
	}
}

/******************************** Horizontal Navigation Functions *********************************/
var interval, oCurrentDiv;
function fnShowNodes(td, ID, sDir) {
	var oDiv = document.getElementById("Sub_"+ID);
	if (oDiv != null) {
		oDiv.style.visibility = "visible";
		oDiv.style.top = td.offsetHeight + td.offsetTop - oDiv.offsetParent.offsetTop + "px";
		if (sDir == "rtl")
			oDiv.style.left = td.offsetLeft - (oDiv.offsetWidth-td.offsetWidth) - oDiv.offsetParent.offsetLeft + "px";
		else
			oDiv.style.left = td.offsetLeft - oDiv.offsetParent.offsetLeft + "px";
	}
}

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++)
	{
		if (objects[i].classid.toUpperCase() == "CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000")
			objects[i].outerHTML = objects[i].outerHTML;
	}
}


/******************************** Content Rating *********************************/

function fncRate(nItemID,nCategoryID,nRating,nAverage) {
	var xmlHTTP = fnHTTPGetRequest("_TalkBack/RateContent.asp?ItemID=" + nItemID + "&ItemCategoryID=" + nCategoryID + "&Rating=" + nRating)
	if (xmlHTTP != null) {
		var sResult;
		if (window.XMLHttpRequest)
			sResult = xmlHTTP.responseXML.documentElement.textContent;
		else
			sResult = xmlHTTP.responseXML.documentElement.text;

		if (!isNaN(sResult)) {
			nAverage = parseInt(sResult);
			if (nAverage != 0) {
				var sStars = "";
				for (var nStars=1; nStars<=5; nStars++) {
					var ctlRating = document.getElementById("ctlRating_"+nItemID+"_"+nStars);
					if (ctlRating != null) {
						var sHTML;
						if (nStars <= nAverage)
							sHTML = "<img src=\"_Pics/RatingFullStar.gif\" border=\"0\" alt=\" " + nStars + " \">";
						else
							sHTML = "<img src=\"_Pics/RatingStar.gif\" border=\"0\" alt=\" " + nStars + " \">";

						ctlRating.innerHTML = sHTML;
					}
				}
				var ctlRatingsCount = document.getElementById("ctlRatingsCount_"+nItemID);
				if (ctlRatingsCount != null) {
					var sText = ctlRatingsCount.innerText;
					if (isNaN(sText))
						ctlRatingsCount.innerText = "1";
					else
						ctlRatingsCount.innerText = parseInt(ctlRatingsCount.innerText)+1;
				}
				document.getElementById("ctlRatingsPannelContainer_"+nItemID).onmouseout = null;
				document.getElementById("ctlRatingTitle_"+nItemID).innerHTML = sRatingMsg;
			}
		}
		else
			fnSetFullStars(nItemID,nAverage);
	}
}

function fnSetFullStars(nItemID, nRatingCount) {
	for (var nStars=1; nStars<=5; nStars++) {
		var oImg = document.getElementById("imgRate_"+nItemID+"_"+nStars);
		if (oImg != null) {
			if (nStars <= nRatingCount) {
				oImg.src = "_Pics/RatingFullStar.gif";
			}
			else {
				oImg.src = "_Pics/RatingStar.gif";
			}	
		}
	}
}

function fnSetStars(nItemID,nAverage) {
	for (var nStars=1; nStars<=5; nStars++) {
		var oImg = document.getElementById("imgRate_"+nItemID+"_"+nStars);
		if (oImg != null) {
			if (nStars <= nAverage) {
				oImg.src = "_Pics/RatingFullStar.gif";
			}
			else {
				oImg.src = "_Pics/RatingStar.gif";
			}				
		}
	}
}

// Cache Ratings images
var dbsRatingStar = new Image();
	dbsRatingStar.src ="_Pics/RatingStar.gif";
var dbsRatingFullStar = new Image();
	dbsRatingFullStar.src ="_Pics/FullRatingStar.gif";




