/*
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
*/


function getFolderName(){
	var pathArray = window.location.pathname.split( "/" );
	var newPathname = "";
	for ( i = 0; i<pathArray.length; i++ ) {
	newPathname += "/";
	newPathname += pathArray[i];
	}
	return(pathArray[1]);	
}
function baseURL(){
	return(window.location.protocol + "//" + window.location.host + "/");
}

function isActive(s){
	var folder=getFolderName();
	if (s==folder){
		return"active-trail";		
	}
	return"";
}

// JQUERY MENU
$(function(){
	var n= $('#primary-menu ul.menu >li').size();
	for (var i=0; i<n; i++ ){		
		var title = $('#primary-menu ul.menu >li:eq('+ i +')').attr("title");
		$('#primary-menu ul.menu >li:eq('+ i +')').addClass(isActive(title));
//		console.log(""+i+" "+title + " " + getFolderName());
	}

});


$(function() {
  // IE6 & less-specific functions
  // Add hover class to primary menu li elements on hover
  if ($.browser.msie && ($.browser.version < 7)) {
    $('#primary-menu li').hover(function() {
      $(this).addClass('hover');
      }, function() {
        $(this).removeClass('hover');
    });
  };
});

$(function() {
jQuery("#button-webname").click(function(e) {
			e.preventDefault();
			jQuery("#input-webname").click();
			return false;
		}).show();
jQuery("#input-webname").hide();  

});

$(function() {
	$(".facilities td p").css('display','none');		   
	$(".facilities td h4").toggle(
     function () {
        $(this).next().slideDown('Normal');
      },
     function () {
        $(this).next().slideUp('Normal');
      }	  
    );
						 
});

$(function() {
	$('#chat').hover(function(){
		$("#chat-hover").hide().slideDown();		
	}, function(){
		$('#chat-hover').css('display','none');
	})

})

var auto_refresh = setInterval(
function ()
{
	var tm = new Date();
	tm = tm.getTime();
	$('#chat-hover img').each(function() { 
		var t = $(this);
		var src = t.attr('src');
		src = src.replace(/(xyzzy=\d+)?$/, 't='+tm);
		t.attr('src', src); 
	});
}, 10000); // refresh every 10000 milliseconds

$(function(){
	$("a.info-box").fancybox({
	 'ajax' : {cache : false }
	});
});

$(function() {
	$("#quote-form").css('display','none');	
	$("#quote-btn").click(function(){
		 $("#quote-form").slideDown('Normal');
	});
			 
});
