var tgAlertTitle = "Priceline Travel Guide";
var tgPopUpBlockerMsg = "Your pop-up blocker seems to be enabled.\nPlease turn-off your pop-up blocker to view this information.";

function tgPopOpen (url, winName, width, height, scroll) {
	var left, top;
	left = (screen.availWidth-width)/2;
	top = (screen.availHeight-height)/2;
	if (scroll == null) scroll = "no";
	var oWnd = window.open(url, winName, 'menubar=no,location=no,directories=no,scrollbars=' + scroll + ',resizable=no,status=no,toolbar=no,'
				+ 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
	if (oWnd != null) 
		oWnd.focus();
	else 
		alert (tgPopUpBlockerMsg, tgAlertTitle);
}
function ratingPopup (attType) {
	var url = "/travelguides/jsp/popupRatings.jsp?attType=" + attType;
	tgPopOpen (url, 'tgZagatRating', 520, 600, 'yes');
}

var xmlHttp
function GetXmlHttpObject(){ 
	var objXMLHttp = null;
	if(window.XMLHttpRequest){
		objXMLHttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject){
		objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}

var tgMaxSubCatId=-1;
function tgTreeReset (selId, maxId) {
	if (!document.getElementById && !document.all) return;
	if (maxId != null && maxId > -1) tgMaxSubCatId = maxId;
	else maxId = tgMaxSubCatId;
	
	var oHead;
	for (var id=0; id<=maxId; ++id) {
		oHead = getElemById('subCatHead' + id);
		if (selId == id && oHead.className == 'menuheader') {
			oHead.className = 'menuheader openheader';
			showObject ('subCatBody' + id);
		} else if (oHead.className != 'onlyheader') {
			oHead.className = 'menuheader';
			hideObject ('subCatBody' + id);
		}
	}
}
function tgToggleMoreText (oAnc) {
	if (oAnc.innerHTML == 'close') {
		oAnc.previousSibling.previousSibling.className = 'hid';
		oAnc.innerHTML = 'read more';
	} else {
		oAnc.previousSibling.previousSibling.className = 'visNoBr';
		oAnc.innerHTML = 'close';
	}
}
function switchTGTab (groupName, iDx, lastIdx, imageVersionMenu) {
	var menu, data;
	for (var i=0; i<lastIdx; ++i) {
		menu = getElemById ("tg" + groupName + "Menu" + i);
		data = getStyleObject ("tg" + groupName + "Data" + i);

		if (i == iDx) {
			if (imageVersionMenu) {
				showObject ("tg" + groupName + "Menu" + i + "On");
				hideObject ("tg" + groupName + "Menu" + i + "Off");
			} else
				menu.className	= "current";
			showObject ("tg" + groupName + "Data" + i);
		} else {
			if (imageVersionMenu) {
				hideObject ("tg" + groupName + "Menu" + i + "On");
				showObject ("tg" + groupName + "Menu" + i + "Off");
			} else
				menu.className	= "";
			hideObject ("tg" + groupName + "Data" + i);
		}
	}
}
