var l= location.pathname.substr(location.pathname.lastIndexOf('/')+1);
if (l.length==0) l="index.html";
function setupMenu() {
    $('#menu>ul>li>ul').hide();
    $('#menu>ul>li').mouseover(function(){
        // check that the menu is not currently animated
        if ($('#nav ul:animated').size() == 0) {
            // create a reference to the active element (this)
            // so we don't have to keep creating a jQuery object
            $heading = $(this);
            // create a reference to visible sibling elements
            // so we don't have to keep creating a jQuery object
            $expandedSiblings = $heading.siblings().find('ul:visible');
            if ($expandedSiblings.size() > 0) {
                $expandedSiblings.slideUp(200, function(){
                    $heading.find('ul').slideDown(200);
                });
            }
            else {
                $heading.find('ul').slideDown(200);
            }
        }
    });
}
$(document).ready(function(){
    $("h1, h2, h3, h4, h5, h6").ieffembedfix()
    if (l=="index.html") {
	$("#menu a[href="+l+"]").addClass('current');
//	alert ($("#footer").html());
//	setupMenu();
	return;
    }
    if (l=="checklogs.php") {
	clinit();
    }
    if (l=="ArmsRace.html") {
	setInterval(nextalate, 2000);
    }
    $("#menu").load("index.html #menu", function (page) {
//	$("#footer").html( $(page).find("#footer").html());
//	alert ($(page).find("#footer").html() + " " + $(page).find("#contenttop").html());
//	$("#partners").html( $(page).find("#partners").html());
//	$("#contenttop").html( $(page).find("#contenttop").html());
 	$("#menu a[href='"+l+"']").addClass('current');
//	setupMenu();
   });
});

function loadcontactform(who) {
    $("#contactform").load("ContactForm.php #content", function (page) {
 	$("#contactform input[name=who]").val(who);
 	$("#contactwho").text(who);
//	$("#contactform").addClass('logs');
	$("#contactform").show();
//	setupMenu();
   });
};

function toggleFaq(faq) {
  var pp=document.getElementById('faq'+faq);
  pp.style.display = (pp.style.display?'':'none'); 
}

function showfw(fw) {
  $('.fw').hide(); 
  $('#'+fw).show(); 
}

// IE font-face ClearType fix - V0.1
// Authord by Michael Strand of Allcreatives.net
// Usage, changes, FAQ etc. see - http://allcreatives.net/2009/12/05/jquery-plugin-ie-font-face-cleartype-fix/
// The IE font-face ClearType fix plugin is dual licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) and 
// [GPL](http://www.opensource.org/licenses/gpl-license.php) licenses.

// There is one configuration setting to be changed below if you have the PNG image in different location from this file.

(function($) {
    $.fn.ieffembedfix = function() {
		
		// CONFIGURE THE PATH TO YOUR 1BY1 PNG HERE, RELATIVE TO THE LOCATION OF THIS JS FILE.
		
		var pngimgurl = "images/hIEfix.png";
		
    return this.each(function() {
        //check for IE7/8
        if (jQuery.support.objectAll == false) {
            $(this).css({
						
						filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + pngimgurl + ",sizingMethod=crop',
						zoom: '1'
						});
        }
        });
    }
})(jQuery);
