var activeSub=0;
var SubNum=0;


function menu_admissions() {
	MM_goToURL('parent', 'admissions.html');		
	return document.MM_returnValue;
}
function menu_contact_us() {
	MM_goToURL('parent', 'contact_us_overview.html');		
	return document.MM_returnValue;
}
function menu_home() {
	MM_goToURL('parent', 'index.html');		
	return document.MM_returnValue;
}
function menu_browse_by_city() {
	MM_goToURL('parent', 'browse_by_city.html');		
	return document.MM_returnValue;
}
function menu_care_overview() {
	MM_goToURL('parent', 'care_overview.html');		
	return document.MM_returnValue;
}
function menu_mgmt() {
	MM_goToURL('parent', 'management.html');		
	return document.MM_returnValue;
}
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 reDo() { 
    window.location.reload() 
}

    window.onresize = reDo;

    //Define global variables
    var timerID = null;
	var timerOn = false;
	var timecount = 1000;
	var what = null;
	var newbrowser = true;
	var check = false;

function init() {
	//  alert ("Running Init");
      if (document.layers) {
        //  alert ("Running Netscape 4");
        layerRef="document.layers";
        styleSwitch="";
        visibleVar="show";
		screenSize = window.innerWidth;
		what ="ns4";
    } else if(document.all){
        //  alert ("Running IE");
        layerRef="document.all";
        styleSwitch=".style";
        visibleVar="visible";
		screenSize = document.body.clientWidth + 18;
		what ="ie";
    } else if (document.getElementById) {
        //  alert ("Running Netscape 6");
        layerRef="document.getElementByID";
        styleSwitch=".style";
        visibleVar="visible";
		what="moz";
	} else {
	  	//alert("Older than 4.0 browser.");
		what="none";
		newbrowser = false;
	}
	  
	window.status='Southwest LTC';
	check = true;
}

// Turns the layers on and off
function showLayer(layerName){
	if (check) {
		if (what =="none") {
			return;
		}
    	else if (what == "moz") {
			document.getElementById(layerName).style.visibility="visible";
		}
		else {
          eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
         }
    }
	else {
	    // alert ("Please wait for the page to finish loading.");
		return;
	}
}

function hideLayer(layerName) {
	if (check) {
		if (what == "none") {
			return;
		}
		else if (what == "moz") {
			document.getElementById(layerName).style.visibility="hidden";
		}
		else {
          eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
		}
	}
	else {
	    // alert ("Please wait for the page to finish loading.");
		return;
	}
}

function hideAll(){
	hideLayer('layer1');
	hideLayer('layer2');
	hideLayer('layer3');
	//hideLayer('layer4');
	//hideLayer('layer5');
	//hideLayer('layer6');
	//hideLayer('layer7');
    //hideLayer('layer8');
}

function startTime() {
    if (timerOn == false) {
        timerID=setTimeout( "hideAll()" , timecount);
        timerOn = true;
    }
}

function stopTime() {
    if (timerOn) {
        clearTimeout(timerID);
        timerID = null;
        timerOn = false;
    }
}

function onLoad() {
	init();
}

function openPdf(docName) {
    if (docName != null) {
        var new_window = window.open("", "pdf");
        //new_window.document.location = docName;
        new_window.location.href = docName;
    }
    return false;
}

function submitFacility() {
    //alert ("submitFacility()");
    var id = document.frmMain.dlRegion.value;
    if (id == "0") {
        id = document.frmMain.dlCity.value;
        javascript:jumpToFacility(id);
    }
    else {
        javascript:jumpToRegion(id);
    }
}

function jumpToFacility(id) {
    //alert ("jumpToFacility()");
    switch (id) {
        case "1":
            window.location = "./meadowview.html";
            break;
            
        case "2":
            window.location = "./green-oaks.html";
            break;
        
        case "3":
            window.location = "./brady-west.html";
            break;
        
        case "4":
            window.location = "./crane.html";
            break;
        
        case "5":
            window.location = "./whitehall.html";
            break;
        
        case "6":
            window.location = "./whispering-oaks.html";
            break;
        
        case "7":
            window.location = "./park-manor.html";
            break;
        
        case "8":
            window.location = "./ghc-galveston.html";
            break;
        
        case "9":
            window.location = "./granbury-villa.html";
            break;
        
        case "10":
            window.location = "./river-hills.html";
            break;
        
        case "11":
            window.location = "./avalon-kirbyville.html";
            break;
        
        case "12":
            window.location = "./heritage-house.html";
            break;
        
        case "13":
            window.location = "./ghc-portarthur.html";
            break;
        
        case "14":
            window.location = "./sanpedro.html";
            break;
        
        case "15":
            window.location = "./ghc-texascity.html";
            break;
        
        case "16":
            window.location = "./tomball.html";
            break;
        
        case "17":
            window.location = "./avalon-trinity.html";
            break;
        
        case "18":
            window.location = "./avalon-wharton.html";
            break;
        
        case "19":
            window.location = "./winfield.html";
            break;
            
        default:
            alert ("jumpToFacility() default value=" + id);
            break;
    }
}

function jumpToRegion(id) {
    //alert ("jumpToRegion()");
    switch (id) {
        case "1":
            window.location = "./region-dfw.html";
            break;
            
        case "2":
            window.location = "./region-houston.html";
            break;
        
        case "3":
            window.location = "./region-sanantonio.html";
            break;
        
        case "4":
            window.location = "./region-westtexas.html";
            break;
        
        default:
            alert ("jumpToRegion() default value=" + id);
            break;
    }
}
