﻿<!--    // Hide from old browsers
    function noContent() {
        document.getElementById('content_pane_3').style.display = 'none';
        document.getElementById('content_pane_2').style.display = 'none';
        document.getElementById('content_pane_1').style.display = 'none';
    }
    function showContent(t) {
        switch (t) {
            case 1: //Soon
                document.getElementById('content_pane_3').style.display = 'none';
                document.getElementById('content_pane_2').style.display = 'none';
                document.getElementById('content_pane_1').style.display = 'block';
                break;
            case 2: //Projects
                document.getElementById('content_pane_3').style.display = 'none';
                document.getElementById('content_pane_1').style.display = 'none';
                document.getElementById('content_pane_2').style.display = 'block';
                break;
            case 3: //About
                document.getElementById('content_pane_1').style.display = 'none';
                document.getElementById('content_pane_2').style.display = 'none';
                document.getElementById('content_pane_3').style.display = 'block';
                break;
        }
    }
    function highLightBG(t, itm) {
        switch (t) {
            case 'ovr': itm.style.backgroundColor = "red";
                break;
            case 'off': itm.style.backgroundColor = "";
                break;
        }
    }


    var timerID = null
    var timerRunning = false

    function MakeArray(size) {
        this.length = size;
        for (var i = 1; i <= size; i++) {
            this[i] = "";
        }
        return this;
    }
    function stopclock() {
        if (timerRunning)
            clearTimeout(timerID);
        timerRunning = false

    }

    function showtime() {
        var now = new Date();
        year = new String(now.getUTCFullYear());
        var month = now.getMonth() + 1;
        var date = now.getDate();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds();
        var day = now.getDay();
        Day = new MakeArray(7);
        Day[0] = "SUN";
        Day[1] = "MON";
        Day[2] = "TUE";
        Day[3] = "WED";
        Day[4] = "THU";
        Day[5] = "FRI";
        Day[6] = "SAT";

        var dateValue = "";
        dateValue += (Day[day]) + " ";
        dateValue += year;
        dateValue += ((month < 10) ? "-0" : "-") + month;
        dateValue += ((date < 10) ? "-0" : "-") + date;


        var timeValue = "";
        timeValue += ((hours === 0) ? 12 : (hours <= 12) ? hours : hours - 12);

        timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
        //timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
        timeValue += (hours < 12) ? " AM" : " PM";
        var timeDiv = document.getElementById("time");
        timeDiv.title = dateValue;
        timeDiv.innerHTML = timeValue;
        timerID = setTimeout("showtime()", 1000);
        timerRunning = true
    }
    function startClock() {
        stopclock();
        showtime()       
    }
        
    function prepState(){         
            
            startClock();
            
            var activePane ="";
                   
            $("div.content_pane").draggable({ handle: 'div.windowTitle',
                containment: '#content',
                stack: { group: 'div.content_pane', min: 1 },
                start: function() {
                   activePane = $(this).attr("id")
                }
            });
            
            //Close Button
            $("img.sprite-controls_close")
            .live("click", function(event) {
                $(this).parents("div.content_pane").hide();
                event.stopPropagation();
                activePane = "";
            })
            .live("mouseover", function() {
                $(this).addClass("sprite-controls_close_hvr");                
            })
            .live("mouseout", function() {                
                $(this).removeClass("sprite-controls_close_hvr");
                $(this).removeClass("sprite-controls_close_dwn");
            })
            .live("mousedown", function() {
                $(this).addClass("sprite-controls_close_dwn");
                $(this).removeClass("sprite-controls_close_hvr");                             
            })
            .live("mouseup", function() {                
                $(this).addClass("sprite-controls_close_hvr");
                $(this).removeClass("sprite-controls_close_dwn");
            });
            // End Close Button

            // Minimize Button
            $("img.sprite-controls_minimize")
            .live("click", function(event) {
                $(this).parents("div.content_pane").hide("fast");
                event.stopPropagation();
                activePane = "";
            })
            .live("mouseover", function() {
                $(this).addClass("sprite-controls_minimize_hvr");                
            })
            .live("mouseout", function() {                
                $(this).removeClass("sprite-controls_minimize_hvr");
                $(this).removeClass("sprite-controls_minimize_dwn");
            })
            .live("mousedown", function() {                
                 $(this).addClass("sprite-controls_minimize_dwn");   
                 $(this).removeClass("sprite-controls_minimize_hvr");                             
            })
            .live("mouseup", function() {                
                $(this).addClass("sprite-controls_minimize_hvr");
                $(this).removeClass("sprite-controls_minimize_dwn");
            });                        
            //End Minimize Button            
            

            //Click to bring any window to the front
            $("#content").find("div[id^=content_pane_]").each(function(idx) {
                $(this).click(function(event) {               
                    $("#content").find("div[id^=content_pane_]").each(function(idx2) {
                        if (idx == idx2) {
                            $(this).css("z-index", '2700');
                             activePane = $(this).attr("id")
                        } else {
                            $(this).css("z-index", ($(this).css("z-index") - 1));
                        }
                    });
                });
            });

            
            // Tray Items
            $("#trayItems").find("div[id^=tray]").each(function(i) {
                $(this).click(function() {                    
                    $("#content").find("div[id^=content_pane_]").each(function(j) {
                        if (j == i) { 
                            var sel = "#content_pane_" + (i + 1);
                            if($(this).attr("id") != activePane)
                            {   
                                $(sel + ":hidden").show("fast");                                               
                                $(this).css("z-index", '2700');
                                activePane = $(this).attr("id")                                
                            } else{                                
                                activePane = "";
                                $(sel).hide("fast");
                            }
                        } else {
                            if($(this).css("z-index") > 0){
                                $(this).css("z-index", ($(this).css("z-index") - 1));
                            }
                        }
                    });
                });
            });
            // End Tray Items
            
     $("li.skydriveItem").live("click", function(){
            var thePath = 'Projects/' + $(this).find("img").attr("alt");
            //alert(thePath);
            $.ajax({
            type: "POST",
            url: "TGWOServices.asmx/GetSkyDrive",
            data: "{'subpath': '" + thePath + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
            // Hide the fake progress indicator graphic.
            //$('#RSSContent').removeClass('loading');            
            // Insert the returned HTML into the <div>.
            //alert(msg);
            $("#content_pane_2").html(msg);
            },
            error: function(xhr, desc, e){
            var err = xhr.responseText;
            alert(err);
            }
  });
     });

        }
    // End Hiding -->