var bSideFilled = true;
var winPopup = null;
function NewWindow(mypage,myname,w,h,scroll) {
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	winPopup = window.open(mypage,myname,settings)
	if (winPopup.window.focus) { winPopup.window.focus() };
	if (!e) var e = window.event;
	if (e) {
	    e.cancelBubble = true;
	    if (e.stopPropagation) { e.stopPropagation(); }
	}
	return false;
}
function _ShowPopupCalendar( i_strFormName, i_strFieldName, i_blnHistory ) {
	var strURL = '/common/java/popcal.asp?FormName=' + i_strFormName + '&FieldName=' + i_strFieldName;
	if (i_blnHistory)
		strURL = strURL + '&History=on';
	else
		strURL = strURL + '&History=off';
	window.datefield = document.forms[i_strFormName][i_strFieldName]; 
	window.open( strURL + '&date=' + window.datefield.value, 'cal', 'WIDTH=295,HEIGHT=310' );
}      
function openWindow(url) {
	popupWin = window.open(url,'new_page','width=400,height=400')
}
function JumpPage() {
	document.jump.submit()
}
function trim( i_value ) {
	return i_value.replace( /^[ ]+|[ ]+$/g, '' );
}
function left(str, n) {
	if (n <= 0)
		return '';
    else if (n > String(str).length)
        return str;
    else
        return String(str).substring(0,n);
}
function GotoTopic(i_topic) {
	alert('Changing to Topic: ' + i_topic);
	self.location.href = '/forum/showThreads.aspx?TopicID=' + i_topic;
}
function GotoTopicFromPopup(i_topic) {
	window.opener.location.href = '/forum/showThreads.aspx?TopicID=' + i_topic;
	self.close();
}
function GotoForum( i_Forum ) {
	window.location.href = '/forum/forumTopics.aspx?ForumID=' + i_Forum;
}
function GotoForumFromPopup( i_Forum ) {
	window.opener.location.href = '/forum/forumTopics.aspx?ForumID=' + i_Forum;
	self.close();
}
function ResizeImage( imgObj ) {
}
function formHandler(form) {
	var URL = document.form.site.options[document.form.site.selectedIndex].value;
	window.location.href = URL;
}
function autoReload() {
	document.ReloadFrm.submit()
}
function JumpPage() {
	document.jump.submit()
}
function jumpTo(s) {
	if (s.selectedIndex != 0) top.location.href = s.options[s.selectedIndex].value;return 1;
}
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}
function fillSideSearch() {
}
function clearSideSearch() {
}
function validateSideSearch() {
	if (document.forms['SideSearch']['search'].value.length < 3) {
		alert('Minimum of 3 Characters to Search On');
		return false;
	}
	return true;
}
function wrapText(el, openTag, closeTag) {
	var ThisSelectedText = '';
	if (el.setSelectionRange) {	// W3C/Mozilla
		ThisSelectedText = el.value.substring(el.selectionStart,el.selectionEnd);
		el.value = el.value.substring(0,el.selectionStart) + openTag + ThisSelectedText + closeTag + el.value.substring(el.selectionEnd,el.value.length);
	}
	else if (document.selection && document.selection.createRange) {   // IE code goes here
		el.focus(); //or else text is added to the activating control
		var range = document.selection.createRange();
		ThisSelectedText = range.text;
		range.text = openTag + ThisSelectedText + closeTag;
	}
}
function getSelectedText(el) {
	if (el.setSelectionRange) {	// W3C/Mozilla
		return el.value.substring(el.selectionStart,el.selectionEnd);
	}
	else if (document.selection && document.selection.createRange) {   // IE code goes here
		el.focus(); //or else text is added to the activating control
		var range = document.selection.createRange();
		return range.text;
	}
}
function ShowAdvanced(obj) {
	var srchTxt = document.forms['SideSearch']['search'];
	var srchAdv = document.getElementById('AdvancedText');
	if (srchTxt && srchAdv) {
		var val = obj.options[obj.selectedIndex].value;
		srchAdv.style.display = (val == '1' || val == '10') ? '' : 'none';
	}
}
function GotoAdvanced() {
	var srchTxt = document.forms['SideSearch']['search'];
	if (srchTxt) {
		if (trim(srchTxt.value) != '') {
			window.location.href = '/forum/search_form.asp?search=' + escape(trim(srchTxt.value));
		}
		else {
			window.location.href = '/forum/search_form.asp';
		}
	}
	return false;
}