function switchBreveCat(toShow, thisLink){
	$$('#news-menu a').each(function(element){
		element.removeClass('active');
	});
	$(thisLink).addClass('active');
	$$('#select-short-news div').each(function(element){
		element.addClass('hide');
		if(element.id == toShow){
			element.removeClass('hide');
		}
	});
}
function switchMediaVideoEmbed(prefix, idVid){
	$$('#video-box #'+prefix+' div div').each(function(element){
		element.addClass('hide');
		if(element.id == prefix+'_vid'+idVid){
			element.removeClass('hide');
		}
	});
}
function switchMediaVideoMode(toShow){
	$$('#video-box div.mode').each(function(element){
		element.addClass('hide');
		if(element.id == toShow){
			element.removeClass('hide');
		}
	});
}

window.addEvent('domready', function() {
	$('searchInput').addEvent('keydown', function(event){
		if (event.key == 'enter'){ fastSearch(); } //Executes if the user hits ENTER.
	});
});

function checkSearch(){
	var myString = new String();
	myString = $('searchInput').value.toString();
	/*var myRegExp = new RegExp("[^a-zA-Z0-9_ ]","g");
	var myResult = myString.replace(myRegExp, "");*/
	return myString;
}

function fastSearch(){
		if(Browser.Engine.trident != true){
			var value = checkSearch();
			document.location = 'show_search.php?mc='+value;
		}else{
			var value = checkSearch();
			document.location = 'http://pointdebasculecanada.ca/show_search.php?mc='+value;
		}
}

function fastSearch2(){
	if(checkSearch($('searchInput')) === true){
		if(Browser.Engine.trident != true){
			document.location = 'recherche/'+$('searchInput').value+'.php';
		}else{
			document.location = 'http://pointdebasculecanada.ca/recherche/'+$('searchInput').value+'.php';
		}
	}else{
		//alert("");
	}
}

function printVideo(){
	window.print();
}

function addFav(){
	if ( navigator.appName != 'Microsoft Internet Explorer' ){
		window.sidebar.addPanel("Point de BASCULE",document.location,"");
	}else{
		window.external.AddFavorite(document.location,"Point de BASCULE");
	}
}

function showPartage(){
	if($('boxPartager').style.display == 'none'){
		$('boxPartager').style.display = 'block';
		$('boxEnvoyer').style.display = 'none';
		if($('boxMessage')){ $('boxMessage').style.display = 'none'; }
	}else{
		$('boxPartager').style.display = 'none';
	}
}

function showEnvoyer(){
	if($('boxEnvoyer').style.display == 'none'){
		$('boxEnvoyer').style.display = 'block';
		$('boxPartager').style.display = 'none';
		if($('boxMessage')){ $('boxMessage').style.display = 'none'; }
	}else{
		$('boxEnvoyer').style.display = 'none';
	}
}
