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 'gbookmarks':
			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(){
	var pdfs = jQuery('.pdfs .edition_pdf_tribune');
	var nb = pdfs.size();
	var slide_time = 500;
	var slide_delay = 3000;
	var i = 0;
	pdfs.not(':eq('+i+')').hide();
	var pdfsSlide = function(){
		pdfs.eq(i).hide(slide_time);
		i = ( i + 1 ) % nb;
		pdfs.eq(i).show(slide_time);
	};
	var timerPdfshow = setInterval(pdfsSlide,slide_delay);
	pdfs.mouseover(function(){
	   clearInterval(timerPdfshow);
	});
	pdfs.mouseleave(function(){timerPdfshow = setInterval(pdfsSlide,slide_delay);});


	jQuery('#geo_change').click(function(){
		jQuery('#relocate').show().css({
			'left' : ((jQuery("html").width() / 2)- (jQuery('#relocate').width() / 2 ))+'px'			
		});
	});
	jQuery('#relocate_submit').click(function(){
		jQuery('#relocate').hide();
	});

	Hyphenator.run();
});

