function Trim(sStr) {
	i1 = 0;
	i2 = sStr.length - 1;
	while (sStr.substr(i1, 1) == ' ') i1++;
	while (sStr.substr(i2, 1) == ' ') i2--;

	return sStr.substr(i1, i2 - i1 + 1);
}
function setCookie(name, value) {
	document.cookie = name + '=' + escape(value) + ';';
}
function getCookie(name) {
	aCookie = document.cookie.split(';');
	for (i = 0; i < aCookie.length; i++) {
		aCrumb = aCookie[i].split('=');
		aCrumb[0] = Trim(aCrumb[0]);
		if (name == aCrumb[0]) return unescape(aCrumb[1]);
	}
	return null;
}
function checkCookie() {
	var cName = 'test_sec';
	var cValue = 'test_value';
	setCookie(cName, cValue);
	var tmpV = getCookie(cName);
	if (tmpV != cValue)
		alert('Cannot use cookies, please check your security settings and allow cookies from this site.');
	else
		setCookie(cName, '');
}

function hide_newsWindow(newsId) {
	document.getElementById("newsWindow_" + newsId).style.display = "none";
}

var Global = {
	OpenWindowOnExit: function() {
		if (Global.openWindow) {
			jQuery.facebox('<iframe src="' + siteRoot + 'Exit.aspx" width="420" height="340" scrolling="no" style="overflow:hidden;"></iframe>');
			Global.openWindow = false;
			return 'Thanks for visiting VAClassroom today! We would like to invite you to watch two training videos directly from the Internet Marketing Course....Absolutely FREE! \
\
Just submit your first name and primary email address below and we will send you the videos. Thanks! \
\
';
		}
	},

	openWindow: true,

	GoTo: function(url, isFull) {
		this.openWindow = false;
		if (!isFull) {
			window.location.href = siteRoot + url;
		} else {
			window.location.href = url;
		}
	},

	HandleLinks: function() {
		/*$("a").each(function(k, v) {
		$(v).click(function() {
		Global.GoTo(v.href, true);
		return false;
		});
		});*/
	},

	Popup: function() {

	}
}

var FreeMemberPopup = {
	Show: function(pathToMessagePage) {				
				var freeMemberDiv = $("#freeMemeberMessageDiv");
				if (freeMemberDiv == null || freeMemberDiv == 'undefined' || freeMemberDiv.length == 0) {					
					var messageBox = $("<div id='freeMemeberMessageDiv'></div>");
					$(messageBox).load(pathToMessagePage);					
					$(document.body).append(messageBox);
				}
		//		$.getScript('http://localhost/vac/js/jquery-ui-1.8.5.custom(core_widget_here).min.js',
		//			function() {
		//		FreeMemberPopup.ShowPopup(); 
		//			});		
				$("#freeMemeberMessageDiv").dialog({
			autoOpen: false,
			width: 600,
			height: 500,
			resizable: false,
			modal: true
		});
		$("#freeMemeberMessageDiv").dialog('open');
	}		
}

