function stopErrors() {
 return true;
}
//window.onerror = stopErrors;


if (mdone != 1) {var mdone = 0;}
function cpmax() {
	//alert(mdone);
	if (mdone != 1) {
		window.moveTo(0,0);
		window.resizeTo(screen.availWidth,screen.availHeight);
		mdone = 1;
	}
}




// the object that you are dragging:
var srcObj = new Object;

// string to hold source of object being dragged:
var dummyObj;



var dragselected;


function startDrag(rmwindow) {

	// when done remove clipboard data
    // window.event.dataTransfer.clearData();	
    	
    // get what is being dragged:
        srcObj = window.event.srcElement;
    
        // store the source of the object into a string acting as a dummy object so we don't ruin the original object:
        dummyObj = srcObj.outerHTML;
    
        // post the data for Windows:
        var dragData = window.event.dataTransfer;
    
        // set the type of data for the clipboard:
        dragData.setData('Text', window.event.srcElement.src);
        dragData.setData('Text', rmwindow);
    
        // allow only dragging that involves moving the object:
        dragData.effectAllowed = 'linkMove';
    
        // use the special 'move' cursor when dragging:
         dragData.dropEffect = 'move';
        //dragData.dropEffect = cursor:url("mycursor.CUR")
        //document.layers["layer1"].visibility=show;

	//document.style.cursor="crosshair";

//   alert("startDrag:"+rmwindow);	
	
}


function enterDrag() {
    // allow target object to read clipboard:
    window.event.dataTransfer.getData('Text');

}

function overDrag() {
    // tell onOverDrag handler not to do anything:
    window.event.returnValue = false;
}


function endDrag() {
//	alert(actselected);
    // when done remove clipboard data
    window.event.dataTransfer.clearData();
    /////sheilds_enabled;
    // parent.frames.activity.location="pending_window.asp";
    // works rmopenframe(rmwindow);
    // alert("endDrag");
    dragselected = 0;
}

function drop(rmdest) {
    //	alert(rmdest);

    // eliminate default action of ondrop so we can customize:
    window.event.returnValue = false;

    // manually add new attributes:
    // dummyObj = addAttribute(dummyObj, 'height="25" width="25" alt="' + srcObj.myLabel + '"');

    // add the picture below shopping cart:
    // miniProductBar.innerHTML += dummyObj + '&nbsp;';

    // change shopping cart message:
    // productBarStatus.innerHTML = '<b>' + srcObj.myLabel + '<\/b> has been added to the shopping cart.';
    rmwindow = window.event.dataTransfer.getData('Text');
    // alert("Drop rmwindow:" + rmwindow);
    // alert("Drop rmdest:" + rmdest);
    //rmopenframe(rmwindow,rmdest);

}


function rmopenframe(rmwindow,rmdest) {
	//alert("rmopenframe");
	sheilds_enabled();
	parent.frames.toolbar_top.setactselected(rmwindow);
	//alert("actselected: " + actselected);
	top.frames.toolbar_bottom.enabletrash();
	if (rmwindow == 1) {
		parent.frames.toolbar_top.compose.src="images/Inteface/Compose_In_Use.jpg";
		parent.frames.activity.location="/activity/compose_window.asp";
	}
	else if (rmwindow == 2) {
		if (rmdest == 2) {
			parent.frames.toolbar_top.pending.src="images/Inteface/Pending_In_Use.jpg";
			parent.frames.activity.location="/activity/pending_window.asp?mode=sent";
		}
		else {
			parent.frames.toolbar_top.pending.src="images/Inteface/Pending_In_Use.jpg";
			parent.frames.activity.location="/activity/pending_window.asp";
		}
	}
	else if (rmwindow == 3) {
		parent.frames.toolbar_top.inbox.src="images/Inteface/Inbox_Button_In_Use.jpg";
		parent.frames.activity.location="/activity/inbox_window.asp";
	}
	else if (rmwindow == 4) {
		parent.frames.toolbar_top.address.src="images/Inteface/Address_In_Use.jpg";
		parent.frames.activity.location="/activity/address_window.asp";
	}
	else if (rmwindow == 5) {
		parent.frames.toolbar_top.archive.src="images/Inteface/Archive_In_Use.jpg";
		parent.frames.activity.location="/activity/archive_window.asp";
	}
	else if (rmwindow == 6) {
		parent.frames.toolbar_top.account.src="images/Inteface/Account_Button_In_Use.jpg";
		parent.frames.activity.location="/activity/account_info_window.asp";
	}
	else if (rmwindow == 7) {
		parent.frames.toolbar_top.help.src="images/Inteface/Help_In_Use.jpg";	
		if (rmdest == 1) {
			parent.frames.activity.location="/activity/help_window_large.asp";
		}
		else {
			parent.frames.tools.location="/activity/help_window_small.asp";
		}
	}
	else if (rmwindow == 8) {
		parent.frames.toolbar_top.toolkit.src="images/Inteface/Toolkit_In_Use.jpg";
		if (rmdest == 1) {
			parent.frames.activity.location="/activity/toolkit_window_large.asp";
		}
		else {
			parent.frames.tools.location="/activity/toolkit_window_small.asp";
		}
	}
	else if (rmwindow == 9) {
			//parent.frames.toolbar_bottom.imgtrash.src="images/Inteface/Trash_In_Use.jpg";
			parent.frames.activity.location="/activity/trash_window.asp";
			top.frames.toolbar_bottom.disabletrash();
			
	}
	else {
		//alert("rmwindow22");
	}
//	actselected = rmwindow;
	parent.frames.toolbar_top.resettoolbar();
	//sheilds_disabled();
	//alert(actselected);
}

// since we aren't working with an actual object, we will add our attributes manually:
function addAttribute(oObj, sVal) {
    var loc = oObj.indexOf(">");
    return oObj.substring(0, loc) + ' ' + sVal + '>';
}


if (window.Event)
  document.captureEvents(Event.MOUSEUP);
	
function nocontextmenu() {
  event.cancelBubble = true, event.returnValue = false;

  return false;
} 

function norightclick(e) {
  if (window.Event) {
    if (e.which == 2 || e.which == 3) return false;
  }
  else if (event.button == 2 || event.button == 3) {
    event.cancelBubble = true, event.returnValue = false;
    return false;
  }
}

if (document.layers)
  document.captureEvents(Event.MOUSEDOWN);

document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
document.onmouseup = norightclick;



function getElement( nameStr ) {
	//alert(nameStr)
	//var allTDs = document.getElementById( nameStr );
	//alert("# of table rows matching: " + allTDs.id);
  if ( document.getElementById ) return document.getElementById( nameStr ); // DOM
  if ( document.all ) return document.all[ nameStr ];  // IE4
  return null;  // sorry, no NS4.
}; //end getElement( string ) -> HTML element


function rightString(fullString, subString) {
   if (fullString.indexOf(subString) == -1) {
      return "A";
   } else {
      return (fullString.substring(fullString.indexOf(subString)+subString.length, fullString.length));
   }
}


