// FAQ Single List begins... //
var popupMOM;
function showPopup(e, elemID, txtWhen, txtWhere) 
{
	if (txtWhen=='') 
		txtWhen = 'All Day';
	popupMOM = document.createElement('div');
	popupMOM.className = 'tooltip';
	//popupMOM.style.cssText = 'position: absolute; border: 2px groove #b3b3b3; left: 0px; top: 0px; padding: 2px;';
	if ( txtWhen.length > 0 )
		popupMOM.innerHTML = '<span class="when">When: </span>' + txtWhen + '<br />';
		
	if ( txtWhere.length > 0 )
		popupMOM.innerHTML += '<span class="where">Where: </span>' + txtWhere;
		
	document.body.appendChild(popupMOM);
	positionPopup(e, elemID);
}	

function positionPopup(e, elemID) 
{
	var docb = document.body;
	if (popupMOM == null) return;

	var newLeft = ((e.clientX + docb.scrollLeft) + 4);
	var newTop = ((e.clientY + docb.scrollTop) + 4);
	
	if (newLeft + popupMOM.offsetWidth > (docb.clientWidth+docb.scrollLeft)) 
	{
		var newerLeft = ((e.clientX + docb.scrollLeft) - 4) - popupMOM.offsetWidth;
		if (newerLeft > 0) newLeft = newerLeft;
	}
	
	if (newTop + popupMOM.offsetHeight > (docb.clientHeight + docb.scrollTop)) 
	{
		var newerTop = ((e.clientY + docb.scrollTop) - 4) - popupMOM.offsetHeight;
		if (newerTop > 0) newTop = newerTop;
	}
	
	var popStyle = popupMOM.style;
	popStyle.left = newLeft + 'px';
	popStyle.top = newTop + 'px';
}	

function hidePopup() 
{
	if (popupMOM == null) return;
	document.body.removeChild(popupMOM);
	popupMOM = null;
}

function ToggleElement(elementId)
{
	element = document.getElementById(elementId);
	if ( element != null )
		element.style.display = (element.style.display == "none" ? "block" : "none");
}

// ...Ends FAQ Single List //

(function ($) {
	$.queryString = (function (a) {
		if (a == "") return {};
		var b = {};
		for (var i = 0; i < a.length; ++i) {
			var p = a[i].split('=');
			if (p.length != 2) continue;
			b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
		}
		return b;
	})(window.location.search.substr(1).split('&'))
})(jQuery);

function redirectToUrl(url, target, id) {
	var objWin = window;
	if (target == "_blank") {
		objWin = window.open(url, id);
		return;
	}
	else if (target == "_parent") {
		if (window.parent != null) {
			objWin = window.parent;
		}
	}
	else if (target == "_top") {
		if (window.top != null) {
			objWin = window.top;
		}
	}
	if (objWin != null) {
		objWin.location = url;
		objWin.focus();
	}
}

$(document).ready(function () {

	/* Search */
	$(".defaultText").focus(function (srcc) {
		if ($(this).val() == $(this)[0].title) {
			$(this).removeClass("defaultTextActive");
			$(this).val("");
		}
	});
	$(".defaultText").blur(function () {
		if ($(this).val() == "") {
			$(this).addClass("defaultTextActive");
			$(this).val($(this)[0].title);
		}
	});
	$(".defaultText").blur();

	$('input#q').live("keydown", function (e) {
		/* ENTER PRESSED*/
		if (e.which == 13) {
			window.location = $(".searchbox_anchor").attr("href");
			return false;
		}
	});

	$("input#q").live("keyup", function (e) {
		var qev = $(this).val();
		var qe = encodeURIComponent(qev);

		$(".searchbox_anchor.google").attr("href", "gcsearch.aspx?q=" + encodeURIComponent(qe));
		$(".searchbox_anchor.isys").attr("href", "search.aspx?request=" + encodeURIComponent(qe) + "&maxFiles=" + $("input#hdnMaxFiles").val());
	});

	$("input#q").val($.queryString["q"] != null ? decodeURIComponent($.queryString["q"]) : $("input#q").attr("title"));

});


