/// <reference path="jquery-1.2.6-vsdoc.js" />

/*
 * main.js
 * Library: jquery 1.2.6
 * @Author: Eric Freeberg, bswing
 * @Date: 
 */

var ISEEK = {

    tabIds: new Array(),

   init:function()
   {
   		
        ISEEK.setExpandCollapsePane();
        ISEEK.setShareMenu();
        ISEEK.setTipBalloons();
  //     ISEEK.setTabs();
        ISEEK.initSearchPage();		
    }
   ,

   initSearchPage: function()
   {
        if ($("body.search").length > 0)
        {
            $("#keyword-expandable").find("h3 span").addClass("expand"); 
            $("#keyword-expandable").find("h3 span").removeClass("collapse");
                
            var detail = $("#keyword-expandable div.search-subset-content");
            var arrow = $(this).find("span");
            
            if($(detail).css("display") == "none")
            {
                $(arrow).addClass("expand"); 
                $(arrow).removeClass("collapse"); 
                $(detail).slideDown(300);
            }
            else
            {
                $(arrow).addClass("collapse"); 
                $(arrow).removeClass("expand"); 
                $(detail).slideUp(300);
            }
        }
   }
   ,

  setExpandCollapsePane:function()
   {
/*         // common
        $(".sub-info").each(
            function(i){
                $(this).find(".sub-info-detail").css("display","none");
                $(this).find("h3 span").addClass("collapse"); 
                $(this).find("h3 span").removeClass("expand");
                $(this).find("h3").click(
                    function(e){
                        
                        var detail = $(this).next(".sub-info-detail");
                        var arrow = $(this).find("span");
                        
                        if($(detail).css("display") == "none")
                        {
                            $(arrow).addClass("expand"); 
                            $(arrow).removeClass("collapse"); 
                            $(detail).slideDown(300);
                        }
                        else
                        {
                            $(arrow).addClass("collapse"); 
                            $(arrow).removeClass("expand"); 
                            $(detail).slideUp(300);
                        }
                    }
                );
            }
        );
        
*/        // Search
        $(".search-subset").each(
            function(i)
            {
                $(this).find(".search-subset-content").css("display","none");
                $(this).find("h3 span").addClass("collapse"); 
                $(this).find("h3 span").removeClass("expand");
                $(this).find("h3").click(
                    function(e)
                    {
                        var detail = $(this).next(".search-subset-content");
                        var arrow = $(this).find("span");
                        
                        if($(detail).css("display") == "none")
                        {
                            $(arrow).addClass("expand"); 
                            $(arrow).removeClass("collapse"); 
                            $(detail).slideDown(300);
                        }
                        else
                        {
                            $(arrow).addClass("collapse"); 
                            $(arrow).removeClass("expand"); 
                            $(detail).slideUp(300);
                        }
                    }
                );
            }
        );

   }
    , 
    setShareMenu:function()
    {
        $("ul.xoperation").addClass("operation");
        $("ul.xoperation").removeClass("xoperation");
        
        /*
        $("li.share").click(
            function()
            {
                var dialog = $(this).find("div");
                if($(dialog).css("display") == "none")
                {
                    $(dialog).slideDown(300);
                }
            }
        );
        */
        
        $("a.share-link").click(
            function()
            {
                //var dialog = $("li.share").find("div");
                
                var li = $(this).parent();
                var dialog = li.find("div");
                
                if($(dialog).css("display") == "none")
                {
                    $(dialog).slideDown(300);
                }
                else
                {
                    $(dialog).slideUp(300);
                }
            }
        );

        $(".share-menu .close").click(
            function()
            {
                $(this).parents(".share-menu").slideUp(300);
            }
        );
    }
    ,
    setTipBalloons:function()
    {

// Remove 'if' statement so it can be used across the site when needed
//         if ( ($("body.skills").length > 0) || ($("body.search").length > 0) )
//        {
            // Swap classes, to enable JavaScript enhancement.
            $("a.xtip-link").addClass("tip-link");
            $("a.xtip-link").removeClass("xtip-link");
            
            // Hide the tip balloons.
            $("a.tip-link span.tip").css("display", "none");
            
            $("a.tip-link").click(function()
            {
                
                
                if ($(this).find("span.tip").css("display") == "none")
                {
                    $("span.tip").css("display", "none");
                    $(this).find("span.tip").css("display", "block");
                    return false;
                }
                else
                {
                    $(this).find("span.tip").css("display", "none");
                    return false;
                }
            });
//        }
    }
}


$(document).ready(function () {
    ISEEK.init();
});

function PrintThisPage()
{
	var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,";
	sOption+="scrollbars=yes,width=750,height=550,left=100,top=25";
	var sWinHTML = document.getElementById('pcontent').innerHTML;
	var winprint=window.open("","",sOption);
	winprint.document.open();
	winprint.document.write('<html><link rel="stylesheet" type="text/css" href="/iseek/_ui/css/print.css" media="screen, print, projection, tv" /><body>');
	winprint.document.write(sWinHTML);
	winprint.document.write('</body></html>');
	winprint.document.close();
	winprint.focus();
} 

