function socialUrl (serviceName)
{
	var url = encodeURI(document.location);
	var title = encodeURI(document.title);
	var socialurl = '';
	switch (serviceName) {
		case 'facebook':
			socialurl = 'http://www.facebook.com/sharer.php?u='+url+'&t='+title;
			break;
		case 'twitter':
			socialurl = 'http://twitter.com/home?status='+title+' - '+url;
			break;
		case 'technorati':
			socialurl = 'http://technorati.com/faves/?add='+url;
			break;
		case 'google':
			socialurl = 'http://www.google.com/bookmarks/mark?op=add&title='+title+'&bkmk='+url;
			break;
		case 'netvibes':
			socialurl = 'http://www.netvibes.com/share?autoclose=1&title='+title+'&url='+url;
			break;
		case 'digg':
			socialurl = 'http://digg.com/submit?phase=2&partner=[partner]&title='+title+'&url='+url;
			break;
		default:
			break;
	}

	var width = 800;
	var height = 600;
	var left = parseInt((jQuery(window).width()/2)-(width/2));
	var top = parseInt((jQuery(window).height()/2)-(height/2));
	window.open(socialurl, serviceName, 'resizable=yes, location=yes, width='+width+', height='+height+', left='+left+', top='+top);

	return false;
}

function elementSupportAttribute(element, attribut){
    var test = document.createElement(element);
    if( attribut in test ){
        return true;
    }else{
        return false;
    }
}

function inputSupportType(type){
    var input = document.createElement('input');
    input.type = type;
    if( input.type == 'text' ){
        return false;
    }else{
        return true;
    }
}

jQuery(document).ready(function() {
	if ( jQuery.browser.msie && jQuery.browser.version < 7 ) {
		jQuery('img[src$=.png], input[src$=.png]').each(function(i, el)	{
			jQuery(this).css({
				'-pie-png-fix':'true',
				'behavior':'url(/css/pie.htc)'
			});
		});
	}	
	
	var navleft = jQuery('#leftsubnav');
	jQuery('.nav-2 > li:not(.current)',navleft).hide();
	jQuery('.nav-2 > li.current',navleft).parent().find('li').show();
	jQuery('li.current li',navleft).show();
	
	jQuery('.paragrapheSuivantCache, .cachecache').addClass('closed').nextUntil('.paragrapheSuivantCache, .cachecache, .paragrapheStopCache, hr').hide();
	jQuery('.paragrapheSuivantCache, .cachecache').bind('click',function(){
		jQuery(this).nextUntil('.paragrapheSuivantCache, .paragrapheStopCache, .cachecache, hr').slideToggle('slow')
		if( jQuery(this).hasClass('closed') ){
			jQuery(this).removeClass('closed').addClass('opened');
		}else{
			jQuery(this).removeClass('opened').addClass('closed');
		}
	});

	if ( !jQuery.browser.msie || (jQuery.browser.msie && (jQuery.browser.version >= 7)) ) {
		jQuery(window).load(function(){
			var gheight = (jQuery(window).height() > jQuery(document).height()) ? jQuery(window).height() : jQuery(document).height();
			var hleft = gheight - jQuery('#header').height() - jQuery('#footer').height();
			jQuery('#left').css({'min-height': hleft +'px'});	
			jQuery('#center').css({'min-height': ( hleft - (2*10) - 20  ) +'px'});		
		});
	}
	
	var iclick = 1;
	var up = true;
	jQuery('#fontsize').bind('click',function(){
		if( up && (iclick <= 10) ){
			iclick++;
			jQuery('body').css({
				'font-size' : (parseFloat(jQuery('body').css('font-size')) + 1 )+'px' 
			});
			if(iclick == 10){
				up = false;
			}
		}else{
			iclick--;
			jQuery('body').css({
				'font-size' : (parseFloat(jQuery('body').css('font-size')) - 1) +'px' 
			});
			if(iclick == 1){
				up = true;
			}
		}
	});
	jQuery('#print').bind('click',function(){
		window.print();
	});
	
	jQuery('.fancybox').fancybox();
});


