       function highlightcurrent() {

            var breadcrumb="";
           
           
            var sPage = window.location.href
            
            var a = document.getElementsByTagName("a");
            
            for(var i=0;i<a.length;i++) {
              if (a[i].href == sPage) {
                var depth = a[i].className;
                depth = parseInt(depth)-1 ;
                    //if depth > 0 then this is a nav link
                    if (depth >= 0) {
                        //a[i].style.backgroundColor="#ff0000";
                        curdepth=depth;
                        for(var i2=0;i2<=depth;i2++) {
                            parentstring = "parentNode.";
                            for(var i3=0;i3<curdepth;i3++) {
                                parentstring += "parentNode.parentNode.";
                            }            

                           parent1 = eval("a[i]." + parentstring + "childNodes[0]");
                           
                           breadcrumb += " <a href=\"" + parent1.href + "\">" + parent1.innerHTML + "</a> > ";
                           //parent1.style.backgroundColor="#6fa8fd";
                           curdepth=curdepth - 1;  
                        }
                    }
                }
            }
            
           document.getElementById("breadcrumb").innerHTML = breadcrumb;

        }
        function Submit_Search() {
            var obj = document.getElementById("searchtext");
            if (obj.value=="") {
                alert("You must enter a search term");
                return false    
            } else {
            
             if (window.location.href.indexOf("content") > -1) {
                window.location = "../search.aspx?keywords=" + obj.value; 
                } else {
                window.location = "search.aspx?keywords=" + obj.value; 
                }
                return false    
            }
        }


        function checkEnter(e){ //e is event object passed from function invocation
            //var characterCode literal character code will be stored in this variable

            if(e && e.which){ //if which property of event object is supported (NN4)
                e = e
                characterCode = e.which //character code is contained in NN4's which property
            }
            else{
                e = event
                characterCode = e.keyCode //character code is contained in IE's keyCode property
            }

            if(characterCode == 13){ //if character code is equal to ascii 13 (if enter key)
             Submit_Search()
             return false //return false to the event handler
            }
            else{
            return true //return true to the event handler
            } 

        }
        
        
              function checkEnter2(e){ //e is event object passed from function invocation
            //var characterCode literal character code will be stored in this variable

            if(e && e.which){ //if which property of event object is supported (NN4)
                e = e
                characterCode = e.which //character code is contained in NN4's which property
            }
            else{
                e = event
                characterCode = e.keyCode //character code is contained in IE's keyCode property
            }

            if(characterCode == 13){ //if character code is equal to ascii 13 (if enter key)
             window.location='search_inside.aspx?searchfor='+document.getElementById('searchfor').value
             return false //return false to the event handler
            }
            else{
            return true //return true to the event handler
            } 

        }
        
        
                function checkSearch(e) {
        
            if(e && e.which){ //if which property of event object is supported (NN4)
                e = e
                characterCode = e.which //character code is contained in NN4's which property
            }
            else{
                e = event
                characterCode = e.keyCode //character code is contained in IE's keyCode property
            }

            if(characterCode == 13){ //if character code is equal to ascii 13 (if enter key)
             window.location='search.aspx?keywords='+document.getElementById('keyword').value;
             return false //return false to the event handler
             
            }
            else{
             return true //return true to the event handler
            } 
        }
        
        
        
        
        function checkNewsLetter(e) {
        
            if(e && e.which){ //if which property of event object is supported (NN4)
                e = e
                characterCode = e.which //character code is contained in NN4's which property
            }
            else{
                e = event
                characterCode = e.keyCode //character code is contained in IE's keyCode property
            }

            if(characterCode == 13){ //if character code is equal to ascii 13 (if enter key)
             newsletter()
             return false //return false to the event handler
            }
            else{
             return true //return true to the event handler
            } 
        }
        
        
                function checkNewsLetter(e) {
        
            if(e && e.which){ //if which property of event object is supported (NN4)
                e = e
                characterCode = e.which //character code is contained in NN4's which property
            }
            else{
                e = event
                characterCode = e.keyCode //character code is contained in IE's keyCode property
            }

            if(characterCode == 13){ //if character code is equal to ascii 13 (if enter key)
             newsletter()
             return false //return false to the event handler
            }
            else{
             return true //return true to the event handler
            } 
        }
        
        
        

        function newsletter() {
            if (document.getElementById("firstname").value =="") {
            alert('First Name is required');
            document.getElementById("firstname").focus();
            return false;
            }
            else if (document.getElementById("lastname").value =="") {
            alert('Last Name is required');
            document.getElementById("lastname").focus();
            return false;
            }

            else if (document.getElementById("email").value =="") {
            alert('Email Address is required');
            document.getElementById("email").focus();
            return false;
            }
            else if (checkMail(document.getElementById("email").value) == false) {
            alert('Email Address is not valid');
            document.getElementById("email").focus();
            return false;
            
            }
            else {
            document.forms[0].action = "newsletter.aspx";
            document.forms[0].submit();
            return true;
            }
        }


          function checkMail(email)
        {
	        var x = email
	        var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	        if (filter.test(x)) 
	        {
	        return true;
	        }	else {
	        return false;
	        }
        }
        
        function quoteimage() {
            images = new Array(9);
            images[0] = "<img src='images/JB_Quote1.jpg' alt='Jeffrey Bland Quote'>";
            images[1] = "<img src='images/JB_Quote2.jpg' alt='Jeffrey Bland Quote'>";
            images[2] = "<img src='images/JB_Quote3.jpg' alt='Jeffrey Bland Quote'>";
            images[3] = "<img src='images/JB_Quote4.jpg' alt='Jeffrey Bland Quote'>";
            images[4] = "<img src='images/JB_Quote5.jpg' alt='Jeffrey Bland Quote'>";
            images[5] = "<img src='images/JB_Quote6.jpg' alt='Jeffrey Bland Quote'>";
            images[6] = "<img src='images/JB_Quote7.jpg' alt='Jeffrey Bland Quote'>";
            images[7] = "<img src='images/JB_Quote8.jpg' alt='Jeffrey Bland Quote'>";
            images[8] = "<img src='images/JB_Quote9.jpg' alt='Jeffrey Bland Quote'>";

            
            
            index = Math.floor(Math.random() * images.length);
            
            document.getElementById('quoteimage').innerHTML = images[index];
            
        }
        
        function swampimg(img) {
            document.getElementById('ctl00_Content_imgProduct').src = img;
        }
        
        
        function EmbedFlash(
	width,
	height,
	flashFile
)
{
	document.write("<object ");
	document.write("	classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ");
	document.write("	codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" ");
	document.write("	width=\""+width+"\" "); 
	document.write("	height=\""+height+"\" ");
	document.write("	id=\"slideshow\" ");
	document.write("	align=\"middle\" ");
	document.write("	VIEWASTEXT> ");
	document.write("	<param name=\"allowScriptAccess\" value=\"sameDomain\" /> ");
	document.write("	<param name=\"movie\" value=\""+flashFile+"\" /> ");
	document.write("	<param name=\"quality\" value=\"high\" /> ");
	document.write("	<param name=\"bgcolor\" value=\"#ffffff\" /> ");
	document.write("	<embed ");
	document.write("		src=\""+flashFile+"\"");
	document.write("		quality=\"high\" ");
	document.write("		bgcolor=\"#ffffff\" ");
	document.write("		width=\""+width+"\" ");
	document.write("		height=\""+height+"\" ");
	document.write("		name=\"slideshow\" ");
	document.write("		align=\"middle\" ");
	document.write("		allowScriptAccess=\"sameDomain\" ");
	document.write("		type=\"application/x-shockwave-flash\" ");
	document.write("		pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /> ");
	document.write("</object> ");
}
        
        
        function swapimage(url) {
        
        document.getElementById("ctl00_Content_imgProduct").src = url;
        
        }
        
    function license(inurl, inname) {
        var answer = confirm ("Thank you for subscribing to Functional Medicine Update.\n\nYou are about to download a file that has been purchased by " + inname + " and is for individual use only.\n\nFunctional Medicine Update is copyrighted to Jeffrey Bland, PhD.\n\nPress OK to download your file")
        if (answer) {
        window.location=inurl
        }
    }

        
        
        
        //database search
            function sizesearchwin() {
        var viewportwidth;
        var viewportheight;

        // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

        if (typeof window.innerWidth != 'undefined') {
            viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
        }

        // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

        else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0) {
            viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
        }

        // older versions of IE

        else {
            viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
        }


        document.getElementById("searchtoc").style.height = viewportheight - 165 - 40 + "px";
        document.getElementById("content").style.height = viewportheight - 165 + "px";

        document.getElementById("bodymain").style.height = viewportheight + "px";
    }
