function show(rid)
{
    document.getElementById(rid).style.display = "block";
}

function hide(rid)
{
    document.getElementById(rid).style.display = "none";
}

function hideEmail()
{
	document.getElementById('email').value = '';
}
			
function showEmail()
{
	if (document.getElementById('email').value == '') {
	document.getElementById('email').value = 'nom@provider.com';
	}
}

function subscriptionValidation()
{
	if (document.getElementById('email').value == "") {
	    alert("Veuillez entrer votre adresse e-mail!");
	    return false;
	}
	if (document.getElementById('email').value == "nom@provider.com") {
		alert("Veuillez entrer votre adresse e-mail!");
	 	return false;
	}
}

function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
}

function wordCut($text, $limit, $msg){
   if (strlen($text) > $limit){
       $txt1 = wordwrap($text, $limit, '[cut]');
       $txt2 = explode('[cut]', $txt1);
       $ourTxt = $txt2[0];
       $finalTxt = $ourTxt.$msg;
   }else{
       $finalTxt = $text;
   }
   return $finalTxt;
}

function loginValidation() {
	if (document.login.login.value == "") {
	    alert("Veuillez entrer votre nom d'utilisateur!");
	    return false;
	}
	if (document.login.password.value == "") {
		alert("Veuillez entrer votre mot de passe!");
	 	return false;
	}
}

function articleValidation() {
	if (document.writeArticle.title.value == "") {
	    alert("Veuillez entrer un titre!");
	    return false;
	}
	if (document.writeArticle.photo.value == "") {
		alert("Veuillez ajouter une photo!");
	 	return false;
	}
}

function editoValidation() {
	if (document.writeEdito.title.value == "") {
	    alert("Veuillez entrer un titre!");
	    return false;
	}
	if (document.writeEdito.photo1.value == "") {
		alert("Veuillez ajouter au moins une photo!");
	 	return false;
	}
	if (document.writeEdito.newsletter.checked = true) {
		var response = confirm("Cet édito va être automatiquement publié et la newsletter envoyée aux membres");
		if (response);
	    else return false;
	}
}

function livesearch (s, livestop, olds) {
    if (s.length >= 3 && s != olds && livestop == 'live') {
        document.getElementById('search_form').old_s.value = s;
        xajax_livesearch(s);
        document.getElementById('searchResultDiv').style.display = 'block';
    }
    if (livestop == 'live') {
        setTimeout("livesearch(document.getElementById('search_form').s.value, document.getElementById('search_form').livestop.value, document.getElementById('search_form').old_s.value)", 500);
    }
}

function printit(){  
if (window.print) {
    window.print() ;  
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
}
self.close();
}