
// when using admin__main.aspx, change all links from main.aspx to admin__main.aspx
// to keep the user in the restricted area
// preventing the user to be bounced off th the maintenance page

function admin_page_fix () {
	//alert(document.location);
	//alert((document.location+'').indexOf('admin__Main.aspx'));
	if ((document.location+'').toLowerCase().indexOf('admin__main.aspx') != -1) {
		var text, findRexex, strReplace, object;
		//alert('admin mode found');
		
		findRegex = /main.aspx/gim; 
		strReplace = 'admin__main.aspx';
		
		document.body.style.background='#ffe6e6';
		document.body.style.padding='4px';
		document.body.style.margin='3px';
		document.body.style.border='3px solid red';
		
		object = document.body;		
		text = object.innerHTML;
		result = text.replace(findRegex,strReplace);
		if(text!=result) {
			//alert('You are in admin mode.\nAdmin targets will now be placed.');
			object.innerHTML=result;
		} else {
			//alert('You are in admin mode.');
		}		
	}
}

// execute function
admin_page_fix();