//
// Author: Yannis Velegrakis velgias@cs.toronto.edu
// Modified by:  Teresa Almeida, 991163183
//
// Department of Computer Science. (c) January 2003
//
///////////////////////////////////////////////////////

// DBGroup Admin information
var emailAdmin = "g1alme@cdf.utoronto.ca";

// DBGroup default directory to save new xml files forms
var newXmlDirectory = "/cs/htdata/db/WebPageData/";

// DBGroup default directory for the images
var imageDir = "../photos.";

// DBGroup default image when file (for some reason) disappears from the file
var blankImage = imageDir + "blank.gif";

// Array for the type of files allowed to be uploaded in the DBGroup
allowedExtArray = new Array(".gif", ".jpg", ".jpeg");

// Array for the type of files allowed to be uploaded in the DBGroup - Publications
psExtArray = new Array(".ps", ".ps.gz", ".ps.zip");
pdfExtArray = new Array(".pdf", ".pdf.gz", ".pdf.zip");

// DBGroup default directory for the efiles of the publications
var publicationsDir = "../files.";

var languagesArray = new Array("English", "Spanish", "Greek", "French");

var names = Array ();

names [0] = "Home";
names [1] = "Members";
names [2] = "Projects";
names [3] = "Publications";
names [4] = "Seminars";
names [5] = "Courses";
names [6] = "Affairs";
names [7] = "Links";


function getXmlDirectory()
{
  //alert(newXmlDirectory);
  return newXmlDirectory;
}


function getefileDirectory()
{
  return publicationsDir;
}

function preload() {
        this.length = 2*names.length;
        for (var i = 0; i < names.length; i++) {
                this[i] = new Image();
                this[i].src = "../images/" + names[i] + ".gif";
                this[2*i] = new Image();
                this[2*i] = "../images/" + names[i] + "Active.gif";
                }
}


if (document.images) {
        var stuff = new preload()
}


self.defaultStatus='';

function select(i) 
{
	document.images[i + 1].src = "../images/" + names[i] + "Active.gif";
}

function deselect(i) 
{
	document.images[i + 1].src = "../images/" + names [i] + ".gif";
}

function showDate()
{
	var months=new Array(13);
        months[1]="Jan.";
        months[2]="Feb.";
	months[3]="Mar.";
	months[4]="Apr.";
      	months[5]="May";
	months[6]="Jun.";
      	months[7]="Jul.";
	months[8]="Aug.";
	months[9]="Sep.";
      	months[10]="Oct.";
	months[11]="Nov.";
      	months[12]="Dec.";
      	var time=new Date();
	var lmonth=months[time.getMonth() + 1];
	var date=time.getDate();
	var year=time.getYear();
	if (year < 1000) year = 1900 + year;
	document.write(lmonth + " ");
	document.write(date + ", " + year);
}



// AND HERE ARE THE TABS
var tabs = Array();

tabs["Home"] = Array(); 
tabs["Home"]["title"] = Array(); 
tabs["Home"]["link"] = Array();
tabs["Home"]["title"][0] = "News"; 
tabs["Home"]["link"][0] = "http://www.cs.toronto.edu/db/WebPage/htmldocs/index.html";
tabs["Home"]["title"][1] = "DB Events"; 
tabs["Home"]["link"][1] = "http://www.cs.toronto.edu/db/WebPage/cgi-bin/dbevents.cgi";


tabs["Members"] = Array(); 
tabs["Members"]["title"] = Array();
tabs["Members"]["link"] = Array();
tabs["Members"]["title"][0] = "Faculty"
tabs["Members"]["link"][0] = "../htmldocs/ProfMembers.html";
tabs["Members"]["title"][1] = "Ph.D. "
tabs["Members"]["link"][1] = "../htmldocs/PhDMembers.html";
tabs["Members"]["title"][2] = "M.Sc."
tabs["Members"]["link"][2] = "../htmldocs/MScMembers.html";
tabs["Members"]["title"][3] = "Associates"
tabs["Members"]["link"][3] = "../htmldocs/AssocMembers.html";
tabs["Members"]["title"][4] = "Alumni"
tabs["Members"]["link"][4] = "../htmldocs/AlumniMembers.html";

tabs["Publications"] = Array(); 
tabs["Publications"]["title"] = Array(); 
tabs["Publications"]["link"] = Array();
tabs["Publications"]["title"][0] = "By Year"
tabs["Publications"]["link"][0] = "../htmldocs/PublicByYear.html";
tabs["Publications"]["title"][1] = "Search"
tabs["Publications"]["link"][1] = "../templates/SearchPublications.shtml";
tabs["Publications"]["title"][2] = "ACM SIGMOD Anthology"; 
tabs["Publications"]["link"][2] = "../htmldocs/Anthology.html";

tabs["Projects"] = Array(); 
tabs["Projects"]["title"] = Array();
tabs["Projects"]["link"] = Array();
tabs["Projects"]["title"][0] = "Active"
tabs["Projects"]["link"][0] = "../htmldocs/ActiveProjects.html";
tabs["Projects"]["title"][1] = "Past"
tabs["Projects"]["link"][1] = "../htmldocs/PastProjects.html";

tabs["Courses"] = Array();
tabs["Courses"]["title"] = Array();
tabs["Courses"]["link"] = Array();
tabs["Courses"]["title"][0] = "Graduate"
tabs["Courses"]["link"][0] = "../htmldocs/GraduateCourses.html";
tabs["Courses"]["title"][1] = "UnderGraduate"
tabs["Courses"]["link"][1] = "../htmldocs/UnderGradCourses.html";

tabs["Links"] = Array();
tabs["Links"]["title"] = Array();
tabs["Links"]["link"] = Array();
tabs["Links"]["title"][0] = "Useful Links"
tabs["Links"]["link"][0] = "../htmldocs/Links.html";

tabs["GroupAffairs"] = Array(); 
tabs["GroupAffairs"]["title"] = Array(); 
tabs["GroupAffairs"]["link"] = Array(); 
tabs["GroupAffairs"]["title"][0] = "Research Resources"
tabs["GroupAffairs"]["link"][0] = "../htmldocs/Resources.html";
tabs["GroupAffairs"]["title"][1] = "DB2 Info Center"
tabs["GroupAffairs"]["link"][1] = "../htmldocs/db2.html";
tabs["GroupAffairs"]["title"][2] = "Photo Album"
tabs["GroupAffairs"]["link"][2] = "../htmldocs/PhotoAlbum.html";
tabs["GroupAffairs"]["title"][3] = "About this site"
tabs["GroupAffairs"]["link"][3] = "../htmldocs/Credits.html";

tabs["Seminars"] = Array(); 
tabs["Seminars"]["title"] = Array(); 
tabs["Seminars"]["link"] = Array();
tabs["Seminars"]["title"][0] = "Upcoming"
tabs["Seminars"]["link"][0] = "../htmldocs/CurrentSeminars.html";
tabs["Seminars"]["title"][1] = "Past"
tabs["Seminars"]["link"][1] = "../htmldocs/PastSeminars.html";
tabs["Seminars"]["title"][2] = "Reading Group"
tabs["Seminars"]["link"][2] = "../htmldocs/ReadingGroup.html";

function getTitles(menu)
{
	;
}

function getLinks(menu)
{
	;
}

function steiltouGramma(user)
{
	command = "mailto:" + user + "@cs.toronto.edu";
	mailWindow = window.open(command, "mail", "location=no");
}

function showTabs(menu, active) 
{
	var hspace=10;
	var   activeBg = "\"#ffcc33\"";
	var inactiveBg = "\"#efefef\"";
	var   activeFg = "\"#000000\"";
	var inactiveFg = "\"#0000cc\"";
	var widthSpace = "\"30\""
	document.write("<table class=\"globalTable\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">");
	
	// First line
	document.write("<tr>");
	// Initial space 
	document.write("<td height=\"1\" bgcolor=\"#003366\"></td>");
		
	for (i=0; i<tabs[menu]["title"].length; i++)
	{
		// frame start
		document.write("<td bgcolor=#808080><img width=\"1\" height=\"1\" alt=\"\"></td>");
		document.write("<td bgcolor=#808080><img width=\"1\" height=\"1\" alt=\"\"></td>");
		// Context
		document.write("<td bgcolor=#808080><img width=\"1\" height=\"1\" alt=\"\"></td>");
		// frame ends
		document.write("<td bgcolor=#808080><img width=\"1\" height=\"1\" alt=\"\"></td>");
		document.write("<td bgcolor=#808080><img width=\"1\" height=\"1\" alt=\"\"></td>");
		
	}
	// The rest gap-fill element
	document.write("<td></td>");
	document.write("</tr>");
	
	// The tabs line
	document.write("<tr>");
	// Initial space 
	if (active == 0)
		document.write("<td valign=\"top\" bgcolor=" + activeBg + "><img border=\"0\" height=\"12\" src=\"../images/roundCornerUpLeft.gif\"/></td>");
	else
		document.write("<td valign=\"top\" bgcolor=" + inactiveBg + "><img border=\"0\" height=\"12\" src=\"../images/roundCornerUpLeft.gif\"/></td>");
	


	for (i=0; i<tabs[menu]["title"].length; i++)
	{
		
		var tabBackGround = inactiveBg; 
		var fgColor = inactiveFg;
		if (i == active)
		{
			tabBackGround = activeBg;
			fgColor = activeFg;
		}	
		// Tab left frame 
		if ((active == 0) && (i == 0))
		{
			document.write("<td width=\"1\" bgcolor=" + activeBg + "><img width=\"1\" height=\"1\" alt=\"\"></td>");
			document.write("<td width=\"1\" bgcolor=" + activeBg + "><img width=\"1\" height=\"1\" alt=\"\"></td>");
		}
		else if (i == 0)
		{
			document.write("<td width=\"1\" bgcolor=" + inactiveBg + "><img width=\"1\" height=\"1\" alt=\"\"></td>");
			document.write("<td width=\"1\" bgcolor=" + inactiveBg + "><img width=\"1\" height=\"1\" alt=\"\"></td>");
		}				
		else
		{
			document.write("<td width=\"1\" bgcolor=#808080><img width=\"1\" height=\"1\" alt=\"\"></td>");
			document.write("<td width=\"1\" bgcolor=#ffffff><img width=\"1\" height=\"1\" alt=\"\"></td>");
		}				
		// Tab text 
		document.write("<td bgcolor=" + tabBackGround + " nowrap>");
		document.write("<img height=\"1\" width=\"" + hspace + "\"/>");
		if (i == active) // make it bold
			document.write("<b>");
		document.write("<a href=\"" + tabs[menu]["link"][i] + "\">");
		document.write("<font style=\"text-decoration: none\" size=\"-1\" face=\"Arial\" color=" + fgColor + ">");
		document.write(tabs[menu]["title"][i]);
		document.write("</font>");
		document.write("</a>");
		if (i == active) // undo the bold
			document.write("</b>");
		document.write("<img height=\"1\" width=\"" + hspace + "\"/>");
		document.write("</td>");
			
		// tab right frame 
		document.write("<td width=1 bgcolor=#ffffff><img width=1 height=1 alt=\"\"></td>");
		document.write("<td width=1 bgcolor=#808080><img width=1 height=1 alt=\"\"></td>");
		
	}
	
	// fill the rest of the space
	document.write("<td width=\"100%\"></td>")
	document.write("</tr>");
	
	// The line underneath
	document.write("<tr>");
	document.write("<td bgcolor=" + activeBg + " colspan=\"" + (tabs[menu]["title"].length*5 + 2) +  "\" height=\"14\"></td>");
	document.write("</tr></table>");
}


function showFullDate(dateStr)
{
        var day = dateStr.substr(0,2);
        var month = dateStr.substr(3,2);
	month = month - 1;
        var year = dateStr.substr(6,4);
	var dateVariable = new Date(year, month, day);
	//document.write( "    -- " +  day + "  " + month + "  " + year + "   " + dateVariable);
	var dayNames = new Array(7);
	dayNames[0] = "Sunday";
	dayNames[1] = "Monday";
	dayNames[2] = "Tuesday";
	dayNames[3] = "Wednesday";
	dayNames[4] = "Thursday";
	dayNames[5] = "Friday";
	dayNames[6] = "Saturday";
	document.write(dayNames[dateVariable.getDay()] + " ");
	var monthNames = new Array(12);
	monthNames[0] = "January";
	monthNames[1] = "February";
	monthNames[2] = "March";
	monthNames[3] = "April";
	monthNames[4] = "May";
	monthNames[5] = "June";
	monthNames[6] = "July";
	monthNames[7] = "August";
	monthNames[8] = "September";
	monthNames[9] = "October";
	monthNames[10] = "November";
	monthNames[11] = "December";
	document.write(monthNames[dateVariable.getMonth()] + " ");
	document.write( day + ", " + year);
}


function check_date(field)
{
  var checkstr = "0123456789";
  var DateField = field;
  var Datevalue = "";
  var DateTemp = "";
  var seperator = "/";
  var day;
  var month;
  var year;
  var leap = 0;
  var err = 0;
  var i;
  err = 0;
  
            
  DateValue = DateField.value;
    
  /* Delete all chars except 0..9 */
  for (i = 0; i < DateValue.length; i++) 
  {
    if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) 
    {
	  DateTemp = DateTemp + DateValue.substr(i,1);
    }
  } // end-for
  
  DateValue = DateTemp;

  /* Always change date to 8 digits - string*/
  /* if year is entered as 2-digit */
  if (DateValue.length == 6)
  {
    /* if year is >00 and <20 --> always assume 20xx */
    year = DateValue.substr(4,2);
    if ( year <  20)
    {
       DateValue = DateValue.substr(0,4) + '20' + year; 
    }
    else
    {
	   DateValue = DateValue.substr(0,4) + '19' + year; 
    }
  }
  
  if (DateValue.length != 8) 
  {  err = 19; }
             
  /* year is wrong if year = 0000 */
             year = DateValue.substr(4,4);
             if (year == 0) 
			 {  err = 20;   }
             /* Validation of month*/
             month = DateValue.substr(2,2);
             if ((month < 1) || (month > 12)) 
			 {    err = 21;  }
             
			 /* Validation of day*/
             day = DateValue.substr(0,2);
             if (day < 1) 
			 {  err = 22;  }
   
             /* Validation leap-year / february / day */
             if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) 
			 {    leap = 1;   }
   
             if ((month == 2) && (leap == 1) && (day > 29)) 
			 {   err = 23;   }

             if ((month == 2) && (leap != 1) && (day > 28)) 
			 {  err = 24;  }

             /* Validation of other months */
             if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) 
			 {  err = 25;   }

             if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) 
			 { err = 26;  }

             /* if 00 ist entered, no error, deleting the entry */
             if ((day == 0) && (month == 0) && (year == 00)) 
			 {
               err = 0; day = ""; month = ""; year = ""; seperator = "";
             }

             /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
             if (err == 0) 
			 {
               DateField.value = day + seperator + month + seperator + year;
			   return true;
             }

             /* Error-message if err != 0 */
             else 
			 {
               alert("Date is incorrect!");
			   DateField.value = "";
               DateField.select();
			   return false;
             }
}  // end check_date


function check_time(fieldTime) 
{
  // Checks if time is in HH:MM:SS AM/PM format.
  // The seconds and AM/PM are optional.
  var timeStr = fieldTime.value;
  var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;

  var matchArray = timeStr.match(timePat);
 
  // No matter the time format entered, it will be transformed to standard format
  var BoolStdTime = 1;
  
  if (matchArray == null)
  {
    alert("Time is not in a valid format.");
    return false;
  }
  hour = matchArray[1];
  minute = matchArray[2];
  second = matchArray[4];
  ampm = matchArray[6];

  if (second=="") { second = null; }
  if (ampm=="") { ampm = null }

  if (hour < 0  || hour > 23) 
  {
    alert("Hour must be between 1 and 12. (or 0 and 23 for military time)");
    return false;
  }
  if (hour <= 12 && ampm == null) 
  {
    if (confirm("Please indicate which time format you are using.  OK = Standard Time, CANCEL = Military Time")) 
	{
      alert("You must specify AM or PM.");
      return false;
    }
	else
	{
	  BoolStdTime = 0;
	}
  }
  if  (hour > 12 && ampm != null) 
  {
    alert("You can't specify AM or PM for military time.");
    return false;
  }
  if (minute<0 || minute > 59) 
  {
    alert ("Minute must be between 0 and 59.");
    return false;
  }
  if (second != null && (second < 0 || second > 59)) 
  {
    alert ("Second must be between 0 and 59.");
    return false;
  }
  
  if ( BoolStdTime = 0 )
  {
    // Call the function to transform it to standard time
	var newHour;
	hour = ChangeTimeFormat(hour);
	field.value = hour + ":" + minute + ":" + ampm;
  }
  return true;
}  // end-CheckTime


function ChangeTimeFormat(hourStr)
{
  switch (hourStr)
  {
    case 13:
	  return 01;
    case 14:
	  return 02;
    case 15:
	  return 03;
	default:
	  return hourStr;
  }
}  // end check_time


// Checks the extension of the file submitted exists
// in the array of allowed extensions for picture files
// returns true if the extension is allowed
// false, otherwise
function check_filename(fileName) 
{
  var allowSubmit = false;
  var ext;
  
  if (!fileName)
    return allowSubmit;
  
  while ( fileName.indexOf("\\") != -1 )
  fileName = fileName.slice(fileName.indexOf("\\") + 1);
  ext = fileName.slice(fileName.indexOf(".")).toLowerCase();
  
  for (var i = 0; i < allowedExtArray.length; i++) 
  {
    if (allowedExtArray[i] == ext) 
    {   
      allowSubmit = true; 
	  break;  
    }
  }  // end-for
  
  if (allowSubmit)
      return true;
  else
  {
    alert("Please only upload files that end in types:  " 
    + (allowedExtArray.join("  ")) + "\nPlease select a new "
    + "file to upload and submit again.");
	return false;
  }  // end-else
}



// Checks the extension of the file submitted exists
// in the array of allowed extensions for
// Publication files
// returns true if the extension is allowed
// false, otherwise
function check_pubFilename(fileName, fileType) 
{
// fileType Values:
//  "ps" --> check for postscript
// "pdf" --> check for 
 
  var allowSubmit = false;
  var ext;
  
  if (!fileName)
    return allowSubmit;
  
  while ( fileName.indexOf("\\") != -1 )
  fileName = fileName.slice(fileName.indexOf("\\") + 1);
  ext = fileName.slice(fileName.indexOf(".")).toLowerCase();

  if ( fileType == "ps" )
  {
   for (var i = 0; i < psExtArray.length; i++) 
   {
    if (psExtArray[i] == ext) 
    {   
      allowSubmit = true; 
	  break;  
    }
   }  // end-for
  }
  else
  {
   for (var i = 0; i < pdfExtArray.length; i++) 
   {
    if (pdfExtArray[i] == ext) 
    {   
      allowSubmit = true; 
	  break;  
    }
   }  // end-for
  }
  
  if (allowSubmit)
      return true;
  else
  {
    alert("Please only upload files that end in the types specified.  " 
    + "\nPlease select a new "
    + "file to upload and submit again.");
	return false;
  }  // end-else
}





// Checks for the value sent not to be equals to blank
// Returns true if the value is blank, false otherwise
function IsBlank(str)
{
  // Return true if name field is blank.
  if (str == "")
    return true;
  else
    return false;
} // end Function IsName


// Checks that the value sent follows the format of an email address
// that is: 
// at least one character followed by the symbol '@' at least on character
// followed by the symbol '.'
function check_email(str)
{
//  var str=form.SeminarHost.value;
  var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
  if ( !(filter.test(str)) )
  {
    alert("Please input a valid email address!");
    return false;
  }
  else
    return true;
}


function check_onlychars(str)
{
  var Result = true;
  // Return false if characters are not a-z, A-Z, or a space.
  for (var i = 0; i < str.length; i++)
  {
    var ch = str.substring(i, i + 1);
    if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') 
    {
      Result = false;
    }
  } // end-for
  if (!Result)
  {
    alert("\nName must only contain letters & spaces.\nPlease re-enter your name.");
  }
  return Result;
} // end Function IsName



function openPopup(title, title2,  context)
{
   popupWindow = this;
   popupWindow = window.open("_blank","MyWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised,width=600,height=300");
   popupWindow.document.open(); 
   popupWindow.document.write("<H2>" + title + "</H2><H3>" + title2 + "</H2><p/>" + context); 
   popupWindow.document.write("<br/> <br/><center><form> <input type='button' value = 'Close Window' onClick = 'window.close()'></form>");  
   popupWindow.document.close(); 
}


var calendarWindow = null;
var calendarColors = new Array();
calendarColors['bgColor'] = '#BDC5D0';
calendarColors['borderColor'] = '#333366';
calendarColors['headerBgColor'] = '#143464';
calendarColors['headerColor'] = '#FFFFFF';
calendarColors['dateBgColor'] = '#8493A8';
calendarColors['dateColor'] = '#004080';
calendarColors['dateHoverBgColor'] = '#FFFFFF';
calendarColors['dateHoverColor'] = '#8493A8';
var calendarMonths = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var calendarWeekdays = new Array('S', 'M', 'T', 'W', 'T', 'F', 'S', 'S');
var calendarUseToday = true;
var calendarFormat = 'd/m/y';
var calendarStartMonday = true;

// }}}
// {{{ getCalendar()

//function getCalendar(in_dateField) 
function getCalendar(in_dayField, in_monthField, in_yearField) 
{
    if (calendarWindow && !calendarWindow.closed) 
    {
        try {
            calendarWindow.focus();
        }
        catch(e) {}
        
        return false;
    }

    var cal_width = 415;
    var cal_height = 310;

    // IE needs less space to make this thing
    if ((document.all) && (navigator.userAgent.indexOf("Konqueror") == -1) && (navigator.userAgent.indexOf("Mozilla") == -1)) {
        cal_width = 410;
    }

//    calendarTarget = in_dateField;
    calendarDayTarget = in_dayField;
    calendarMonthTarget = in_monthField;
    calendarYearTarget = in_yearField;
    calendarWindow = window.open('../templates/calendar.html',
    'dateSelectorPopup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,dependent=no,width='+cal_width+',height='+cal_height);
//alert(calendarYearTarget.value + " " + calendarYearTarget.length);
    return false;
}

// }}}
// {{{ killCalendar()

function killCalendar() 
{
    if (calendarWindow && !calendarWindow.closed) {
        calendarWindow.close();
    }
}

// }}}


/* functions to fill the calendar for the Publications Date */

function populate(myform, myIndex)
{
  // alert(myform + " " + myIndex);
 // alert(document.publicationsForm.myIndex.value);
//  alert(document.publicationsForm.year.options[myIndex].text);
  timeA = new Date(myform.year.options[myform.year.selectedIndex].text, 
myform.month.options[myform.month.selectedIndex].value, 1);

  timeDifference = timeA - 86400000;
  timeB = new Date(timeDifference);
  var daysInMonth = timeB.getDate();
  
  for ( var i = 0; i < myform.day.length; i++ )
  {
    myform.day.options[0] = null;
  }

  for ( var j = 0; j < daysInMonth; j++ )
  {
    myform.day.options[j] = new Option(j+1);
    //alert(publicationsForm.day.options[j]);
  }

  //document.publicationsForm.day.options[0].selected="true";
  myform.day.options[0].selected="true";
}


//function fillLanguagesPublications()
//{ 
  //for (i=0; i < languagesArray.length; i++)
  //{
    //document.publicationsForm.languagePub.options[i] = new Option(languagesArray[i]);
  //}
  //document.publicationsForm.languagePub.options[0].selected = "true";
//}


function ShowBib(key, typePublication, author, editor, title, booktitle, 
		pages, year, month, address, journal, volume, number,
		url, ee, cdroom, cite,
		publisher, note, isbn, series, school, chapter, 
                efile)
{
//  alert("in showbib");

   /* opens a new window */
   detailWindow =
   window.open("_blank","MyWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,alwaysRaised,width=700,height=500");
   detailWindow.document.open();

  	 var AddInfo = "<body bgcolor='FFFFFF'>";
  	 AddInfo += "<pre>";
	 AddInfo += "@" + typePublication + "{" + key +"," + "<br/>";
	 if (author != "")
	 {
	   // parse all authors
	 }
	 
	 if ( editor != "" )
	 {
	   // parse all editors and print them
	 }
	 
	 if ( title != "" )
	 {
	   AddInfo += "title     = "  + "\"{" + title + "}\"" + "<br/>";
	 }

	 if ( booktitle != "" )
	 {
	   AddInfo += "booktitle = "  + "\"{" + booktitle + "}\"" + "<br/>";
	 }

	 if ( pages != "" )
	 {
	   AddInfo += "pages     = " +  "\"{" + pages + "}\"" + "<br/>";
	 }

	 if ( year != "" )
	 {
	   AddInfo += "year      = " +  "\"{" + year + "}\"" + "<br/>";
	 }

	 if ( month != "" )
	 {
	   AddInfo += "month     = " +   "\"{" + month + "}\"" + "<br/>";
	 }

	 if ( address != "" )
	 {
	   AddInfo += "address   = " +   "\"{" + address + "}\"" + "<br/>";
	 }

	 if ( journal != "" )
	 {
	   AddInfo += "journal   = " +   "\"{" + journal + "}\"" + "<br/>";
	 }

	 if ( volume != "" )
	 {
	   AddInfo += "volume    = " +   "\"{" + volume + "}\"" + "<br/>";
	 }

	 if ( url != "" )
	 {
	   AddInfo += "url       = " +   "\"{" + url + "}\"" + "<br/>";
	 }

	 if ( ee != "" )
	 {
	   AddInfo += "ee        = " +   "\"{" + ee + "}\"" + "<br/>";
	 }

	 if ( cdroom != "" )
	 {
	   AddInfo += "cdroom    = " +   "\"{" + cdroom + "}\"" + "<br/>";
	 }

	 if ( cite != "" )
	 {
	   AddInfo += "cite      = " +   "\"{" + cite + "}\"" + "<br/>";
	 }

	 if ( publisher != "" )
	 {
	   AddInfo += "publisher = " +   "\"{" + publisher + "}\"" + "<br/>";
	 }

	 if ( note != "" )
	 {
	   AddInfo += "note      = " +   "\"{" + note + "}\"" + "<br/>";
	 }

	 if ( isbn != "" )
	 {
	   AddInfo += "isbn      = " +   "\"{" + isbn + "}\"" + "<br/>";
	 }


	 if ( series != "" )
	 {
	   AddInfo += "series    = " +   "\"{" + series + "}\"" + "<br/>";
	 }

	 if ( school != "" )
	 {
	   AddInfo += "school    = " +   "\"{" + school + "}\"" + "<br/>";
	 }

	 if ( chapter != "" )
	 {
	   AddInfo += "chapter   = " +   "\"{" + chapter + "}\"" + "<br/>";
	 } 
	 
	 if ( efile != "" )
	 {
	   AddInfo += "efile     = " +   "\"{" + efile + "}\"" + "<br/>";
	 }
	 
         AddInfo += "}" + " <br/>  <br/>";
  	 AddInfo += "</pre> ";
         AddInfo += "<center>";
         AddInfo += "<form> <input type='button' value = 'Close Window' onClick = 'window.close()'>";
         AddInfo += " </form>";  
         AddInfo += "</center> ";

	 AddInfor += "</body> ";
   detailWindow.document.write(AddInfo);
   detailWindow.document.close();

}
