//globals~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
var mode='view'
var modeMessage='Edit This Element'
var highlghtedElementBackground,highlghtedElementBGColor;
var bw=null
var curMouseX,curMouseY
var iDelay=750,sDisplayTimer=null,oLastItem;
//end globals~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//initialize objects~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
bw = new cm_bwcheck();
//document.onmousemove=mtrack;
function mtrack(){ 
	//happens onmousemove, called in contentscroller.js
	if (document.all) {
		curMouseY = event.clientY; 
		curMouseX = event.clientX;
	}else if (document.getElementById) {
		curMouseY = document.body.scrollLeft; 
		curMouseX = document.body.scrollTop;
	}else if (document.layers) {
		curMouseX = window.pageXOffset;
		curMouseY = window.pageYOffset;
	}
	//window.status = 'X:'+curMouseX+'|Y:'+curMouseY;
}
//end initialize objects~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//begin browsercheck object~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function cm_bwcheck(){
	//alert("javascript appears to be loading correctly");
	try {
		this.ver = navigator.appVersion;
		this.agent = navigator.userAgent.toLowerCase();
		//alert(this.agent);
		this.brow = navigator.appName.toLowerCase();
		this.dom = document.getElementById?1:0;
		this.op5 = (this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera;
		this.op6 = (this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera;
		this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6);
		this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1);
		this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6);
		this.ie4 = (this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6);
		this.ie = (this.ie4 || this.ie5 || this.ie6);
		this.mac = (this.agent.indexOf("mac")>-1);
		this.ns6 = (this.agent.indexOf("gecko")>-1 || window.sidebar);
		this.ns7 = ( ( this.agent.indexOf("gecko")>-1 && this.agent.indexOf("netscape/7.1")>-1 ) || window.sidebar);
		this.ns4 = (!this.dom && this.brow.indexOf("netscape")>-1 && this.ver.indexOf("4.")>-1)?1:0;
		this.bw = (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6);
		this.usedom = this.ns6;//Use dom creation
		this.reuse = this.ie||this.usedom;//Reuse layers
		this.px = this.dom&&!this.op5?"px":"";
		return this;
	}catch (exception) {
		alert('exeption:'+exception.description);
	}
}
//handle NN4 oddities
function reDo() { if (innerWidth != origWidth || innerHeight != origHeight) self.document.location.reload(); }
if (bw.ns4) { origWidth = innerWidth; origHeight = innerHeight; onresize=reDo; }
//end browsercheck~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//this removes the image from either the link picker or the page template properties
function deleteImg(whichOne){
	if ( whichOne == 'menu' ) {
		document.forms[0].image.value = '';
		document.getElementById('baseImageContainer').style.display = 'none';
		document.getElementById('newBaseImageContainer').style.display = 'block';
	}else if ( whichOne == 'menu_over' ) {
		document.forms[0].imageOver.value = '';
		document.getElementById('rolloverImageContainer').style.display = 'none';
		document.getElementById('newRolloverImageContainer').style.display = 'block';
	}else if ( whichOne == 'pageBackground' ) {
		document.forms[0].pageBackground.value = '';
		document.getElementById('pageBackgroundImageContainer').style.display = 'none';
		document.getElementById('newPageBackgroundImageContainer').style.display = 'block';
	}
}
function showImg(imgType,imgURL) {
	//alert(imgType + '<<||>>' + imgURL);
	if (imgType=='menu') {
		document.getElementById('menuImage').innerHTML = '<IMG SRC="'+imgURL+'" border="0">';
		document.forms[0].image.value = imgURL;
		document.getElementById('baseImageContainer').style.display = 'block';
		document.getElementById('newBaseImageContainer').style.display = 'none';
	}else if ( imgType == 'pageBackground' ) {
		document.getElementById('pageBackgroundImage').innerHTML = '<IMG SRC="'+imgURL+'" border="0">';
		document.forms[0].pageBackground.value = imgURL;
		document.getElementById('pageBackgroundImageContainer').style.display = 'block';
		document.getElementById('newPageBackgroundImageContainer').style.display = 'none';
	}else if ( imgType == 'menu_over' ) {
		document.getElementById('menuImage_over').innerHTML = '<IMG SRC="'+imgURL+'" border="0">';
		document.forms[0].imageOver.value = imgURL;
		document.getElementById('rolloverImageContainer').style.display = 'block';
		document.getElementById('newRolloverImageContainer').style.display = 'none';
	}
}
//end removing and showing images on page template properties or menu link properties pages

//define objects and their properties~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function getObject(obj) {
	var theObj;
	if (typeof obj=="string") {	
		if(eval('document.getElementById("'+obj+'")')){
			theObj = eval('document.getElementById("'+obj+'").style');
		}else{theObj = false;}
	} else { theObj = obj; }
	return (theObj) ? theObj: false ; 
}
function getPosition(obj,direction) {
	startCount = false; objPos = 0;
	while (obj != null && startCount == false) {
		if (obj.id.length != 36) { obj = obj.offsetParent; } else { startCount = true; }
	}
	while (obj != null) {
		objPos += obj["offset" + direction];
		obj = obj.offsetParent;
	}
	return objPos
}
function setHighlightElementStyle(theObj, thisMode){
	if (thisMode == 'edit') {
		//theObj.border = 'double yellow 1px';
		theObj.cursor = 'hand';
		if (highlghtedElementBGColor == '#ffffff') {theObj.bgColor = '#eeeeee';}
	} else if (thisMode == 'add') {
		theObj.border = 'double green 1px';
		theObj.cursor = 'crosshair';
		if (highlghtedElementBGColor == '#ffffff') {theObj.bgColor = '#eeeeee';}
	} else if (thisMode == 'delete') {
		theObj.border = 'double red 1px';
		theObj.cursor = 'crosshair';
		theObj.bgColor = '#ffffff';
		if (highlghtedElementBGColor == '#ffffff') {theObj.bgColor = '#eeeeee';}
	}
}
//end define objects and their properties~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//movement or positioning~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function shiftTo(obj, x, y) {
	var theObj = getObject(obj);
	if (bw.ie4) {
		theObj.pixelLeft = parseInt(x); theObj.pixelTop = parseInt(y);
	} else {
		theObj.left = parseInt(x); theObj.top = parseInt(y);
	}
}
//end movement or positioning~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//onMouseOver event handlers~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function highlightButton(obj){
	var theObj = getObject(obj);
	//theObj.border = 'double black 1px';
	theObj.background = '#eeeeee';
}		
function unhighlightButton(obj){
	var theObj = getObject(obj);
	theObj.background = '#ffffff';
}
function highlightElement(obj, thisMode, zone){
	var theObj = getObject(obj);
	highlghtedElementBGColor = theObj.bgColor;
	setHighlightElementStyle(theObj, thisMode);
	t = getPosition(event.srcElement, 'Width');
	yPos = getPosition(event.srcElement, 'Top') - 14;
	if (yPos < 0) { yPos = getPosition(event.srcElement, 'Top') }
	if ( zone!=null && thisMode!='add' ) {
		shiftTo('edit'+zone, getPosition(event.srcElement, 'Left') + 1, yPos);
		setHighlightElementStyle(getObject('edit' + zone), 'edit')
		getObject('edit' + zone).visibility = 'visible';
	} else if ( zone=='contentElement' ) {
		try {
			currentObjectTypeID = contentElementTypeID;
			shiftTo(thisMode+'Message', getPosition(event.srcElement, 'Left') + 1, yPos);
			setHighlightElementStyle(getObject(thisMode + 'Message'), thisMode)
			getObject(thisMode + 'Message').visibility = 'visible';
		}catch(error) {
			alert(error.description);
		}
	} else {
		shiftTo('edit'+zone, getPosition(event.srcElement, 'Left') + 1, yPos);
		setHighlightElementStyle(getObject('edit' + zone), 'edit')
		getObject('edit' + zone).visibility = 'visible';
	}
}
function unhighlightElement(obj, thisMode, zone){
	var theObj = getObject(obj);
	//theObj.border = 'double red 1px';
	theObj.cursor = 'default';
	theObj.bgColor = highlghtedElementBGColor;
	if ( zone != null&&thisMode!='add' ) 
		getObject('edit'+zone).visibility = 'hidden';
	else if ( zone=='contentElement' )
		getObject(thisMode + 'Message').visibility = 'hidden';
	else
		getObject('edit'+zone).visibility = 'hidden';
}
//Floating Toolbar code
function showToolbar( obj, hasContent ) {
	currentObjectTypeID = contentElementTypeID;
	currentObjectID = obj.id;
	currentOffsetWidth = obj.offsetWidth;
	showDetails('toolbar','','',hasContent);
	setHighlightElementStyle(getObject('toolbar'), 'delete')
}
function showMenuToolbar(obj,bannerheight,linknum) {
	currentObjectTypeID = 'MenuLink';
	//alert( obj )
	obj = document.all[obj]
	currentObjectID = obj.id;
	//alert(obj.id);
	currentOffsetWidth = curMouseX+50;
	currentOffsetHeight = curMouseY+document.body.scrollTop;//getThisHeight(obj,'Top',linknum);
	showDetails( 'toolbar', currentOffsetHeight, currentOffsetWidth );//currentOffsetWidth instead of toolBarY
	setHighlightElementStyle(getObject('toolbar'), 'delete')
}
function showDetails(sDest,itop,ileft,inDiv) {
	//alert( hasContent );
	if (document.all) {
		var i = event.srcElement
		stopTimeout()
		dest = document.all[sDest]
		if ((oLastItem!=null) && (oLastItem!=dest))
			hideItem()
		if (dest) {
			if (ileft) 
				dest.style.pixelLeft = ileft
			else {
				if ( inDiv == 'true' ) {
					dest.style.pixelLeft = curMouseX;
				}else {
					dest.style.pixelLeft = getPosition(i,"Left");
				}
			}
			if (itop){
				dest.style.pixelTop = itop
			}else{
				if ( inDiv == 'true' ) {
					dest.style.pixelTop = curMouseY;
				}else {
					dest.style.pixelTop = getPosition(i,"Top") - 10;
				}
			}
			dest.style.display = "block";
			dest.style.borderWidth = '1px';
			dest.style.borderStyle = 'solid';
			dest.style.borderColor = 'red';
		}
		oLastItem = dest
	}
}
function hideItem() { if (oLastItem) { oLastItem.style.display="none"; } }
function highlightMode(obj){ if (obj != 'view') { var theObj = getObject(obj); theObj.border = 'double black 1px'; theObj.bbgColor = '#dddddd'; } }		
function unhighlightMode(obj){ var theObj = getObject(obj); if (mode != obj) { theObj.border = 'none';	theObj.bgColor = '#eeeeee';	} }		
//end onMouseOver event handlers~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//onMouseOut event handlers~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function startTimeout(el) { 
	//el is the element's ID
	try {
		if (!el.contains(event.toElement)) { 
			try {
				stopTimeout();
				sDisplayTimer=setTimeout("hideItem()",iDelay); 
			}catch(error) {
				alert('startTimeout(el) - error catching #1:'+error.description+'\n\n'+error.number);
			}
		} 
	}catch(error) {
		alert('startTimeout(el) - error catching #2:'+error.description+'\n\n'+error.number);
	}
}
function stopTimeout() { 
	try {
		clearTimeout(sDisplayTimer);
	}catch(error) {
		alert('stopTimeout() - '+error.description);
	}
}
//end onMouseOut event handlers~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//onClick event handlers
function submitForm(strAction,frmNum){
	if ( arguments.length>1 ){
		var fAction = document.forms[frmNum].frmAction;
		fAction.value = strAction;
		document.forms[frmNum].submit();
	}else{
		var fAction;
		try {
			fAction=document.form1.frmAction;
		}catch (error) {
			fAction=document.form1.action; 
		}
		fAction.value=strAction;
		//alert( fAction.value );
		document.forms[0].submit();
	}
}
function manageContentElement(objectID, objectTypeID, HTMLWidth, action) {
	//alert('manage content element.  currectObjectTypeID::'+currentObjectTypeID+'||action::'+action);
	mywidth=HTMLWidth+100; myheight=585; if (!objectID) { objectID = currentObjectID; }
	if (!HTMLWidth) HTMLWidth = currentOffsetWidth;
	if ( self.screen ){
		if (mywidth > screen.width){ mywidth = screen.width - 150; HTMLWidth = mywidth - 200; }
		if (mywidth < 520) mywidth = 520; if (myheight > screen.height) myheight = screen.height - 100; if (myheight < 350) myheight = 350;
	}
	if (currentObjectTypeID == 'MenuLink') { manageMenuLink(objectID, action);
	}else if ( action=='edit' || action=='add' ) { newWindow('/admin/content/contentEditor.asp?display='+action+'&objectTypeID='+objectTypeID+'&existobjid='+currentObjectID+'&objectid='+objectID+'&pageID='+pageID+'&HTMLWidth='+HTMLWidth+'&pagetypeid='+pagetypeid, 'contentEditor', myheight, mywidth);
	}else if ( action=='moveUp' || action=='moveDown' ) { document.location.replace('/admin/content/moveElement.asp?action='+action+'&objectid='+objectID+'&pageID='+pageID);
	}else if ( action=='delete' ) { if (confirm('Are you sure you want to delete this element?')) document.location.replace ('/admin/content/deleteElement.asp?objectid=' + objectID + "&pageID=" + pageID); }
}
function manageMenuLink(objectID, action) {
	if (action == 'edit' || action == 'add') {
		newWindow('/admin/content/linkmanager.asp?linkpickertype=menulink&display='+action+'&objectid='+objectID, 'linkEditor', 650, 475);
	} else if ( action=='moveUp' || action=='moveDown' ) {
		document.location.replace('/admin/menu/menuElement.asp?action='+action+'&objectid='+objectID);
	} else if (action == 'delete') {
		if (confirm('Are you sure you want to delete this link?')) {
			document.location.replace('/admin/menu/deleteelement.asp?objectid='+objectID);
		}
	}
}

//get keystroke
var keycode;
var realkey;

function keyDown() {
	var keycode = event.keyCode
	var realkey = String.fromCharCode(event.keyCode)
	//alert("keycode: " + keycode + "\nrealkey: " + realkey)
	if (keycode==65) isKeyDown(true);
}

document.onkeydown = keyDown;
document.onkeyup = resetKey;

var isDown;
function resetKey(){
	//alert('reset');
	isKeyDown(false);
}

function isKeyDown(myVal) {
	if ( arguments.length>0 ){
		isDown = myVal;
		if (myVal==true ) window.status=navigator.userAgent+'L'; else window.status='';
	}else {
		return isDown;
	}
}
//end keystroke

function newWindow(theURL, winname, myHeight, mywidth) {
	//alert(isKeyDown() );
	if ( isKeyDown()==false || isKeyDown()==undefined ) {
		if (event)
			event.returnValue=false; 
		if (myHeight < 300 && myHeight != 301 && winname != 'userLink' ) myHeight = 385;
		if (winname == 'linkPicker' || winname == 'pageEditor' || winname == 'linkEditor'){ if ( ( mywidth < 400 || mywidth == undefined ) ) mywidth = 400;
		}else if (winname != 'imageSelector' && winname != 'userLink' ){ if ( ( mywidth < 775 && mywidth != 401 ) && winname != 'pickCalSites' ) mywidth = 775; }
		if (theURL.indexOf('?') > 0) { theURL = theURL + '&rnd=' + Math.random(); } else { theURL = theURL + '?rnd=' + Math.random(); }
		if (navigator.appVersion.indexOf('4') != -1) {
			xTop = 70; yTop = 50;
			newWin = window.open(theURL, winname, 'height='+myHeight+',width='+mywidth+',scrollbars=1,resizable=1,menubar=0,toolbar=0,status=1,location=0,directories=0,left=' + xTop + ',top=' + yTop);
		} else {
			newWin = window.open(theURL, winname, 'height='+myHeight+',width='+mywidth+',scrollbars=1,resizable=1,menubar=0,toolbar=0,status=1,location=0,directories=0,alwaysRaised=YES,left=150,top=200');
		}
		newWin.focus()
	}
	isKeyDown(false);
}

function managePage(action) {
	if (action == 'createPage') { newWindow('/admin/page/default.asp?display=add&pageID=' + pageID, 'pageEditor', 400, 500);
	} else if (action == 'editPage') { newWindow('/admin/page/default.asp?display=edit&pageID=' + pageID, 'pageEditor', 400, 600);
	} else if (action == 'reviewPage') { parent.document.location.replace('default.asp?pageID=' + pageID + '&pageMode=review');
	} else if (action == 'publishPage') { newWindow('/admin/content/progress_bar.asp?pageMode=publish','progressWindow',301,401);	parent.document.location.replace('/default.asp?pageMode=publish&pageID=' + pageID);
	} else if (action == 'activateVersion') { if(confirm('You have elected to make this version active.\n\n\nPerforming this action makes the page active but does NOT publish the page to your site.\n\n\nYou will be able to find previous versions of this page in the \'Publishing & Versioning\' section.') ) parent.document.location.replace('/admin/publish/activateVersion.asp?pageID=' + pageID);
	} else if (action == 'deletePage') { if(confirm("To make this page inactive without deleting it, click \'Cancel,\'\nthen under 'Page Properties', uncheck the \'Is Active\' checkbox. \n\nAgain, please confirm that you are sure you want to delete this page by clicking \"OK\".")) { document.location.replace('/admin/page/act_page.asp?frmAction=delete&pageID=' + pageID); } }
}
//when you click on page list, you run this function
function displayPage(pageID,siteID) { if (pageID == 'New') { newWindow('/admin/page/default.asp?display=add&siteID='+siteID, 'pageEditor', 400, 400); } else { document.location = '/default.asp?pageID=' + pageID; } }
//when you want to delete site, you run this function
function deleteObject(objID,objName){ if(objName == 'subsite'){ if(confirm('Are you sure you want to delete this subsite?\nPlease note that this action deletes everything associated with this subsite.')) parent.document.location.replace("/admin/site/default.asp?action=delete&siteid="+objID); }else if(objName == 'pagetemplate') { if(confirm('Are you sure you want to delete this page template?\nPlease note that this action deletes everything associated with this template.')) parent.document.location.replace("/admin/pagetype/default.asp?display=delete&pagetypeid="+objID);	} }
//end onClick event handlers
//MM_findObj
function MM_findObj( n, d ) { //v4.0
  var p,i,x;
  d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
//for list server
function toggleDiv(divName) {
	var myObj = MM_findObj( divName );
	var myImg = MM_findObj( divName+'Toggle' );
	if ( myObj.style.display=='block' ) {
		myObj.style.display='none';
		myImg.src='/cmsImages/admin/module_toggle_closed.gif';
	}else {
		myObj.style.display='block';
		myImg.src='/cmsImages/admin/module_toggle_open.gif';
	}
}//end toggleDiv
function showStatus(divName) {
	var myObj = MM_findObj( divName );
	if ( myObj.style.display=='block' ) {
		window.status='Collapse';
	}else {
		window.status='Expand';
	}
}//end showStatus
function getIDs() {
	//before anything, see if there is an address
	if (document.unitAcct.address.value=='') {
		alert("An address is required when adding a new unit, please supply one.")
		return false;
	}
	//first, make sure the HOAFee is numbers only
	var reDigit = /^\d/
	if (document.unitAcct.hoaFee.value!='') {
		if (!reDigit.test(document.unitAcct.hoaFee.value)) {
			alert("Please use only digits in the \'Home Owners Association Fee\' field.")
			return false;
		}
	}
	var i=0;
	var ownerID='';
	var tenantID='';
	//OWNERS
	try {
		if ( window.frames["OWNERS"].document.forms["ownerIDForm"].ownerID.length ) {
			//alert(window.frames["OWNERS"].document.forms["ownerIDForm"].ownerID.length);
			for ( i=0; i<window.frames["OWNERS"].document.forms["ownerIDForm"].ownerID.length; i++ ) {
				try {
					if ( window.frames["OWNERS"].document.forms["ownerIDForm"].ownerID[i].checked ) {
						ownerID+=window.frames["OWNERS"].document.forms["ownerIDForm"].ownerID[i].value+",";
					}
				}catch (error) {
					//do nothing
				}
			}
		}else {
			//alert("in here");
			if ( window.frames["OWNERS"].document.forms["ownerIDForm"].ownerID.checked ) {
				ownerID+=window.frames["OWNERS"].document.forms["ownerIDForm"].ownerID.value+",";
			}		
		}//end if j=="undefined"
		//get leftover owners ids
		ownerID+=","+window.frames["OWNERS"].document.forms["ownerIDForm"].xOWNERID.value;
	}catch (error) {
		//this will error out when no owners have been identified
		ownerID='';
	}
	//TENANTS
	try {
		if ( window.frames["TENANTS"].document.forms["tenantIDForm"].tenantID.length ) {
			for (i=0;i<window.frames["TENANTS"].document.forms["tenantIDForm"].tenantID.length;i++) {
				try {
					if ( window.frames["TENANTS"].document.forms["tenantIDForm"].tenantID[i].checked ) {
						tenantID+=window.frames["TENANTS"].document.forms["tenantIDForm"].tenantID[i].value+",";
					}
				}catch (error) {
					//do nothing
				}
			}
		}else {
			if ( window.frames["TENANTS"].document.forms["tenantIDForm"].tenantID.checked ) {
				tenantID+=window.frames["TENANTS"].document.forms["tenantIDForm"].tenantID.value+",";
			}		
		}
		//get leftover tenants ids
		tenantID+=","+window.frames["TENANTS"].document.forms["tenantIDForm"].xTENANTID.value;
	}catch (error) {
		//this will error out when no tenants have been identified
		tenantID='';
	}
	//assign to hidden fields in main form, main window
	document.unitAcct.ownerID.value=ownerID;
	document.unitAcct.tenantID.value=tenantID;	
	//alert(document.unitAcct.ownerID.value=ownerID+"||"+document.unitAcct.tenantID.value);
	document.unitAcct.submit();
}//end getIDs

function changeColor( clr, eName ) {
	document.getElementById(eName).style.backgroundColor = clr;
}

function setCookie(name, value, expire) {
	document.cookie = name + "=" + escape(value)+((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function setColor( clrCode ) {
	var today = new Date()
	var expires = new Date()
	expires.setTime(today.getTime() + 1000*60*60*24*365)
	setCookie("SearchHeaderColor", clrCode, expires)
}
/* Script by Lefteris Haritou      
   Copyright ©1997 
   http://www.geocities.com/~lef
   This Script is free as long 
   as you keep the above credit !*/

var letters= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z","!","@","#","$","%","^","&","*","(",")","_","-","+","=","<",">","/","?","®","©")
var smessage=""
var message= new Array();
var msg=0;

function doStatus( strMsg1, strMsg2, strMsg3 ) {
	message[0]=strMsg1;
	if ( strMsg2=='' ) {
		message[1]=strMsg1;
	}else{
		message[1]=strMsg2;
	}
	if ( strMsg3=='' ) {
		message[2]=strMsg1;
	}else {
		message[2]=strMsg3;	
	}
	start();
}

function start(){
	var doItLong = 'no';
	if ( doItLong == 'yes' ) {
		for (y=0; y<message[msg].length; y++){
			for (x=0; x<20; x++){
				rnum=Math.random();
				rnum*=letters.length-1
				rnum=Math.round(rnum)
				window.status=smessage+letters[rnum]
				for (del=0; del<20; del++){/*nothing - delay*/}
			}
			smessage+=message[msg].substring(y,y+1)
		}
	}else {
		window.status=message[msg];
	}
	window.setTimeout('clrdspl()',2000);
}

function clrdspl(){
	smessage="";
	window.status="";
	if (msg<message.length-1){
		msg++;
		start();
	} else{
		msg=0;
		window.setTimeout('start()',1000)
	}
}
