
function pageLoad(){
	if (navigator.appName == 'Microsoft Internet Explorer'){
		var yBody = (document.all) ? document.documentElement.scrollHeight: e.pageY;
		document.getElementById("mainBody").style.height = yBody+"px";
		//document.getElementById("mainBody").style.height = "1600px";
		}
	else {
		//var yBody = document.documentElement.clientHeight;
		var yBody = window.outerHeight + 400;
		document.getElementById("mainBody").style.height = yBody+"px";
		//document.getElementById("mainBody").style.height = "1600px";
	}
	//alert(document.body.clientHeight+" / " + document.body.offsetHeight);
}

	
function bgMouseOver(elem) {
	elem.style.backgroundColor="#c9b6a1";
	elem.style.color="#bf1e2d";
}
function bgMouseOut(elem) {
	elem.style.backgroundColor="";
}
	 
function currentPage(str) {
	var curElem = document.getElementById("menu"+str);
	curElem.style.backgroundColor="#bf1e2d";
	curElem.style.color="#c9b6a1";
}

function loadingDiv() {
	var ld=(document.all);
	var ns4=document.layers;
	var ns6=document.getElementById&&!document.all;
	var ie4=document.all;
	if (ns4)
		ld=document.loading;
	else if (ns6)
		ld=document.getElementById("loading").style;
	else if (ie4)
		ld=document.all.loading.style;
}
	 
function init() {
	 if(ns4){ld.visibility="hidden";}
	 else if (ns6||ie4) ld.display="none";
}

 
function scrollmarquee(){
	if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
	cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
	else
	cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
	cross_marquee=document.getElementById("vmarquee")
	cross_marquee.style.top=0
	marqueeheight=document.getElementById("marqueecontainer").offsetHeight
	actualheight=cross_marquee.offsetHeight
	if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
	cross_marquee.style.height=marqueeheight+"px"
	cross_marquee.style.overflow="scroll"
	return
	}
	setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}





// Main function to retrieve mouse x-y pos.s
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
	var IE = document.all?true:false;

// If NS -- that is, !IE -- then set up for mouse capture
	if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
	document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
	var tempX = 0;
	var tempY = 0;

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    var tempX = event.clientX + document.body.scrollLeft;
    var tempY = event.clientY + document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    var tempX = e.pageX;
    var tempY = e.pageY;
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
	document.yPos.yValue.value = tempY;
	document.yPos.xValue.value = tempX;
  return true;
}

function moveDataDisplay() {
	var elem = document.getElementById("calDataDiv");
	var newX = document.yPos.xValue.value;
	var newY = document.yPos.yValue.value;
	if (newX > 700) {
		newX = newX -400;
		}
	elem.style.top = newY -350 + "px";
	elem.style.left = newX + "px";
}
function getCalData(id,dt) {
	// If it is not IE, we assume that the browser is NS.
	var IE = document.all?true:false

	// If NS -- that is, !IE -- then set up for mouse capture
	if (!IE) document.captureEvents(Event.MOUSEMOVE)

	var elem = document.getElementById("calDataDiv");
	var stat = elem.style.visibility;
	moveDataDisplay();
	elem.style.visibility = "visible";
	elem.style.zIndex = "100";
			
	if (window.XMLHttpRequest)
		{
		xmlHttp=new XMLHttpRequest();
		}
	else // for older IE 5/6
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	
	var url="calendar-data.asp?id="+id+"&dt="+dt;
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	
	document.getElementById("calData").innerHTML=xmlHttp.responseText;	
	}


function hideCalData() {
	var elem = document.getElementById("calDataDiv");
	elem.style.top = "0px";
	elem.style.left = "0px";
	elem.style.visibility = "hidden";
	elem.style.zIndex = "-1000";
}



function fileDelete(fn,t) {
if (window.XMLHttpRequest)
		{
		xmlHttp=new XMLHttpRequest();
		}
	else // for older IE 5/6
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	
	var url="inc-adminFunctions.asp?func=delFile&fn="+fn+"&tg="+t;
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	
	window.location="admin-media.asp?grp="+t;
}

function deleteConfirm(fn,t)
{
	var ind = fn.indexOf("media")+6;
	var str = fn.substring(ind)
	var where_to= confirm("Are You Sure You Wish To Delete ?? \n \n" + str);
	if (where_to== true)
	{
		fileDelete(fn,t);
	}
	else
	{
		window.location="admin-media.asp?grp="+t;
	 }
}



function validateForm() {
	var tag = 0;
	var x=document.forms["contactForm"]["fullName"].value;
	if (x==null || x=="")
	{
		document.forms["contactForm"]["fullName"].focus
		var msg = "Please Enter Your Name !!!";
		alert(msg);
		return false;
	}
	else if (document.forms["contactForm"]["email"].value==null || document.forms["contactForm"]["email"].value=="")
	{
		var msg = "Please Enter An Email Address !!!";
		alert(msg);
		return false;
	}
	else if (document.forms["contactForm"]["comments"].value==null || document.forms["contactForm"]["comments"].value=="")
	{
		var msg = "Please Enter A Reason For Contact !!!";
		alert(msg);
		return false;
	}	
}

function validateForm2() {
	var tag = 0;
	var x=document.forms["contactForm"]["lastName"].value;
	if (x==null || x=="")
	{
		document.forms["contactForm"]["lastName"].focus
		var msg = "Please Enter A Last Name !!!";
		alert(msg);
		return false;
	}
}	


// ############################################# CONTENT EDITTING CODES ###############################

helpstat = false;
stprompt = false;
basic = true;

function thelp(swtch){
	if (swtch == 1){
		basic = false;
		stprompt = false;
		helpstat = true;
	} else if (swtch == 0) {
		helpstat = false;
		stprompt = false;
		basic = true;
	} else if (swtch == 2) {
		helpstat = false;
		basic = false;
		stprompt = true;
	}
}


function AddText(text) {
	var tarea = document.contentForm.contentData;
	
	if (typeof tarea.selectionStart != 'undefined'){ // if it supports DOM2
		start = tarea.selectionStart;
		end = tarea.selectionEnd;
		tarea.value = tarea.value.substr(0,tarea.selectionStart)
			+ text + tarea.value.substr(tarea.selectionEnd);
		tarea.focus();
		tarea.selectionStart = ((start - end) == 0) ? start + text.length : start;
		tarea.selectionEnd = start + text.length;
	} else {
		if (tarea.createTextRange && tarea.caretPos) {
			var caretPos = tarea.caretPos;
			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?   text + ' ' : text;
		}
		else {
			tarea.value += text;
		}
		tarea.focus(caretPos);
	}
}


function getText() {
	var tarea = document.contentForm.contentData;
	
	if (tarea.createTextRange && tarea.caretPos) {
		return tarea.caretPos.text;
	} else if (typeof tarea.selectionStart != 'undefined'){
		return tarea.value.substr(tarea.selectionStart,((tarea.selectionEnd-1)-tarea.selectionStart))
	}
	return '';
}

function storeCaret(ftext) {
	if (ftext.createTextRange) {
		ftext.caretPos = document.selection.createRange().duplicate();
	}
}


function bold() {
	var text = getText();
	
	if (helpstat) {
		alert("Bold Tag Makes the enclosed text bold.\n\nUSE: [b]This is some bold text[/b]");
	} else if (basic) {
		AddTxt="[b]" + text + "[/b]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be made BOLD.",text);
		} else {
			txt=prompt("Text to be made BOLD.","Text");
		}
		if (txt!=null) {
			AddTxt="[b]"+txt+"[/b]";
			AddText(AddTxt);
		}
	}
}

function italicize() {
	var text = getText();
	if (helpstat) {
		alert("Italicize Tag Makes the enclosed text italicized.\n\nUSE: [i]This is some italicized text[/i]");
	} else if (basic) {
		AddTxt="[i]" + text + "[/i]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be italicized",text);
		} else {
			txt=prompt("Text to be italicized","Text");
		}
		if (txt!=null) {
			AddTxt="[i]"+txt+"[/i]";
			AddText(AddTxt);
		}
	}
}

function underline() {
	var text = getText();
  	if (helpstat) {
		alert("Underline Tag Underlines the enclosed text.\n\nUSE: [u]This text is underlined[/u]");
	} else if (basic) {
		AddTxt="[u]" + text + "[/u]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be Underlined.",text);
		} else {
			txt=prompt("Text to be Underlined.","Text");
		}
		if (txt!=null) {
			AddTxt="[u]"+txt+"[/u]";
			AddText(AddTxt);
		}
	}
}

function strike() {
	var text = getText();
	if (helpstat) {
		alert("Strike-Through Tag Makes the enclosed text have a line through it.\n\nUSE: [s]This is some stricken text[/s]");
	} else if (basic) {
		AddTxt="[s]" + text + "[/s]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be stricken.",text);
		} else {
			txt=prompt("Text to be stricken.","Text");
		}
		if (txt!=null) {
			AddTxt="[s]"+txt+"[/s]";
			AddText(AddTxt);
		}
	}
}

function left() {
	var text = getText();
 	if (helpstat) {
		alert("Left tag aligns the enclosed text to the left.\n\nUSE: [left]This text is aligned left[/left]");
	} else if (basic) {
		AddTxt="[left]" + text + "[/left]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be aligned left",text);
		} else {
			txt=prompt("Text to be aligned left","Text");
		}
		if (txt!=null) {
			AddTxt="[left]"+txt+"[/left]";
			AddText(AddTxt);
		}
	}
}

function center() {
	var text = getText();
 	if (helpstat) {
		alert("Centered tag Centers the enclosed text.\n\nUSE: [center]This text is centered[/center]");
	} else if (basic) {
		AddTxt="[center]" + text + "[/center]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be centered",text);
		} else {
			txt=prompt("Text to be centered","Text");
		}
		if (txt!=null) {
			AddTxt="[center]"+txt+"[/center]";
			AddText(AddTxt);
		}
	}
}

function right() {
	var text = getText();
 	if (helpstat) {
		alert("Right tag aligns the enclosed text to the right.\n\nUSE: [right]This text is aligned right[/right]");
	} else if (basic) {
		AddTxt="[right]" + text + "[/right]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be aligned right",text);
		} else {
			txt=prompt("Text to be aligned right","Text");
		}
		if (txt!=null) {
			AddTxt="[right]"+txt+"[/right]";
			AddText(AddTxt);
		}
	}
}

function hr() {
	var text = getText();
	if (helpstat) {
		alert("Horizontal Rule creates a horizontal line across your post.\n\nUSE: [hr]");
	} else {
		AddTxt="[hr]" + text;
		AddText(AddTxt);
	}
}

function hyperlink() {
	var text = getText();
	alert("Format: [url=http://www.anywhere.com]link text[/url]");
	if (helpstat) {
		alert("Format: [url=http://www.anywhere.com]link text[/url]");
	} else if (basic) {
		AddTxt="[url=]" + text + "[/url]";
		AddText(AddTxt);
	} else {
		if (text!="") {
			txt2=text;
		} else {
			txt2=prompt("Text to be shown for the link.\nLeave blank if you want the url to be shown for the link.","");
		}
		if (txt2!=null) {
			txt=prompt("URL for the link.","http://");
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[url=]"+txt+"[/url]";
					AddText(AddTxt);
				} else {
					AddTxt="[url=\""+txt+"\"]"+txt2+"[/url]";
					AddText(AddTxt);
				}
			}
		}
	}
}

function email() {
	if (helpstat) {
		alert("E-mail Tag Turns an e-mail address into a mailto hyperlink.\n\nUSE #1: someone\@anywhere.com \nUSE #2: [url=\"someone\@anywhere.com\"]link text[/url]");
		}
	else {
		txt2=prompt("Text to be shown for the link. Leave blank if you want the e-mail address to be shown for the link.","");
		if (txt2!=null) {
			txt=prompt("URL for the link.","mailto:");
			if (txt!=null) {
				if (txt2=="") {
					AddTxt=txt;
					AddText(AddTxt);
				} else {
					AddTxt="[url=\""+txt+"\"]"+txt2+"[/url]";
					AddText(AddTxt);
				}
			}
		}
	}
}

function image() {
	var text = getText();
	if (helpstat){
		alert("Image Tag Inserts an image into the post.\n\nUSE: [img]http://www.anywhere.com/image.gif[/img]");
	} else if (basic) {
		AddTxt="[img]" + text + "[/img]";
		AddText(AddTxt);
	} else {
		txt=prompt("URL for graphic","http://");
		if(txt!=null) {
			AddTxt="[img]"+txt+"[/img]";
			AddText(AddTxt);
		}
	}
}

function showcode() {
	var text = getText();
	if (helpstat) {
		alert("Code Tag Blockquotes the text you reference and preserves the formatting.\nUsefull for posting code.\n\nUSE: [code]This is formated text[/code]");
	} else if (basic) {
		AddTxt="[code]" + text + "[/code]";
		AddText(AddTxt);
	} else {
		txt=prompt("Enter code","");
		if (txt!=null) {
			AddTxt="[code]"+txt+"[/code]";
			AddText(AddTxt);
		}
	}
}

function quote() {
	var text = getText();
	if (helpstat){
		alert("Quote tag Quotes the enclosed text to reference something specific that someone has posted.\n\nUSE: [quote]This is a quote[/quote]");
	} else if (basic) {
		AddTxt=" [quote]" + text + "[/quote]";
		AddText(AddTxt);
	} else {
		if (text) {
			txt=prompt("Text to be quoted",text);
		} else {
			txt=prompt("Text to be quoted","Text");
		}
		if(txt!=null) {
			AddTxt=" [quote] "+txt+" [/quote]";
			AddText(AddTxt);
		}
	}
}

function list() {
	if (helpstat) {
		alert("List Tag Builds a bulleted, numbered, or alphabetical list.\n\nUSE: [list] [*]item1[/*] [*]item2[/*] [*]item3[/*] [/list]");
	} else if (basic) {
		AddTxt=" [list][*]  [/*][*]  [/*][*]  [/*][/list]";
		AddText(AddTxt);
	} else {
		type=prompt("Type of list Enter \'A\' for alphabetical, \'1\' for numbered, Leave blank for bulleted.","");
		while ((type!="") && (type!="A") && (type!="a") && (type!="1") && (type!=null)) {
			type=prompt("ERROR! The only possible values for type of list are blank 'A' and '1'.","");
		}
		if (type!=null) {
			if (type=="") {
				AddTxt="[list]";
			} else {
				AddTxt="[list="+type+"]";
			}
			txt="1";
			while ((txt!="") && (txt!=null)) {
				txt=prompt("List item Leave blank to end list","");
				if (txt!="") {
					AddTxt+="[*]"+txt+"[/*]";
				}
			}
			if (type=="") {
				AddTxt+="[/list] ";
			} else {
				AddTxt+="[/list="+type+"]";
			}
			AddText(AddTxt);
		}
	}
}

function showfont(font) {
	var text = getText();
 	if (font) {
	 	if (helpstat) {
			alert("Font Tag Sets the font face for the enclosed text.\n\nUSE: [font="+font+"]The font of this text is "+font+"[/font="+font+"]");
		} else if (basic) {
			AddTxt="[font="+font+"]" + text + "[/font="+font+"]";
			AddText(AddTxt);
		} else {
			if (text) {
				txt=prompt("Text to be in "+font,text);
			} else {
				txt=prompt("Text to be in "+font,"Text");
			}
			if (txt!=null) {
				AddTxt="[font="+font+"]"+txt+"[/font="+font+"]";
				AddText(AddTxt);
			}
		}
	document.PostTopic.Font.selectedIndex = 0;
	}
}

function showsize(size) {
	var text = getText();
	if (size) {
		if (helpstat) {
			alert("Size Tag Sets the text size. Possible values are 1 to 6.\n1 being the smallest and 6 the largest.\n\nUSE: [size="+size+"]This is size "+size+" text[/size="+size+"]");
		} else if (basic) {
			AddTxt="[size="+size+"]" + text + "[/size="+size+"]";
			AddText(AddTxt);
		} else {
			if (text) {
				txt=prompt("Text to be size "+size,text);
			} else {
				txt=prompt("Text to be size "+size,"Text");
			}
			if (txt!=null) {
				AddTxt="[size="+size+"]"+txt+"[/size="+size+"]";
				AddText(AddTxt);
			}
		}
	document.PostTopic.Size.selectedIndex = 0;
	}
}

function showcolor(color) {
	var text = getText();
	if (color) {
		if (helpstat) {
			alert("Color Tag Sets the text color. Any named color can be used.\n\nUSE: ["+color+"]This is some "+color+" text[/"+color+"]");
		} else if (basic) {
			AddTxt="["+color+"]" + text + "[/"+color+"]";
			AddText(AddTxt);
		} else {
			if (text) {
		     		txt=prompt("Text to be "+color,text);
			} else {
	     			txt=prompt("Text to be "+color,"Text");
			}
			if(txt!=null) {
				AddTxt="["+color+"]"+txt+"[/"+color+"]";
				AddText(AddTxt);
			}
		}
	document.PostTopic.Color.selectedIndex = 0;
	}
}


//code below found here:  http://www.marzie.com/devtools/javascript/functions.asp

function ltrim(s) {
	return s.replace( /^\s*/, "" );
}
function rtrim(s) {
	return s.replace( /\s*$/, "" );
}
function trim ( s ) {
	return rtrim(ltrim(s));
}


function displayImage(img) {
	document.getElementById("displayImage").innerHTML = "<img src='"+img+"' style='height: 320px;' />";
}

