function showHide(id){
    div = document.getElementById(id);
    if(div.className == 'invis'){
        div.className = 'entry';
    } else {
        div.className = 'invis';
    }
}

function switchclass(id, class1, class2){
    div = document.getElementById(id);
    if(div.className == class1){
        div.className = class2;
    } else {
        div.className = class1;
    }
}

function switchtitle(id, title1, title2){
	
    div = document.getElementById(id);
    if(div.title == title1){
        div.title = title2;
    } else {
        div.title = title1;
    }
}

function resizeWindow() {
	//var regEx = new RegExp("Detail&decorator=popup");
	var regEx = new RegExp("Popup&decorator=popup");
	var imgSrc = window.location.href.replace(regEx, "Image");
	
	//alert(window.location.href);
	
	var img = new Image();
	img.src = imgSrc;

	var goodWidth = img.width;
	var goodHeight = img.height;
	
	window.resizeTo(goodWidth, goodHeight);
	
	document.body.style.cursor="default";
	//window.opener.document.body.style.cursor="default";
}

function openPopupWindow(url) {
  	popupWin = window.open(url, "Nom", "directories=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=400,left=5,top=10");
}

function vote(){
	options = document.voteForm.option;
	for(i=0; i<options.length; i++){
		if(options[i].checked){
			document.voteForm.submit();
			return;
		}
	}
	alert("Vous devez choisir une option avant de voter");
	return;
}

function addToFavorite(label){
	var IEstring = "<a class='transversales' href='javascript:window.external.addfavorite(location.href,document.title);' title='Ajouter le site aux favoris'>"+label+"<\/a>" ;
	var NSstring = "<a class='transversales' href='javascript:void(0);' onclick='alert(\"Presser [Ctrl + D] pour ajouter le site aux favoris.\")'>"+label+"</a>";
	var OPstring = "<a class='transversales' href='javascript:void(0);' onclick='alert(\"Presser [Ctrl + T] pour ajouter le site aux favoris.\")'>"+label+"</a>";
	var OTHstring = "<a class='transversales' href='javascript:void(0);' onclick='alert(\"Vous devez ajouter manuellement le site à vos favoris.\")'>"+label+"</a>"
	var whichString = OTHstring ;
	
	var agt = navigator.userAgent.toLowerCase();
	var app = navigator.appName.toLowerCase();
	var ieAgent = agt.indexOf('msie');
	var nsAgent = app.indexOf('netscape');
	var opAgent = app.indexOf('opera');
	
	if (ieAgent!= -1) { 
		whichString = IEstring; 
	} else if (nsAgent!= -1){ 
		whichString = NSstring; 
	} else if (opAgent!= -1){
		whichString = OPstring; 
	}
	
	document.write(whichString)
}

function openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}