summaryrefslogtreecommitdiffstats
path: root/media/js/base.js
blob: 9f549eda5fe374d35762e81ed1876c6168d05826 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/* The following serves to stretch the content div to the bottom of the margin images, or vice versa*/

function contentHeight(){
setMaxHeight($(".rightMargin,#content,.leftMargin,#col2"),$("#content"));
};

function setMaxHeight(group, target) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		};
	});
	target.height(tallest);
};



/*This is the jquery stuff */
$(document).ready(function() {

$('.searchable li').quicksearch({
  position: 'before',
  attached: 'ul.searchable',
  labelText: '',
  loaderText: '',
  delay: 100});

$('table.searchable tr').quicksearch({
  position: 'before',
  attached: 'table.searchable:first'});

$(".killEyeCandy").click(function () {
                                         killEyeCandy();
                                         setCookie("eyeCandy", "False", 100);
                                        }
                           );

$(".showEyeCandy").click(function () {
		                         showEyeCandy();
		                         setCookie("eyeCandy", "True", 100);
                                        }
                           );

$(".toggleMenu").click(function () {
		  $("ul.dropdown li:not(.toggleMenu)").toggle();
		  $(".toggleMenu").toggle();
 });
 
 $("a.closeDiv").click(function () {
		  $(this).parent().hide();
		});

/*$("#footerLinks").hover(
		  function() {$(".footer").fadeIn("slow")},
		  function() {$(".footer").fadeOut("slow")}
);*/

function linkHover(hoverLink,image){

$(hoverLink).bind('mouseover',
		  function() {
                          $(image).stop().css("opacity", "1.0").fadeIn("slow");
/*			  $(hoverLink).css("background","gray");*/
		  });
$(hoverLink).bind('mouseout',
		  function() {
			  $(image).stop().fadeOut("slow");
/*			  $(hoverLink).css("background","black");*/
		  }
);



};

function showEyeCandy(){
contentHeight();
switchStylestyle("eyeCandy");
$("#eyeCandyFooterPopUps").load("/eyecandy");
$(".leftMargin,.rightMargin").show();
$(".showEyeCandy").hide();
$(".killEyeCandy").show();
linkHover("#cavesLink","#richardBanner");
linkHover("#caversLink","#timeMachine");
linkHover("#surveyBinderLink","#surveyHover");
linkHover("#troggle","#timeMachine");
};

function killEyeCandy(){
$("#content").removeAttr("style")
switchStylestyle("plain");
$(".leftMargin,.rightMargin").hide();
$(".showEyeCandy").show();
$(".killEyeCandy").hide();
$("#cavesLink").unbind('mouseover').unbind('mouseout');
$("#caversLink").unbind('mouseover').unbind('mouseout');
$("#surveyBinderLink").unbind('mouseover').unbind('mouseout');
$("#troggle").unbind('mouseover').unbind('mouseout');
};

if (getCookie("eyeCandy") == "False")
    {killEyeCandy();}
else
    {showEyeCandy();
     $(".footer").hide();
     $(".fadeIn").hide();
     setTimeout("$('.leftMargin.fadeIn').fadeIn(3000);",1000);
     setTimeout("$('.rightMargin.fadeIn').fadeIn(3000);",2000);
     }

/*dropdown (well, up actually) menu code from http://css-tricks.com/simple-jquery-dropdowns/*/
$("ul.dropdown li").hover(
	function(){
		$(this).addClass("hover");
		$('ul:first',this).css('visibility','visible')
	},

	function(){
        $(this).removeClass("hover");
        $('ul:first',this).css('visibility', 'hidden');
	});

	$("ul.dropdown li ul li:has(ul)").find("a:first").append(" » ");
/* end dropdown menu code */
	
});


/* Cookies */
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name + "=" +escape(value) +
((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) + ";path=/";
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
};

/* Style Sheet Switcher */
   function switchStylestyle(styleName)
   {
      $('link[@rel*=style][title]').each(function(i)
      {
         this.disabled = true;
         if (this.getAttribute('title') == styleName) this.disabled = false;
      });
   }