/*		if force is 'true' then the designed id is forced hidden
			else this acts as a normal toggle
*/
function toggler( el, force ) {
	var e = document.getElementById( el );

	if( true == force ) {
		e.style.visibility = 'hidden';
		e.style.display = 'none';	
	} else {
		if( 'visible' == e.style.visibility ) {
			e.style.visibility = 'hidden';
			e.style.display = 'none';
		} else {
			e.style.visibility = 'visible';
			e.style.display = 'block';
		}
	}
}

function toolPerma() {
	toggler( 'share',true );
	toggler( 'perma',false );
	//		get content
	if( '' == document.permalien.permaFld.value ) {
		document.permalien.permaFld.value = document.location;	
	}
	return false;
}

function toolShare() {
	toggler( 'perma',true );
	toggler( 'share',false );
	//		get content
	var ttl = document.title;
	var url = document.location;
	var t,url;
	var ttxt = 'Partager cet article sur ';
	//		fill out with with content
	if( document.getElementById( 'share-blogmarks' )) {
		t = document.getElementById( 'share-blogmarks' );
		t.href = t.href +'&url=' +url +'&title=' +ttl;
		t.title = ttxt +'Blogmarks';
	}
	if( document.getElementById( 'share-digg' )) {
		t = document.getElementById( 'share-digg' );
		t.href = t.href +'&url=' +url +'&title=' +ttl;
		t.title = ttxt +'Digg';
	}
	if( document.getElementById( 'share-yahoo' )) {
		t = document.getElementById( 'share-yahoo' );
		t.href = t.href +'u=' +url +'&t=' +ttl;
		t.title = ttxt +'Yahoo';
	}
	if( document.getElementById( 'share-reddit' )) {
		t = document.getElementById( 'share-reddit' );
		t.href = t.href +'url=' +url +'&title=' +ttl;
		t.title = ttxt +'Reddit';
	}
	if( document.getElementById( 'share-newsvine' )) {
		t = document.getElementById( 'share-newsvine' );
		t.href = t.href +'u=' +url +'&h=' +ttl;
		t.title = ttxt +'Newsvine';
	}
	if( document.getElementById( 'share-google' )) {
		t   = document.getElementById( 'share-google' );
		t.href = t.href +'&bkmk=' +url +'&title=' +ttl;
		t.title = ttxt +'Google';
	}
	if( document.getElementById( 'share-fark' )) {
		t   = document.getElementById( 'share-fark' );
		t.href = t.href +'new_url=' +url +'&new_comment=' +ttl +'&new_link_other=&linktype=&topic=Interesting';
		t.title = ttxt +'Fark';
	}
	if( document.getElementById( 'share-furl' )) {
		t   = document.getElementById( 'share-furl' );
		t.href = t.href +'t=' +ttl +'&u=' +url;
		t.title = ttxt +'Furl';
	}
	if( document.getElementById( 'share-spurl' )) {
		t   = document.getElementById( 'share-spurl' );
		t.href = t.href +'title=' +ttl +'&url=' +url;
		t.title = ttxt +'Spurl';
	}
	if( document.getElementById( 'share-simpy' )) {
		t = document.getElementById( 'share-simpy' );
		t.href = t.href +'href=' +url +'&title=' +ttl;
		t.title = ttxt +'Simpy';
	}
	if( document.getElementById( 'share-delicious' )) {
		t = document.getElementById( 'share-delicious' );
		t.href = t.href +'url=' +url +'&title=' +ttl;
		t.title = ttxt +'Del.icio.us';
	}
	if( document.getElementById( 'share-blinklist' )) {
		t = document.getElementById( 'share-blinklist' );
		t.href = t.href +'&Description=' +ttl +'&Url=' +url;
		t.title = ttxt +'Blinklist';
	}
	if( document.getElementById( 'share-stumbleupon' )) {
		t = document.getElementById( 'share-stumbleupon' );
		t.href = t.href +'url=' +url +'&title=' +ttl;
		t.title = ttxt +'StumbleUpon';
	}
	if( document.getElementById( 'share-facebook' )) {
		t = document.getElementById( 'share-facebook' );
		t.href = t.href +'u=' +url;
		t.title = ttxt +'Facebook';
	}
	return false;
}
