function appear(id)
{
	$("#"+id).css('display','block');
}

function hide(id)
{
	$("#"+id).css('display','none');
}



function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


jQuery(document).ready(function($) {
   $('#coda-slider-5').codaSlider({
		dynamicArrows: false,
		dynamicTabs: true,
		autoSlide: true,
		autoSlideInterval: 4000,
		autoSlideStopWhenClicked: false
   });
});

//var $j = jQuery.noConflict();

$(document).ready(function() {

        var showOrHide = false;

        $('#btn-zone-th a').click(
                function () {
                    if(showOrHide == false)
                    {
                        var heightTh = $("#zone-thematiques").css('height');

                        //show its submenu
                        $('#zone-thematiques').slideDown(250);
                        $('#mask').slideDown(250);

                        showOrHide = true;
                    }
                    else
                    {
                        //hide its submenu
                        $('#zone-thematiques').slideUp(250);
                        $('#mask').slideUp(250);
                        showOrHide = false;
                    }
                }
        );

        $('.tab-tabs').each(function(){$(this).tabs();});
	
	$('.page-template-templateconnect-php a').each(function(){;
		if($(this).attr('href') == '?page_id=117&action=register')
		{
			//alert('toto');
			$(this).attr('href','http://www.maceo.pro/nouvel-adherent'); 
		}
	});
	
	$(".searchform-input-wrapper select").select_skin();
	
	$('.doc a').each
	(
		function()
		{
			var str = $(this).attr('href');
			if((str.indexOf('.doc') > 0) || (str.indexOf('.docx') > 0))
			{
				$(this).attr('class','word');
			}
			else if((str.indexOf('.xls') > 0) || (str.indexOf('.xlsx') > 0))
			{
				$(this).attr('class','excel');						
			}
			else if((str.indexOf('.pdf') > 0))
			{
				$(this).attr('class','pdf');						
			}
			else if((str.indexOf('.jpg') > 0))
			{
				$(this).attr('class','jpg');						
			}
			else if((str.indexOf('.JPG') > 0))
			{
				$(this).attr('class','jpg');						
			}
			else if((str.indexOf('.jpeg') > 0))
			{
				$(this).attr('class','jpg');						
			}
			else if((str.indexOf('.JPEG') > 0))
			{
				$(this).attr('class','jpg');						
			}
			else if((str.indexOf('.zip') > 0))
			{
				$(this).attr('class','zip');						
			}
			else if((str.indexOf('.ppt') > 0))
			{
				$(this).attr('class','ppt');
			}
			else if((str.indexOf('.pptx') > 0))
			{
				$(this).attr('class','ppt');
			}
			else
			{
				$(this).attr('class','otherFormat');						
			}
		}
	);
	
	$('.identCard').tooltip({position:'bottom center',effect:'slide'});
	$('#user_pass').focus(function(){$(this).val('');});
	
	$('.category-4 .searchform-params select').change(function() {
		$('.category-4 .custom_search').submit();
	});
	$('.category-4 .TextField .searchform-input-wrapper').css({'margin-right':'0px'});
	$('.category-4 .TextField').css({'width':'243px'});
	$('.category-4 .TextField .searchform-param').css({'width':'243px'});
	$('.category-4 .TextField .searchform-input-wrapper label').css({'float':'left'});
	$('.category-4 .TextField .searchform-input-wrapper').css({'width':'72%'});
	$('.category-4 .TextField input').css({'float':'left'});
	$('.category-4 .TextField .searchform-input-wrapper').append('<div onclick="$(\'.category-4 .custom_search\').submit();" style="cursor:pointer; float:left; width:25px; height:26px; background:url(http://www.maceo.pro/wp-content/themes/maceo_Rewrited/images/search-bar-new.png) scroll right 0px no-repeat;"></div>');
//------
	$('.panel img').css({'visibility':'visible'});
 
	$('.listes-sites-projets').mouseenter(function(){
		$('.child-sites-projet').slideDown();
		$('#container-li-sites-projets').slideDown();
	});
	
	$('.listes-sites-projets').mouseleave(function(){
		$('.child-sites-projet').slideUp();
		$('#container-li-sites-projets').slideUp();
	});
	
	$("#table-sites-projets tr:odd").css("background-color", "#F4F2F0");
});

function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    }
    else {
     if (document.documentElement&&
       document.documentElement.clientHeight) {
         windowHeight = document.documentElement.clientHeight;
    }
    else {
     if (document.body&&document.body.clientHeight) {
         windowHeight=document.body.clientHeight;
      }
     }
    }
    return windowHeight;
}

function setFooter() {
    if (document.getElementById) {
        var windowHeight=getWindowHeight();
        if (windowHeight>0) {
            var contentHeight=
            document.getElementById('wrapper').offsetHeight;
            var footerElement=document.getElementById('footer');
            var footerHeight=footerElement.offsetHeight;
        if (windowHeight-(contentHeight)>=0) {
            footerElement.style.position='relative';
            footerElement.style.top=
            (windowHeight-(contentHeight+10))+'px';
        }
        else {
            footerElement.style.position='static';
        }
       }
      }
}

window.onload = function() {
setFooter();
}

window.onresize = function() {
setFooter();
}
