function scratchpad(){
	w2=window.open("/becal/lc/scratchpad.html","w2","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=720,height=430");
	w2.focus();
}
function feedback(){
	f2=window.open("/becal/lc/feedback.htm","f2","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=650,height=440");
	f2.focus();
}
function contents(){
	m2=window.open("/becal/lc/content.html","m2","toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=750,height=400");
	m2.focus();
}	
function fullscreen(){
window.moveTo(0,0); if (IE) { window.resizeTo(screen.availWidth,screen.availHeight); } if (NS) { window.outerHeight = screen.availHeight; window.outerWidth = screen.availWidth; } 
} 

function setCookie(style){
var value = style;
	var the_cookie = "wm_javascript=" + escape("linkstyle:" + value);
	var the_date = new Date("December 31, 2050");
        var the_cookie_date = the_date.toGMTString();
	the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie;
}

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function changeLinkattrToSelf() {
  if (document.links.length > 0) {
	for (var i=0; i < document.links.length; i++) {
		var oldstr = document.links[i].target;
        document.links[i].target = replace(oldstr,'blank','self');
		}
	}
	setCookie('self');
}
function changeLinkattrToBlank() {
  if (document.links.length > 0) {
	for (var i=0; i < document.links.length; i++) {
		var oldstr = document.links[i].target;
        document.links[i].target = replace(oldstr,'self','blank');
		}
	}
	setCookie('blank');
}
function restore_link_choice(){
target_same();
}
function readCookie(){
    var the_cookie = document.cookie;
    var the_cookie = unescape(the_cookie);
    var broken_cookie = the_cookie.split(":");
    var the_style = broken_cookie[1];
    if(the_style == "blank") {
	changeLinkattrToBlank();
	} 
}
function target_blank() {
	divW1=document.getElementById("W10");
	divW1.style.visibility='visible';
	divW0=document.getElementById("W0");
	divW0.style.visibility='hidden';
	changeLinkattrToBlank();
}
function target_same() {
	divW0=document.getElementById("W0");
	divW0.style.visibility='visible';
	divW1=document.getElementById("W10");
	divW1.style.visibility='hidden';
	changeLinkattrToSelf();
}

