function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  sample=window.open(theURL,winName,features); sample.window.focus();
}



function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function construction () {
     alert("This feature is currently under construction.");
}

function actionNotice() {
     alert("Click the SUBMIT button to see your feedback.");
}


function windowSize () {

var targetheight=460;
var targetwidth=775;

function winWid(){ return (ns4||ns6) ? window.innerWidth : document.body.clientWidth; }
function winHei(){ return (ns4||ns6) ? window.innerHeight : document.body.clientHeight; }
function centerX(){ return (ns4||ns6) ? parseInt((screen.width/2)-(width/2)) : parseInt((screen.availWidth/2)-(width/2)); }
function centerY(){ return (ns4||ns6) ? parseInt((screen.height/2)-(height/2)) : parseInt((screen.availHeight/2)-(height/2)); }
var ns4 = (document.layers) ? 1 : 0;
var ie4 = (document.all) ? 1 : 0;
var ns6 = (document.getElementById && !document.all) ? 1 : 0;
top.resizeTo(targetwidth,targetheight);
var width=winWid();
var height=winHei();
var difx=targetwidth-winWid();
var dify=targetheight-winHei();
width+=(difx*2);
height+=(dify*2);
top.resizeTo(width,height);
top.moveTo(centerX(),centerY());

}




function glossaryplatformDetect()
{
  if(navigator.appVersion.indexOf("Win") != -1)
  {
    MM_openBrWindow('glossary/index.cfm','whatever1','toolbar=no,location=no,status=no,menubar=no,resizable=no,width=550,height=375');
  }
  else if(navigator.appVersion.indexOf("Mac") != -1)
  {
    MM_openBrWindow('glossary/index.cfm','whatever1','toolbar=no,location=no,status=no,menubar=no,resizable=no,width=535 ,height=375');
  }
  else alert("Other");
}


function resourceplatformDetect()
{
  if(navigator.appVersion.indexOf("Win") != -1)
  {
    MM_openBrWindow('resources/index.cfm','whatever1','toolbar=no,location=no,status=no,menubar=no,resizable=no,width=550,height=375');
  }
  else if(navigator.appVersion.indexOf("Mac") != -1)
  {
    MM_openBrWindow('resources/index.cfm','whatever1','toolbar=no,location=no,status=no,menubar=no,resizable=no,width=535 ,height=375');
  }
  else alert("Other");
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external") {
	   	anchor.target = "_blank";
	} else {
	   	anchor.target = "_self";
	}
 }
}

function selectConflict (series, start, end, me) {
var range=end-start; 
	for (var i=0;i<=range;i++) {
		myNum=start+i; 
		idToGet = series+myNum;
		thisEl = document.getElementById(idToGet);
		meEl = document.getElementById(me);
		if ((meEl.value == thisEl.value) && (meEl != thisEl)) {
			thisEl.value = '';
		}
	}
}


function dndFeedback(){
switch(FBLocation){
	case ("FBOnPage"):
		changeClassById("dndPosFb", "on");
		break;
	case ("FBNextPage"):
		pageAdvance("p");
		break;
	}
}// end dndFeedback



function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external") {
	   	anchor.target = "_blank";
	} else {
	   	anchor.target = "_self";
	}
 }
}

function style(pref) {
	document.body.className = pref;
}
window.onload = externalLinks;

function change(id, newClass) {
/* +===============================================================================================================+
   | Given the ID attribute of the desired HTML element and the newClass to which the element should change,       |
   | do just that and assign newClass to the class property of the element ID.                                     |
   +===============================================================================================================+ */

identity=document.getElementById(id);  // This is required for Mozilla-based browsers (including NS)
identity.className=newClass;  // Change the element's class to newClass
} // end change()



 
var ht, wd
ht = screen.height - 75;
wd = screen.width - 10;
var anatomywin
function anatomytv(start,res)
{
 var windopts;
 windopts = "fullscreen=0,top=0,left=0,width=" + wd + ",height=" + ht + ",resizable=0,status=1,maximised=1,toolbar=0,location=0";
 
 if ((!anatomywin) || (anatomywin.closed))
  anatomywin = window.open('http://www.anatomy.tv/default.asp?ref=hk&jumpthrough=yes&startapp='+start+'&startres='+escape(res),'anatomywin', windopts);
 else
 {  
  if (anatomywin.dummy)
   anatomywin.dummy.location='http://www.anatomy.tv/links.asp?jumpthrough=yes&res=' + escape(res);
  else
   anatomywin.top.location = 'http://www.anatomy.tv/default.asp?ref=hk&jumpthrough=yes&startapp='+start+'&startres='+escape(res);
 }
anatomywin.focus();
}

