<!--
/*======================================================================/*
// InstantForum.NET	© 2005 InstantASP Limited.							//
// http://www.instantasp.co.uk/											//
\*======================================================================*/

/* ----------------------------------------------------------- */
// Pre-load drop down menu images so they display correctly					   
/* ----------------------------------------------------------- */

function if_PreloadImages(CurrentSkin) {

	if (document.images)
	{
		arImageList = new Array ();
		var arImageSrc = new Array(CurrentSkin + "Images/Misc_Rating1.gif",
		CurrentSkin + "Images/Misc_Rating2.gif",
		CurrentSkin + "Images/Misc_Rating3.gif",
		CurrentSkin + "Images/Misc_Rating4.gif",
		CurrentSkin + "Images/Misc_Rating5.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Bold.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Bullets.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Center.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Fontcolor.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_FontcolorPrompt.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Grab.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Highlight.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_HighlightPrompt.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Indent.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_InsertImg.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Italics.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Justify.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Left.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Link.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_NumList.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Quote.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Right.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Sep.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Strike.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Subscript.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Superscript.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Toolsep.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Underline.gif",
		CurrentSkin + "Images/RichTextBoxIcons/mnu_Unindent.gif",
		CurrentSkin + "Images/RichTextBoxIcons/tab_Edit_Off.gif",
		CurrentSkin + "Images/RichTextBoxIcons/tab_Edit_On.gif",
		CurrentSkin + "Images/RichTextBoxIcons/tab_Html_Off.gif",
		CurrentSkin + "Images/RichTextBoxIcons/tab_Html_On.gif");
		for (counter in arImageSrc) {
			arImageList[counter] = new Image();
			arImageList[counter].src = arImageSrc[counter];
		}
	}    
}

/* ----------------------------------------------------------- */
// This funtion expands and collapses a group of panel bars
/* ----------------------------------------------------------- */

function if_ExpandPanelBars(objName, bolState, strSkin) {

	if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera || InstantASP_NS6)	{
	
		// toggle all table rows matching object name
		tr = document.getElementsByTagName("tr");
		for (var i = 0; i < tr.length; i++)
		{ 
			if (tr[i].id.indexOf(objName) >= 0) {
				if (bolState) 
					{tr[i].style.display = "";}
					else
					{tr[i].style.display = "none";}
			}
		
		}
		
		// toggle all tables matching object name
		table = document.getElementsByTagName("table");
		for (var i = 0; i < table.length; i++)
		{ 
			if (table[i].id.indexOf(objName) >= 0) {
				if (bolState) 
					{table[i].style.display = "";}
					else
					{table[i].style.display = "none";}
			}
		
		}
		
		// change all images matching object name
		input = document.getElementsByTagName("img");
		for (var i = 0; i < input.length; i++)
		{ 
			if (input[i].id.indexOf(objName) >= 0) {
				if (bolState) 
					{input[i].src = strSkin + "Images/Misc_Collapse.gif";}
					else
					{input[i].src = strSkin + "Images/Misc_Expand.gif";}
			}
		}
	}
}

/* ----------------------------------------------------------- */
// Inserts IFCode into the target textbox control
/* ----------------------------------------------------------- */

function if_InsertIFCode(startTag, middleTag, endTag, objTextBox) {

	if (InstantASP_NS4)	{
	
		objTextBox.value += startTag + middleTag + endTag;
		
	} else if (InstantASP_Opera || InstantASP_Opera8) {
	
		if (InstantASP_Opera8) {
		
			objTextBox.focus();	var txt;
			var s = objTextBox.document.selection;
			if (s.type == "Text" || s.type == "None")	{
				var r = s.createRange(); r.colapse; 
				if (r.text.length > 0) {txt = startTag + r.text + endTag;}
				else {txt = startTag + middleTag + endTag;}
				r.text = txt;
				r.moveEnd("character", - (endTag.length));
				r.select();
			} else {alert(if_WYSIWYGPrompt);}
		}
		
		else {objTextBox.value += startTag + middleTag + endTag;}
	
	} else if (InstantASP_IE4 || InstantASP_IE5) {
	
		var s; objTextBox.focus();
		if (objTextBox.type != null) // we are working with the textarea
			{s = objTextBox.document.selection;}
			else // we are working with the iframe
			{objTextBox.focus(); 
			s = objTextBox.document.selection;}
		if (s.type == "Text" || s.type == "None")	{
			var txt; var r = s.createRange(); r.colapse;
			if (r.text.length > 0) 
				{txt = startTag + r.text + endTag;}
			else 
				{txt = startTag + middleTag + endTag;}
			if (r.parentElement().isMultiLine && r.parentElement().isContentEditable || objTextBox.type == "textarea") {	
				r.text = txt;
				r.moveEnd("character", - (endTag.length));
				r.select();
			}
		} else {alert(if_WYSIWYGPrompt);}
				        
	} else if (InstantASP_NS6) {
	
		if (objTextBox.selectionEnd) {
		
			var charPos; var charMiddle;
			var selStart = objTextBox.selectionStart;
			var selEnd = objTextBox.selectionEnd; if (selEnd <= 2) {selEnd = objTextBox.textLength;}
			var charStart = objTextBox.value.substring(0, selStart);
			var charEnd = objTextBox.value.substring(selEnd, objTextBox.textLength);
			
			// do we have a selection
			if (selStart != selEnd) {
				charMiddle = objTextBox.value.substring(selStart, selEnd);
				objTextBox.value = charStart + startTag + charMiddle + endTag + charEnd;
				charPos = selStart + (startTag.length + charMiddle.length);} 
			else {
				objTextBox.value = charStart + startTag + middleTag + endTag + charEnd;
				charPos = selStart + (startTag.length + middleTag.length);
			}
		
			objTextBox.selectionStart = charPos;
			objTextBox.selectionEnd = charPos;
			
	} else {
			objTextBox.value += startTag + middleTag + endTag;
			objTextBox.selectionStart = (startTag.length + middleTag.length);
			objTextBox.selectionEnd = (startTag.length + middleTag.length);
		}
		
	} 
	
	objTextBox.focus();
	
}

/* ----------------------------------------------------------- */
// This function handles a selectedIndex changed events for the 
// forum jump drop down list
/* ----------------------------------------------------------- */

function if_ForumJump(location) {

	// ensure we have a URL
	if (location != "" && location != null)
	{window.location = location;}

}

/* ----------------------------------------------------------- */
// Forum logout confirmation alert
/* ----------------------------------------------------------- */

function if_logOut() {

	if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera || InstantASP_NS6)	{
		ht = document.getElementsByTagName("body");
		ht[0].style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=55)";
		if (confirm(if_strLogoutAlertText)) {return true;}
		else {ht[0].style.filter = ""; return false;}
	}
	else {
		if (confirm(if_strLogoutAlertText)) {return true;}
		else {return false;}
	}
	
}

/* ----------------------------------------------------------- */
// EmotIcons Functions
/* ----------------------------------------------------------- */

function if_InsertEmotIconPopup(uri, ControlID) {
	InstantASP_OpenWindow(uri+"?ControlID="+ControlID,250,500,1,0,0,0,0,1,false);
}

/* ----------------------------------------------------------- */
// Insert IFCode from Model Dialog Window
/* ----------------------------------------------------------- */

function if_InsertIFCodePopup(uri, ControlID) {
	InstantASP_OpenWindow(uri+"?ControlID="+ControlID,535,500,1,0,0,0,0,1,false);
}

/* ----------------------------------------------------------- */
// Attachment Functions
/* ----------------------------------------------------------- */

function if_EditAttachments(uri) {				
	InstantASP_OpenWindow(uri,525,375,1,0,0,0,0,1,false);
}

/* ----------------------------------------------------------- */
// User Detail Functions
/* ----------------------------------------------------------- */

function if_UserDetail(uri) {				
	InstantASP_OpenWindow(uri,525,375,1,0,0,0,0,1,false);
}

/* ----------------------------------------------------------- */
// Attachment Functions
/* ----------------------------------------------------------- */

function if_PrintTopic(uri) {	
	var WinNum = 1;
	window.open(uri,WinNum++);
}


/* ----------------------------------------------------------- */
// Prompt to grab direct link to post
/* ----------------------------------------------------------- */

function if_PostLink(uri) {
	var link = InstantASP_RemoveQueryString(uri);
	var linkDialog = prompt(if_linkPrompt,link); 
}

/* ----------------------------------------------------------- */
// Prompt displayed with unread private messages
/* ----------------------------------------------------------- */

function if_UnreadPrivateMessagePrompt(uri) {
	if (confirm(if_UnreadPrivateMessages))
	{location = uri;} else {return false;}
}

//-->


