/* Teaser Text */
var sTimeInterval, p = 0, thisS, thisA, sTimeIntervalA;

function slideWithWait() {
    $(thisS).animate({ height: '130px' }, 500);
    $(".expendArrow", $(thisS).parent()).animate({ top: '130px' }, 500);
}
function slideWithWaitArrow() {

    if ($("div.tiser", $(thisA).parent()).css('height') == '52px') {
        $("div.tiser", $(thisA).parent()).animate({ height: '130px' }, 500);
        $(".expendArrow", $(thisA).parent()).animate({ top: '130px' }, 500);
    }

}

$(document).ready(function() {
    $("[id$='txtFindFast']").val("keyword");
    $("[id$='txtFindFast']").focus(function() {
        if ($(this).val() == "keyword")
            $(this).val("");
    });
    $("[id$='txtFindFast']").blur(function() {
        if ($(this).val() == "")
            $(this).val("keyword");
    });
});

$(document).ready(function() {



    /* search inactive and active functionality*/


    $("#search-main-wrapper fieldset .entryBox").focus(function() { $("a", $(this).parent('.search-input')).addClass("ActSearch"); })
    $("#search-main-wrapper fieldset .entryBox").blur(function() { $("a", $(this).parent('.search-input')).removeClass("ActSearch"); });


    /* search expand / collaspe code*/


    $("div.tiser").hover(function() { thisS = this; sTimeInterval = setTimeout("slideWithWait()", 200); }, function() { clearTimeout(sTimeInterval); $(this).animate({ height: '52px' }, 500); $(".expendArrow", $(this).parent()).animate({ top: '53px' }, 500); });


    $(".expendArrow").hover(function() { thisA = this; sTimeIntervalA = setTimeout("slideWithWaitArrow()", 200); }, function() { clearTimeout(sTimeIntervalA); })

    /*end here*/

    /*note book expand / collaspe code*/
    var count = 0;
    $(".expColSearchB").click(function() {
        if (count == 0) {
            $(this).parents(".popularSearches").addClass("searchE"); count = 1;
            trackLink('Popular Searches', 'Expand', location.pathname.toLowerCase(), false);
        } else {
            $(this).parents(".popularSearches").removeClass("searchE"); count = 0;
            trackLink('Popular Searches', 'Collapse', location.pathname.toLowerCase(), false);
        } return false;
    });
    $(".popularSearches").hover(function() { }, function() { $(this).removeClass("searchE"); count = 0; });

    var noteCount = 0;
    $(".my-notebook h4 a").click(function() {
        if (noteCount == 0) { $(this).parents("h4").addClass("myNoteE"); noteCount = 1; } else
        { $(this).parents("h4").removeClass("myNoteE"); noteCount = 0; }; return false;
    });
    $(".my-notebook h4").hover(function() { }, function() { $(this).removeClass("myNoteE"); noteCount = 0; });
    /*end here*/

    /*room ideas tab code*/

    $(".roomIdeasTab a").click(function() {
        $(".roomIdeasTab a").removeClass("actT");
        $(this).addClass("actT");
        $(".byRoomDesc, .byColorDesc").css("display", "none");
        $("." + $(this).attr("rel")).css("display", "block");
        return false;
    });



    var check = 0;


    if (($(".proLinks.diy_proLinks").height()) >= 30) {
        $(".proLinks").css("height", "28px");
        $("a#expand_project").show();
    }

    $("a#expand_project").click(function() {
        if (check % 2 == 0) {
            $(".proLinks,.diy_proLinks").css("height", "auto");
            $(this).html("less").removeClass("expand_pro").addClass("close_pro");
            check = 1;
        } else {
            $(".proLinks").css("height", "28px");
            $(this).html("more").addClass("expand_pro").removeClass("close_pro");
            check = 0;
        }
        return false;
    });

});

function HideControl(controlID) {
    $("#" + controlID).hide();
    return false;
}

$(document).ready(function() {
    var len,
    my_class,
    i,
    flag = 1,
    active_class = false,
    c_id,
    control_id,
    chk = 0;

    $(".hoverMe").hover(function() {
        my_class = $(this).attr("class");
        control_id = $(this).attr("id");
        if (control_id)
            chk = 1;
        else
            chk = 0;

        my_class = my_class.split(" ");
        len = my_class.length;
        for (i = 0; i < len; i++) {
            if (my_class[i].indexOf('hover_-') > -1) {
                if (flag == 1) {
                    active_class = my_class[i];
                    flag = 0;
                }
                c_id = active_class.split("_-");
                c_id = c_id[1];
                if (chk == 0)
                    $("#" + c_id + " ." + my_class[i] + "_text").show();
            }
        }
    }, function() {
        if (active_class) {
            $("#" + c_id + " ." + active_class + "_text").css("display", "none"); ;
            flag = 1;
        }
    });

    $(".hoverMe").click(function() {
        $(this).parents("#" + c_id).css("display", "none");
        $("#overlay_back").hide();
        return false;
    });

	$(window).resize(function() {
        hide_showbox(box_id1, box_status1, flag1);
    });	

});
var box_id1, box_status1, flag1;

function hide_showbox(box_id, box_status, flag) {
	box_id1 = box_id;
	box_status1 = box_status;
	flag1 = flag;

    var hypJoinNow = document.getElementById($("*[id$=hypJoinNowOverlay]").attr("id"));
    var hidReturnUrl = document.getElementById($("*[id$=_hidReturnUrlOverlay]").attr("id"));
    var hidRegistrationSrc = document.getElementById($("*[id$=hidRegistrationSrcOverlay]").attr("id"));
    $("*[id$=hidFlagValueOverlay]").attr("value", flag);
    hypJoinNow.href = hidRegistrationSrc.value.replace("Flag=None", "Flag=" + escape(flag));
    var scnWid,
    scnHei;
    if (self.innerHeight) {
        scnWid = self.innerWidth;
        scnHei = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        scnWid = document.documentElement.clientWidth;
        scnHei = document.documentElement.clientHeight;
    } else if (document.body) {
        scnWid = document.body.clientWidth;
        scnHei = document.body.clientHeight;
    }
    $("#overlay_back").height(scnHei);
    $("#overlay_back").width(scnWid - 20);
    lTop = 0;
    if ($.browser.msie && ($.browser.version).indexOf("6.0") > -1) {
        var lTop = document.documentElement.scrollTop;
        if ($.browser.safari) {
            lTop = document.body.scrollTop;
        }
    }
    $("#" + box_id).css("top", lTop + (scnHei - $("#" + box_id).height()) / 2);
    $("#" + box_id).css("left", (scnWid - $("#" + box_id).width()) / 2);
    if (box_status) {
        $("#overlay_back").show();
        $("#" + box_id).show();
    } else {
        $("#" + box_id).hide();
        $("#overlay_back").hide();
    }
    

    if ($.browser.msie && ($.browser.version).indexOf("6.0") > -1) {
        $(window).scroll(function() {
            lTop = document.documentElement.scrollTop;
            if ($.browser.safari) {
                lTop = document.body.scrollTop;
            }
            $("#" + box_id).css("top", lTop + (scnHei - $("#" + box_id).height()) / 2);
        });
    }
}

function SetValues(postId) {
    $("*[id$=hdnPostId]").val(postId);
}




