﻿// JScript File

function checkValidDigit(t,num)
{
//alert(t.value);
var patt = /(\d{num})/;
var donepatt = /^(\d{num})$/;
var str = t.value;
var result;
if (!str.match(donepatt))
{result = str.match(patt);
if (result!= null)
{t.value = t.value.replace(/[^\d]/gi,'');
str = result[1];
t.value = str;

}else{
if (t.value.match(/[^\d]/gi))
t.value = t.value.replace(/[^\d]/gi,'');}
}}
 function LoadShowcase_index()
    {
    
            document.write('<div id="Container4Seq1Panel166_BannerRotator" class="Rotator" onmouseover="javascript:ShowCaseOnMouseOver();" onmouseout="javascript:ShowCaseOnMouseOut();" style="overflow: hidden; position: relative; height: 235px;">');
            document.write('<div id="Container4Seq1Panel166_BannerRotator_SlideContainer" style="position: relative; visibility: visible; top: 0.5px; left: 0px;">')
                
                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide0">')
                document.write('<a href="/eventscalendar.aspx?id=1152&menu_id=120#FelixVladimir" style="cursor:pointer;"><div id="showcase1_index"></div></a>')
                document.write('</div>')
                
                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide1">')
                document.write('<a href="/heartaware.htm"  style="cursor:pointer;"><div id="showcase2_index"></div></a>')
                document.write('</div>')
                
                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide2">')
                document.write('<a href="/eventscalendar.aspx?id=1152&menu_id=120#DavidBucher"  style="cursor:pointer;"><div id="showcase3_index"></div></a>')
                document.write('</div>')
                
                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide3">')
                document.write('<a href="/eventscalendar.aspx?id=1152&menu_id=120#LanceBear"  style="cursor:pointer;"><div id="showcase4_index"></div></a>')
                document.write('</div>')
                
                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide4">')
                document.write('<a href="/eventscalendar.aspx?id=1152&menu_id=120#RosemaryPeterson"  style="cursor:pointer;"><div id="showcase5_index"></div></a>')
                document.write('</div>')
                
                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide5">')
                document.write('<a href="/eventscalendar.aspx?id=1152&menu_id=120#PatrickVaughan"  style="cursor:pointer;"><div id="showcase6_index"></div></a>')
                document.write('</div>')
                
            document.write('</div>')
            document.write('</div>')
 
    }
    
//     function LoadShowcase_index()
//    {
//    
//            document.write('<div id="Container4Seq1Panel166_BannerRotator" class="Rotator" onmouseover="javascript:ShowCaseOnMouseOver();" onmouseout="javascript:ShowCaseOnMouseOut();" style="overflow: hidden; position: relative; height: 235px;">');
//            document.write('<div id="Container4Seq1Panel166_BannerRotator_SlideContainer" style="position: relative; visibility: visible; top: 0.5px; left: 0px;">')
//                
//                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide0">')
//                document.write('<a href="/services.aspx?id=4496&menu_id=10&submenu_id=56" style="cursor:pointer;"><div id="showcase1_index"></div></a>')
//                document.write('</div>')
//                
//                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide1">')
//                document.write('<a href="/heartaware.htm"  style="cursor:pointer;"><div id="showcase2_index"></div></a>')
//                document.write('</div>')
//                
//                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide2">')
//                document.write('<a href="/eventscalendar.aspx?id=1152&menu_id=120#TisBest"  style="cursor:pointer;"><div id="showcase3_index"></div></a>')
//                document.write('</div>')
//                
//                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide3">')
//                document.write('<a href="/Annual_Report.aspx"  style="cursor:pointer;"><div id="showcase4_index"></div></a>')
//                document.write('</div>')
//                
//                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide4">')
//                document.write('<a href="/sleepaware.htm"  style="cursor:pointer;"><div id="showcase5_index"></div></a>')
//                document.write('</div>')
//                
//                document.write('<div id="Container4Seq1Panel166_BannerRotator_slide5">')
//                document.write('<a href="/FMGClinicDetails.aspx?id=2240&menu_id=624"  style="cursor:pointer;"><div id="showcase6_index"></div></a>')
//                document.write('</div>')
//                
//            document.write('</div>')
//            document.write('</div>')
// 
//    }
 
 function ShowCaseOnMouseOut()
 {
        ns_MsOut(event,'Container4Seq1Panel166_BannerRotator',rco_Container4Seq1Panel166_BannerRotator);
 }
 
 function ShowCaseOnMouseOver()
 {
        ns_MsOver(event,'Container4Seq1Panel166_BannerRotator',rco_Container4Seq1Panel166_BannerRotator);
 }
    

function CheckInches(obj,rfvid)
    {
        try
        {
        var ctl = document.getElementById(obj);
        var req1 = document.getElementById(rfvid);
        //  alert(ctl.value);   
        if (typeof(req1) == "undefined" || req1 == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        
         if(ctl.value > 12)
            {
            
            ValidatorEnable(req1,true);
      
            }
            else
            {
            ValidatorEnable(req1,false);
            req1.enabled = false;
            }
            
            
        }
        catch(e)
        {
            alert("Error :" + e.message + " in CheckInches()");
        }    
    }
    
    function CheckFeet(obj,rfvid)
    {
        try
        {
        var ctl = document.getElementById(obj);
        var req1 = document.getElementById(rfvid);
        //  alert(ctl.value);   
        if (typeof(req1) == "undefined" || req1 == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        
         if((ctl.value ==5) || (ctl.value ==6))
            {
            
            ValidatorEnable(req1,false);
            req1.enabled = false;
      
            }
            else
            {
            ValidatorEnable(req1,true);
            
            }
            
            
        }
        catch(e)
        {
            alert("Error :" + e.message + " in CheckFeet()");
        }    
    }
    
    function HideShow(id1, id2, id3, val)
    {
       
        try
        {
        var tbl1 = document.getElementById(id1);
        var tbl2 = document.getElementById(id2);
        var tbl3 = document.getElementById(id3);
        //  alert(ctl.value);   
        if (typeof(tbl1) == "undefined" || tbl1 == null) return false;
        if (typeof(tbl2) == "undefined" || tbl2 == null) return false;
        if (typeof(tbl3) == "undefined" || tbl3 == null) return false;
        
        //alert(tbl2.style.display);
        if( val == "table1")
        {
            tbl2.style.display = "block";
            tbl1.style.display = "none";
            tbl3.style.display = "none";
        }
        
        if( val == "table2")
        {
            tbl1.style.display = "none";
            tbl3.style.display = "block";
            tbl2.style.display = "none";
        } 
        
        if( val == "table3")
        {
            tbl1.style.display = "block";
            tbl2.style.display = "none";
            tbl3.style.display = "none";
        }     
            
        }
        catch(e)
        {
            alert("Error :" + e.message + " in HideShow()");
        }
    }
    
    function getIdealBodyWeight(feets, inchs, weighs,dispid,id2,id3) {
	//add the values from the questions
	
	var ft = new Number(document.getElementById(feets).value);
	var inc = new Number(document.getElementById(inchs).value);
	var weig = new Number(document.getElementById(weighs).value);
	var tbl2 = document.getElementById(id2);
    var tbl3 = document.getElementById(id3);

	var lowWeight = new Number(0);
	var highWeight = new Number(0);

	if (inc == "") inc = 0;
	if (ft == "") inc = 0;
	if (weig == "") inc = 0;

	if (ft<5 || ft>6){
		//alert('Please enter a numeric value between 5 and 6 for feet.  This calculator is not intended for those individuals who are under 5 feet tall or over 7 feet tall.')
		//top.location = '#calc';
	}else{

		if (ft==0||weig==0) {
			alert('Please complete all calculator fields first.');
			//top.location = '#calc';
		} else {
			if (inc>12) {
				//alert('Inches must be between 0-12.');
				//top.location = '#calc';
			} else {
			
				heightInches = (ft*12)+inc;
				lowWeight = Math.round(18.5 * Math.pow((heightInches*.0254),2) * 2.2);
				highWeight = Math.round(24.9 * Math.pow((heightInches * .0254),2) * 2.2);
				if (weig < lowWeight)
					aboveBelow = "below"
				else
					if (weig > highWeight)
						aboveBelow = "above"
					else
						aboveBelow = "within"
												
				text1 = "Your current weight of " + weig + " pounds is "
				+ aboveBelow + " the healthy body weight range of " 
				+ lowWeight + " - " + highWeight + " pounds for your height of "
				+ ft + " ft " + inc + " in.";
				
				document.getElementById(dispid).innerHTML = text1;
				tbl3.style.display = "block";
                tbl2.style.display = "none";
				document.aspnetForm.reset();
				}
			}
		}
	}
	

    function GammaKnifeXSLT()
    {
    var liId = getQueryStringValue("li");
    if (typeof(liId) == "undefined" || liId == null) return false;    
    hideTheListElement(liId)
    }

    function hideTheListElement(elm)
    {
    var linktext = document.getElementById(elm).style.display = "none";
    if (typeof(linktext) == "undefined" || linktext == null) return false;    
    //document.body.style.cursor="wait";
    }
    function getQueryStringValue(ji)
    {
        hu = window.location.search.substring(1);
        gy = hu.split("&");
        for (i=0;i<gy.length;i++) 
            {
            ft = gy[i].split("=");
            if (ft[0] == ji) 
                {
                return ft[1];
                }
            }
    }
    
    
    