<!--
//************ Start Default Commands ************
var h = "hidden";
var v = "visible";
var graphic = "";   
var isNS4 = 0; var isIE4 = 0; var isNS6 = 0; var isNew = 0;
var docObj, styleObj, currObj, cstyleObj;
var bVer = (parseInt(navigator.appVersion));
var bName = navigator.appName;
var brow = ((navigator.appName) + (parseInt(navigator.appVersion)));
if (bName == "Netscape" && bVer >= 3) version = "js";
else if (bName == "Microsoft Internet Explorer" && bVer >= 4) version = "js";
else if (bName == "Netscape" && bVer == 2) version = "no";
else if (bName == "Microsoft Internet Explorer" && bVer >= 2) version = "no";
if (parseInt(navigator.appVersion >= 5)){isNew = 1}
else if (brow == "Netscape4") {isNS4 = 1;}
else if (brow == "Netscape5") {isNS6 = 1;}
else if (brow == "Microsoft Internet Explorer4") {isIE4 = 1;}
				
if (isNS4||isNS6||isIE4||isNew) {
  if(isNS4){ docObj = "document."; }
  else if(isNS6){ docObj = "document.getElementById('"; }
  else { docObj = "document.all."; }
  if(isNS4){ styleObj = ""; }
  else if(isNS6){ styleObj = "').style"; }
  else { styleObj = ".style"; }
  
  if(isNS4){ cstyleObj = ""; }
  else if(isNS6){ cstyleObj = "').currentStyle"; }
  else { cstyleObj = ".currentStyle"; }
}
function getQuery(val){
  var querystring = location.search.substring(1,location.search.length);
  var o = "";
  var tSec = querystring.indexOf(val+"=");
  var tStr = querystring.substring( (tSec+(val.length+1)),querystring.length);
  
  if(tSec != -1){
    if(tStr.indexOf('&') != -1){
      o = tStr.substring(0,tStr.indexOf('&'));
    } else {
      o = tStr;
    }
  }
  return o;
}
function replaceSubstring(s,f,w){
  rtn = "";
  flg = 0;
  
  for(i = 0; i < s.length; i++){
    if(s.substr(i,f.length) == f){
      rtn += w;
      i += (f.length - 1);
    } else {
      rtn += s.charAt(i);
    }
  }
  
  return (rtn);
}
function writeFlash(fName,bg,w,h){
  if( (navigator.appName == "Netscape") && (parseInt(navigator.appVersion) <= 4) ){
    document.write('<embed src="' + fName + '" quality="high" bgcolor="#' + bg + '" WIDTH="' + w + '" HEIGHT="' + h + '" NAME="header" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />');
  } else {
    document.write('<OBJECT data="' + fName + '" width="' + w + '" height="' + h + '" id="header" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" codetype="application/x-shockwave-flash">');
    document.write(' <PARAM NAME="movie" VALUE="' + fName + '" />');
    document.write(' <PARAM NAME="quality" VALUE="high" />');
    document.write(' <PARAM NAME="bgcolor" VALUE="#' + bg + '" />');
    document.write('</OBJECT>');
  }
}
function openPopup(URL,id,width,height){
  window.open(URL, id, "toolbar=no,location=no,width="+width+",height="+height+",status=yes,scrollbars=yes,scrolling=yes,menubar=no,resizable=yes");
}
function openPopupLocked(URL,id,width,height){
  window.open(URL, id, "toolbar=no,location=no,width="+width+",height="+height+",status=no,scrollbars=yes,scrolling=yes,menubar=no,resizable=no");
}
function openPopupNo(URL,id,width,height){
  window.open(URL, id, "toolbar=no,location=no,width="+width+",height="+height+",status=no,scrollbars=no,scrolling=no,menubar=no,resizable=no");
}
function openPopupTB(URL,id,width,height){
  window.open(URL, id, "toolbar=yes,location=no,width="+width+",height="+height+",status=yes,scrollbars=yes,scrolling=yes,menubar=no,resizable=yes");
}
function goPage(u){
  location.href = u;
}
function layerChange(tmpLayer,tmpVisible) {
  if (isNS4||isNS6||isIE4||isNew) { eval(docObj + tmpLayer + styleObj + '.visibility = ' + tmpVisible) }
}
function displayChange(tmpLayer,tmpVisible) {
  if (isNS4||isNS6||isIE4||isNew) { eval(docObj + tmpLayer + styleObj + '.display = "' + tmpVisible + '"') }
}
function rollover(graphic,state) {
  if(state==1){ if (version == "js") { document[graphic].src = "/80256EE9006B7FB0/" + graphic + "_dn.gif" } }
  if(state==0){ if (version == "js") { document[graphic].src = "/80256EE9006B7FB0/" + graphic + "_up.gif" } }
}
function imageover(graphic,filename) {
  if (version == "js") { document[graphic].src = "/80256EE9006B7FB0/" + filename }
}
//************ End Default Commands ************
function homeover(g,s){
  if (version == "js") { document[g + "_i"].src = "/80256EE9006B7FB0/" + g + "_" + s + ".jpg" }
  if (version == "js") { document[g + "_b"].src = "/80256EE9006B7FB0/" + g + "_" + s + ".gif" }
}
function expandMenu(val,n){
  var querystring = location.search.substring(1,location.search.length);
  var old = getQuery(val).length;
  var e = getQuery(val);
  var url = location.href.substring(0,location.href.lastIndexOf('/') + 33);
  if(old > 0){
    if(n == e){
      location.href = url + "?" + querystring.substring(0,querystring.lastIndexOf('&'));
    } else {
      if(querystring.indexOf(val+'=') != -1){
        var pos = querystring.indexOf(val+'=') + (val.length+1);
      } else {
        var pos = querystring.length;
      }
      str = querystring.substring(0,pos) + n + querystring.substring(pos+old, querystring.length);
      location.href = url + "?" + str  + "#" + n;
    }
  } else {
    if(querystring.length > 0){
      location.href += "&expand=" + n  + "#" + n;
    } else {
      location.href = url + "?expand=" + n + "#" + n;
    }
  }
}
function setupExpandCourses() {
  var ex = getQuery('expand');
  var nav = document.getElementById('viewsub' + ex );
  if(nav) nav.className = "view_sub_dt_c_sel";
}
function setupExpand() {
  var ex = getQuery('expand');
  var nav = document.getElementById('viewsub' + ex );
  if(nav) nav.className = "view_sub_dt_sel";
}
function submitCourseFinder(){
  var doc = document._courseFinder;
  if( (doc.Department.selectedIndex == 0) && (doc.Level.selectedIndex == 0) && (doc.Qualification.selectedIndex == 0) && (doc.CourseCode.value == "") ){
    alert('You must enter a search criteria');
  } else {
    doc.submit();
  }
}
function submitQuickSearch(){
  var doc = document._QuickSearch;
  if( (doc.Department.selectedIndex == 0) && (doc.Type.selectedIndex == 0) && (doc.NameEmail.value == "") ){
    alert('You must enter a search criteria');
  } else {
    doc.submit();
  }
}
function reportError(){
  var loc = location.href;
  var url = "/80256EE9006BBD48/httpReportError?OpenForm&url=" + loc;
  openPopup(url,'error','345','335');
}
function reportErrorTO(){
  var loc = location.href;
  location.href = "/80256EE9006BBD48/httpReportError?OpenForm&url=" + loc;
}
function showList(l){
  var disp = new String( eval(docObj + l + styleObj + '.display') );
  var n = l.substring(l.indexOf('_')+1,l.length);
  if(disp == "block" || disp == ""){
    displayChange(l,'none');
    imageover('this_' + n, 'this_' + n + '_up.gif');
  } else {
    displayChange(l,'block');
    imageover('this_' + n, 'this_' + n + '_dn.gif');
  }
}
function showListOut(l,s){
  var n = "list" + l.substring(l.indexOf('_'),l.length);
  var disp = new String( eval(docObj + n + styleObj + '.display') );
  if(disp == "block" || disp == ""){
    imageover(l, l + '_dn.gif');
  } else {
    imageover(l, l + '_up.gif');
  }
}
function emailPerson(n,d){
  location.href = "mailto:" + n + "@" + d;
}
function reloadEvents(){
  var u = location.href;
  var doc = document.forms[0];
  var d = doc.DepartmentV;
  var dept = d.options[d.selectedIndex].value;
  var str = ""
  if( u.indexOf("&dept=") > -1 ){
    str = u.substring(0,u.indexOf("&dept=")) + "&dept=" + dept;
  } else {
    str = u + "&dept=" + dept;
  }
  location.href = str;
}
function launchCalendar(y,m,d,v){
  var dept = document.forms[0].dept.value;
  var url = "/80256EE9006BD68C/(httpPages)/1920BE65C40670A180256EEB006837DE?OpenDocument&count=1000&vd=" + d + "&vm=" + m + "&vy=" + y + "&view=" + v;
  location.href = url;
}
function reloadCalendar(y,m){
  var u = location.href;
  var cy = getQuery('cy');
  var cm = getQuery('cm');
  var str = "";
  if( (cy == "") && (cm == "") ){
    str = u + "&cy=" + y + "&cm=" + m;
  } else if( (cy != "") && (cm != "") ) {
    str = u.substring( 0,u.indexOf('&cy=')) + "&cy=" + y + u.substring( u.indexOf('&cy=')+8,u.length );
    str = str.substring( 0,str.indexOf('&cm=')) + "&cm=" + m + str.substring( str.indexOf('&cm=')+6,str.length );
  }
  location.href = str;
}
function closePrint(){
  if(getQuery("print") == "yes"){
    window.close();
  }
}
function printPage(){
  var domain = "http://www.mcs.open.ac.uk/";
  if(location.href == domain){
    openPopupTB('/80256EE9006BBD48/httpHomepage?ReadForm&print=yes','print','640','480');
  } else {
    if(location.href.indexOf('#') > 0){
      var url = location.href.substring(0,location.href.indexOf('#'));
      openPopupTB(url + '&print=yes','print','640','480');
    } else {
      if(location.href.indexOf('?') > -1){
        openPopupTB(location.href + '&print=yes','print','640','480');
      } else {
        openPopupTB(location.href + '?print=yes','print','640','480');
      }
    }
  }
}
function closePrint(){
  if(getQuery("print") == "yes"){
    window.close();
  }
}
function departmentWebsites(t){
  if(t.selectedIndex > 0){
    if(t.options[t.selectedIndex].value.indexOf('http://') > -1){
      window.open(t.options[t.selectedIndex].value);
    } else {
      window.open("http://" + t.options[t.selectedIndex].value);
    }
  }
}
function submitSearch(){
  doc = document.forms[0];
  qry = replaceSubstring(doc.Query.value,' ','+');
  if(qry != ""){
    location.href = "/80256EE9006BBD48/(Search)?OpenAgent&query=" + qry;
  } else {
    alert('You must enter something to search for')
  }
}
function submitSearchAgain(){
  doc = document.forms[0];
  qry = replaceSubstring(doc.QueryAgain.value,' ','+');
  if(qry != ""){
    location.href = "/80256EE9006BBD48/(Search)?OpenAgent&query=" + qry;
  } else {
    alert('You must enter something to search')
  }
}
function viewTextOnly(){
  var url = "/80256EE9006BBD48/SetTextOnlyCookie?OpenAgent&value=yes&url=" + location.href;
  location.href = url;
}
function viewGraphics(){
  var url = "/80256EE9006BBD48/SetTextOnlyCookie?OpenAgent&value=no&url=" + location.href;
  location.href = url;
}
function submitTOSearch(){
  doc = document.forms[0];
  qry = replaceSubstring(doc.Query.value,' ','+');
  if(qry != ""){
    location.href = "/80256EE9006BBD48/(TextOnlySearch)?OpenAgent&query=" + qry;
  } else {
    alert('You must enter something to search')
  }
}
function updatePublications(t){
  var doc = document.forms[0];
  var ifr = document.getElementById('publications');
  if(t.selectedIndex > 0){
    ifr.src = ("/" + doc.database.value + "/httpPublicationsByAuthorEmbed" + t.options[t.selectedIndex].value + "?ReadForm&author=" + doc.author.value + "&count=10000");
  }
}
function updatePublicationsProject(t){
  var doc = document.forms[0];
  var ifr = document.getElementById('publications');
  if(t.selectedIndex > 0){
    ifr.src = ("/" + doc.database.value + "/httpPublicationsByProjectEmbed" + t.options[t.selectedIndex].value + "?ReadForm&project=" + doc.project.value + "&count=10000");
  }
}
function displayPeople(t){
  var people = t.split('|');
  var str = "";
  for(i = 0; i < people.length; i++){
    var dis = people[i].split('~');
    if( (dis[0].indexOf('_') > -1) || ((dis[0] == "") && (dis[1] == "")) ){
      str += dis[2] + ", ";
    } else {
      str += "<a href=\"/80256EE9006BCA7A/(httpPeople)/" + dis[0] + "?OpenDocument&subsection=" + dis[1] + "\" target=\"_top\">" + dis[2] + "</a>, ";
    }
  }
  str = str.substring(0, (str.length-2));
  document.write( replaceSubstring(str,"^","'") );
}
function collapseEvents(t,i){
  var nav = document.getElementById(t + i);
  if(nav){
    if(nav.style.display == "none"){
      displayChange(t+i,'block');
    } else {
      displayChange(t+i,'none');
    }
  }
}
function openStudyPathway(u){
  var unid1 = document.forms[0].ParentPageUNID.value;
  var unid2 = document.forms[0].ParentPageLevel2UNID.value;
  var subject = document.forms[0].SubjectV.value;
  window.location.href = u + "&unid1=" + unid1 + "&unid2=" + unid2 + "&subject=" + subject 
}
function openRegionalCentre(id){
  var u = document.forms[0].RegCentreURL.value;
  window.open(u + id)
}
function pickDate(yyyy,mm,dd,vt){
  var doc = document.forms[0];
  var sel = doc.SelectedField.value;
  window.opener.document.forms[0].elements[sel].value = dd + "/" + mm + "/" + yyyy;
  window.close();
}
function updateThumbnails(){
  if(document.getElementById('thumb01')){
    if(document.forms[0].ThumbnailUNID.selectedIndex > 0){
      document.getElementById('thumb01').style.display = "block";
    } else {
      document.getElementById('thumb01').style.display = "none";
    }
  }
  if(document.getElementById('large01')){
    if(document.forms[0].LargeImage1UNID.selectedIndex > 0){
      document.getElementById('large01').style.display = "block";
    } else {
      document.getElementById('large01').style.display = "none";
    }
  }
  if(document.getElementById('large02')){
    if(document.forms[0].LargeImage2UNID.selectedIndex > 0){
      document.getElementById('large02').style.display = "block";
    } else {
      document.getElementById('large02').style.display = "none";
    }
  }
  if(document.getElementById('small01')){
    if(document.forms[0].SmallImage1UNID.selectedIndex > 0){
      document.getElementById('small01').style.display = "block";
    } else {
      document.getElementById('small01').style.display = "none";
    }
  }
  if(document.getElementById('small02')){
    if(document.forms[0].SmallImage2UNID.selectedIndex > 0){
      document.getElementById('small02').style.display = "block";
    } else {
      document.getElementById('small02').style.display = "none";
    }
  }
  if(document.getElementById('small03')){
    if(document.forms[0].SmallImage3UNID.selectedIndex > 0){
      document.getElementById('small03').style.display = "block";
    } else {
      document.getElementById('small03').style.display = "none";
    }
  }
}
function checkLength(len,t){
  var cur = (t.value.length)+1;
  if(cur >= len){
    t.value = t.value.substring(0,len);
  }
}
function updateFeedType(t){
  if(getQuery('feedtype') != ""){
    location.href = location.href.substring(0,location.href.indexOf('&feedtype')) + "&feedtype=" + t.options[t.selectedIndex].value;
  } else {
    location.href = location.href + "&feedtype=" + t.options[t.selectedIndex].value;
  }
}
function replacePersonURL(t){
  var url = document.forms[0].PersonURL.value;
  location.href = url + "&feedtype=" + t.options[t.selectedIndex].value;
}
//-->

