﻿
$(document).ready(function () {

    //redirect everyone to .com address since SSL is only registered to that address
    var hostname = new String(location.hostname);
    if (hostname.search(/localhost/) < 0 && (hostname.search(/.com/) < 0 || hostname.search(/www/) < 0)) {
        location.replace('http://www.cdsintexas.com' + location.pathname + location.hash + location.search);
    }

    (function ($, document) {
        $.fn.extend({
            "TreeView": function () {
                return this.each(function () {
                    $("h4", this).next("div").hide();
                    $("h4", this).bind("click", function () {
                        $(this).toggleClass("expanded");
                        $(this).next("div").toggle("slow");
                    });
                });
            }
        });
    })(jQuery, document);
  
});


function SSLredirect() {
    var loc = location.href
    var protocol = location.protocol;
    if (protocol != 'https:' && loc.search(/localhost/) < 0) {
        if (loc.search(/www/) < 0) {
            location.replace(loc.replace('http://', 'https://www.'));
        }
        else {
            location.replace(loc.replace('http', 'https'));
        }
    }
}

function top(){window.location.href = window.location.href.split('#')[0];}

//  DHTML Windows
function FlashPopUpWin(title, url, width, height)
{
    var winwidth = width + 20;
    var winheight = height + 20;
    dhtmlwindow.open(title, "iframe", ('video.htm?link='+url+'&width='+width+'&height='+height), title, "width="+winwidth+"px,height="+winheight+"px,resize=0,scrolling=0,center=1", "recal")
}




