
var popUpWin; 

function OpenCalendar(idname, postBack)
{
	popUpWin = window.open('/Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=215,left=200,top=250');
}

function OpenCalendarNew(idname, postBack)
{
	popUpWin = window.open('../../Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=215,left=200,top=250');
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUpWin.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}

function OpenCallNote(NoteID)
{


	window.open('MessageDetail.aspx?id=' + NoteID ,'noteWin', 'width=600,height=450,left=200,top=250,scrollbars=1');

}		

function popUp(URL,ww,wh,wl,wt) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + ww + ",height=" + wh + ",left = " +wl + ",top = " + wt + "');");
}

function popUpNew(URL,ww,wh,wl,wt, item) {
	eval(item + " = window.open(URL, '" + item + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + ww + ",height=" + wh + ",left = " +wl + ",top = " + wt + "');");

    eval(item + ".focus();");	
}

function popUpErrors(URL,ww,wh,wl,wt) {
	page = window.open(URL, 'errors', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + ww + ',height=' + wh + ',left = ' +wl + ',top = ' + wt);
    page.focus();	
}

function popUpDict(searchterm) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open('http://cancerweb.ncl.ac.uk/cgi-bin/omd?' +searchterm, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=600,left=50,top=50');");
}

function PopupSynonyms(field) {
	synWin = window.open('../Keywords/FindSynonyms.aspx?field=' + field ,'synWin', 'width=800,height=600,left=200,top=250,scrollbars=1,statusbar=1');
    synWin.focus();	
}

function PopupShowQuery(field) {
	qWin = window.open('../Keywords/ShowQuery.aspx?field=' + field ,'qWin', 'width=800,height=600,left=200,top=250,scrollbars=1,statusbar=1');
    qWin.focus();	
}

function PopupExternalSearch(query) {
	searchWin = window.open(query ,'searchWin', '');
    searchWin.focus();	
}

function ToggleDiv(id, textid, ontext, offtext) {

    if (document.all[id].style.display == "none") {
	    document.all[id].style.display = "block";
	    document.all[textid].innerText = ontext;
	}
	else {
	    document.all[id].style.display = "none";
        document.all[textid].innerText = offtext;
	}
}

