new function(){
    $(document).ready(function(){
		watchRequired();
	    ajaxSubmits();
		makeBigTargets();
		ieHover('.locations li, .navigation li, .sidebar li, .left1 li');
		//clearSeach();
		clearDefaultText();
		initTabs('.tabset .tab');
		$('.locations .location-text').bind('mouseover', function(){
			var _box = $(this).parent().find('.lightbox');
			_box.show();
			hideSelectBoxes(_box);
		});
		var _t;
		$('.locations').hover(function(){
			if(_t) clearTimeout(_t);
		}, function(){
			var _box = $(this).find('.lightbox');
			if(_box.is(':visible')){
				_t = setTimeout(function(){
				_box.hide();
				showSelectBoxes(_box);
				}, 50);
			}
		});
		$('.navigation > li').hover(function(){
			var _box = $(this).children('div');
			hideSelectBoxes(_box);
		}, function(){
			var _box = $(this).children('div');
			showSelectBoxes(_box);
		});
    });
    
    
    /*
Increase target area for clicks.
*/
    function makeBigTargets(){
        apply("*:has(>a.button,>a.more)");
        apply("div.related-box");
        apply("div.case");
        apply("div.cite-area");
        apply("div.search-area");
        function apply(grp){
        $(grp).each(function(){
            this.onclick = function(){
                 document.location.href = $("a",this).get(0).href;
             };
             this.style.cursor = "pointer";
        });
    };
};

    
    
    /*--- function clear seach field ---*/
    /*
    function clearSeach() {
    var _field = $('#header div.text :text');
    var _text = $('#header div.text :text').val();
    _field.focus(function() {
    if($(this).val() == _text) { $(this).val('');}
    });
    _field.blur(function() {
    if($(this).val() == '') { $(this).val(_text);}
    });
    }
    */
    
    /*
    Clear search fields
    */
    function clearDefaultText(){
        $("input[value]").each(function(){
            if(this.value!=""){
                this._dflt = this.value;
                $(this).focus(function(){
                    if(this.value==this._dflt){
                        this.value = "";
                    }
                });
                $(this).blur(function(){
                    if(this.value==""){
                        this.value = this._dflt;
                    }
                });
            }
        });
    };
    
    
    /*--- function hover fo IE6 or later ---*/
    function ieHover(_list) {
		if ($.browser.msie && $.browser.version < 7) {
			$(_list).each(function() {
				this.onmouseover = function() {
					$(this).addClass('hover');
				};
				this.onmouseout = function() {
					$(this).removeClass('hover');
				};
			});
		}
    }
    /*--- function tabs ---*/
    function initTabs(btn_list){
		btn_list = $(btn_list);
		var _a = 0;
		btn_list.each(function(_ind, _el) {
			_el.box = $('#' + _el.href.substr(_el.href.indexOf("#") + 1));
			if($(_el).hasClass('active')) {
			if(_el.box) _el.box.show();
			_a = _ind;
			}
			else {
			if(_el.box) _el.box.hide();
			}
			_el.onclick = function() {
				if(_ind != _a) {
					if(btn_list.get(_a).box) btn_list.get(_a).box.hide();
					btn_list.eq(_a).removeClass('active');
					if(_el.box) _el.box.show();
					$(_el).addClass('active');
					_a = _ind;
				}
				return false;
			};
		});
    }
    /*--- function hide/show selects for IE ---*/
    function hideSelectBoxes(object) {
    if ($.browser.msie && $.browser.version < 7) {
    var selects_list = $('select');
    object.each(function() {
    var _el = $(this);
    var t = _el.offset().top;
    var l = _el.offset().left;
    var w = _el.outerWidth();
    var h = _el.outerHeight();
    var el_selects = [];
    selects_list.each(function(){
    var _select = $(this);
    var s_t = _select.offset().top;
    var s_l = _select.offset().left;
    var s_w = _select.outerWidth();
    var s_h = _select.outerHeight();
    var _ver = false, _hor = false;
    if((t - s_t > 0) ? (t - s_t < s_h) : (t - s_t + h > 0)) _ver = true;
    if((l - s_l > 0) ? (l - s_l < s_w) : (l - s_l + w > 0)) _hor = true;
    if(_ver && _hor) {
    _select.css('visibility', 'hidden');
    el_selects.push(this);
    }
    });
    this.sboxes = el_selects;
    });
    }
    }
    function showSelectBoxes(object) {
    if ($.browser.msie && $.browser.version < 7) {
    object.each(function() {
    if(this.sboxes.length > 0) {
    $(this.sboxes).css('visibility','visible');
    }
    });
    } 
    }
	
	/*--- function mail script Validation ---*/

	
	 
	 function checkRequiredIn(me){
		 $("input",me).removeClass("invalid");
		 $("input.required",me).each(function(){
			 if(this.value==""){
				 $(this).addClass("invalid");
			 }
		 });
		 if($("input.required.invalid",me).length>0){
			 alert("Please complete all required fields.");
			 return false;
		 }else{
			 return true;
		 }		 
	 };
	 
	 function watchRequired(){
		 $("input.required").bind("keyup",function(){
			 if(this.value!=""){
				 $(this).removeClass("invalid");
			 }else{
				 $(this).addClass("invalid");
			 }
		 });
	 };
	 
		 
	function ajaxSubmits(){
	    if(String(navigator.appVersion).indexOf("MSIE 6")<0){
		    $("form[action$='/sendmail/']").unbind("submit");
		    $("form[action$='/sendmail/']").bind("submit",function(){
			    var theform = this;
				if(!checkRequiredIn(theform)){
					return false;
				}
				if($(".submit-result",theform).length<1){
				    $(":visible:first",theform).after("<p class='submit-result' />");
			    }
			    function updateResult(txt,cls,success){
				    $(".submit-result:first",theform)
				    .fadeOut("slow",function(){
					    $(this)
					    .text(txt)
					    .fadeIn("slow");
					    if(success){
						    $(":not(.submit-result)",theform).fadeOut("slow");
						    theform.reset();
    						
						    setTimeout(function(){
						    $("p.send_another",theform).remove();
						    $(theform).append("<p class='send_another' style='display:none'><a href='#'>Click here to send another message.</a></p>");
						    $("p.send_another",theform).fadeIn("slow")
						    .bind("click",function(){
							    $(this).remove();
							    $(".submit-result",theform).text("");
							    $(":not(.submit-result)",theform).fadeIn("slow");
							    setTimeout(function(){$("*",theform).show();},500);
							    return false;

						    });
						    },1000);
    						
					    }
				    })
			    };
			    if(!String(theform.elements["from"].value).match(/^[^@]+@[^@]+\.[^@]+$/)){
				    updateResult("Please enter your full email address, so we can respond to your inquiry.");
				    return false;
			    }
			    //$(".submit-result:first",theform).hide();
			    var qstring = $(theform).serialize();
    			
			    $("*",theform).each(function(){
				    this.disabled = true;
			    });
				$("<div />").load(theform.action +" div",qstring,function(txt){
			        var thediv = this;
			        if(thediv.innerHTML==""){
			            thediv.innerHTML = txt;
			        }
			      
			        $("*",theform).each(function(){
					    this.disabled = false;
				    });
				    theform.disabled = false;
				    
				    updateResult(String($(".submit-result",thediv).text()).replace(/^\w*(.*)\w$/,"$1"),"",true);
    				
			    });
			    return false;
		    });
		}
	};

	
};


    
		 


