$(document).ready(function() 
    {
        /*$("#nav_1").hover(function() 
        { 
            $(this).find("ul.subnav").show();

            $(this).hover(function() 
            {
                }, 
                function() 
                {
                    $(this).find("ul.subnav").hide();
                });

        }).hover(function() {
            $(this).addClass("subhover");
        }, function() {
            $(this).removeClass("subhover");
        });
        /*
        $("#mainNav div.navElement a").hover(function() { 
            $(this).parent().parent().find("div").addClass('white');	
        }, function () {
            $(this).parent().parent().find("div").removeClass('white');	
        });
        $("#mainNav div.selected a").hover(function() { 
            $(this).parent().parent().find("div").css("color", "#FFF");	
        }, function () {
            $(this).parent().parent().find("div").css('color', "#666");	
        });
        */
        if($("#searchBox").length > 0)
            $("#searchBox").autofill({
                value: "Search...",
                defaultTextColor: "#000",
                activeTextColor: "#000"
            });
	
        if($(".tipMe").length > 0)
            $(".tipMe").tooltip({
                relative:true, 
                effect: 'fade'
            }).dynamic({
                bottom:{
                    direction:'down',
                    bounce:true
                }
            });
    $("#bugBox div").click(function() {
        window.location.replace("http://www.2wire.com");
    });
    $("#bugBox").bind("contextmenu", function(e) {
        e.preventDefault();
    });
}
);


function toggleDiv(id)
{
    var div = $("#"+id+"_content");
    if(div.css('display') == "none")
    {
        div.show();
        var img = $("#"+id+"_a");
        img.attr("src", "/imgs/minus.png");	
        $("#"+id+"_prs h3 span").css('font-weight', 'bold');
    }
    else
    {
        div.hide();
        var img = $("#"+id+"_a");
        img.attr("src", "/imgs/plus.png");
        $("#"+id+"_prs h3 span").css('font-weight', 'normal');		
    }
}

function MoveOption(objSourceElement, objTargetElement)
{
    objTargetElement.append(objSourceElement.children(":selected"));
    objTargetElement.html(objTargetElement.children('option').sort(function (a, b) {
        return a.text == b.text ? 0 : a.text < b.text ? -1 : 1;
    }));
    objSourceElement.html(objSourceElement.children('option').sort(function (a, b) {
        return a.text == b.text ? 0 : a.text < b.text ? -1 : 1;
    }));
}

function toHiddenInput(source, dest)
{
    var length = $(source + " option").length - 1;
    var options = $(source + " option");
    var icount = 1;
	
    for(length; length > -1; length--)
    {
		
        if(icount == 1)
            $(dest).attr('value', options[length].value);
        else
            $(dest).attr('value', options[length].value + "," + $(dest).attr('value')); 
        icount++;
		
    }		
}

function SubmitForm(form)
{
    toHiddenInput("#newRelatedItems", "#hRelated");
    toHiddenInput("#relatedPress", "#hRelatedPress");
    toHiddenInput("#relatedNews", "#hRelatedNews");

    form.submit();
}

function enlargeswf()
{
    $("#homePage div#header").css("z-index", "2");
    $("#homePage div#homeFeatures").css("z-index", "2");
}


function reduceswf()
{
    $("#homePage div#header").css("z-index", "10");
    $("#homePage div#homeFeatures").css("z-index", "10");
}


