//Function to jump to another forum
function ForumJump(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

//Function to open pop up window
function openWin(theURL,winName,features) {
//  	window.open(theURL,winName,features);
	// Call Sophco popup which automatically closes with parent.
	showPopupWindow(theURL, winName, features);
}

//Function to open preview post window
function OpenPreviewWindow(targetPage, formName){
	
	now = new Date  
	
	//Open the window first 	
   	openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')
   		
   	//Now submit form to the new window
   	formName.action = targetPage + "?ID=" + now.getTime();	
	formName.target = "preview";
	formName.submit();
}

//******************************************************************************//
//							 Sophco Additions									//
//******************************************************************************//
function getElement(id)
{
	var e = null;
	if(e = document.getElementById(id))
		return e;
	e = document.getElementsByName(id);
	return (e.length == 1 ? e[0] : null);
}

function closeWin()
{
	// Close any windows opened by opeWin (ie by Sophco routine, showPopupWindow)
	closeChildPopup();
}

function encodeURL(urlParm)
{
	var encodedParm = '';
	for(var i = 0; i < urlParm.length; ++i)
	{
		var c = urlParm.charAt(i);
		if(c == '?')
			c = '%3F';
		else if(c == '&')
			c = '%26';
		else if(c == ' ')
			c = '%20%';
		encodedParm += c;
	}
	return encodedParm;
}


// Return true if we are an embedded (i)frame in a foreign site
function isForeignParent()
{
	return(top != self);
}

function isPopup()
{
	return(self.opener && !isForeignOpener());
}

// Are "header" elements (header block, menus, ads) enabled?
function isHeaderEnabled()
{
	// Headers disabled in popups and pages embedded in foreign sites.
	return(!isPopup() && !isForeignParent());
}
function isFooterEnabled()
{
	// Headers disabled in popups and pages embedded in foreign sites.
	return(isHeaderEnabled());
}
