
function switchImage(location, image) {
  document[location].src = image;
}

function OnClickCustom(myform) {
  //alert("**");
  //this.submit(); 
  myform.submit();
}

function SearchPostal(postal,langid) {
	var searchText = document.getElementById('postal').value;
	if (searchText!='' && searchText.indexOf('H1H 1H1')==-1) {
		var redirect_url;
		redirect_url="/Succursales.aspx?";
		var arg_lang="langtype="+langid;
		var arg_postal= "&ReqAddress="+postal;
		window.location="http://"+location.hostname+redirect_url+arg_lang+arg_postal;
	}
}
//Onglets Conseils d'ami
function tabCA(numero,id) {
    var redirect_url;
    var langtype;
    var arg_lang;
    var arg_section;
    var arg_id;
    var menu_id;
    langtype=getParameter('langtype');
    if ((langtype!='3084') && (langtype!='1033')){langtype='3084'}
    menu_id="&ekmensel=15074e5e_36_0_72_2";
    if (langtype=='1033') {menu_id="&ekmensel=15074e5e_36_0_1474_2"; }
    redirect_url="/sante_conseils_ami.aspx?";
    arg_lang="langtype="+langtype;
    arg_section= "&sectionID="+numero;
    arg_id= "&id="+id
    window.location="http://"+location.hostname+redirect_url+arg_lang+arg_section+arg_id+menu_id;
}

function getParameter(paramName) {
	var currentUrl = window.location.search.toLowerCase()
	var strBegin = currentUrl.indexOf(paramName) + (paramName.length+1)
	var strEnd = currentUrl.indexOf("&",strBegin)

	if (strEnd==-1)
		strEnd = currentUrl.length

	return currentUrl.substring(strBegin,strEnd)
}

/*function veriflength(postal){
	if (postal.value.length==3){
		document.getElementById('postal_last').focus();
	}
}*/

function ValidateEnterKey(postal,event,langid){
if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13))
    SearchPostal(postal,langid);
}

function clearText(field){
    if (field.defaultValue == field.value) {
	//field.value = '';
    //field.style.color = 'black';
    }
    //else if (field.value == '') field.value = field.defaultValue;

}
// MC 20/11/2007 - Valide la touche 'Enter' et lance la recherche (GJCHeader)
function checkKeycode(event,langid) {
    if((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
		var searchText = document.getElementById('txtSearchText').value;
        if (searchText!='') {
            //MC 22/01/2008 -  Empêche le double-submit
            if (event.preventDefault) {
              event.preventDefault();  // FF
            }
            event.returnValue = false;  // IE
            if (langid=='1033') {
                window.location.href="http://"+location.host+"/Search.aspx?searchtext=" + searchText + "&folderid=18&orderby=id&searchfor=html&orderdirection=ascending";
            }
            else{
                window.location.href="http://"+location.host+"/Recherche.aspx?searchtext=" + searchText + "&folderid=18&orderby=id&searchfor=html&orderdirection=ascending";
            }
        }
    }
}
// MC 20/11/2007 - Lance la recherche sur le click du bouton (GJCHeader)
function CallSearch(langid) {
	var searchText = document.getElementById('txtSearchText').value;
	if (searchText!='' && searchText !='Rechercher' && searchText !='Search' ) {
      if (langid=='1033') {
          window.location.href="http://"+location.host+"/Search.aspx?searchtext=" + searchText + "&folderid=18&orderby=id&searchfor=html&orderdirection=ascending";
      }
      else{
          window.location.href="http://"+location.host+"/Recherche.aspx?searchtext=" + searchText + "&folderid=18&orderby=id&searchfor=html&orderdirection=ascending&MaxTeaserLength=10";
      }
    }
}

// MC 16/01/2008 - Circulaires - Formulaire d'abonnement
function CirculairesPJC() {
      var _baseAdd="https://dcm5.com/bin/listctrl?"
      var _email="email=" + document.getElementById('email').value;
      var _first="&first=" + document.getElementById('first').value;
      var _last="&last=" + document.getElementById('last').value;
      var _state="&state=" + document.getElementById('state').value;
      var _slid="&slid=" + document.getElementById('slid').value;
      var _cmd="&cmd=" + document.getElementById('cmd').value;
      var _goto="&goto=" + document.getElementById('goto').value;
      var _format="&format=" + document.getElementById('format').value;
      window.location.href= _baseAdd + _email + _first + _last + _state + _slid + _cmd + _goto + _format;
      //alert(_baseAdd + _email + _first + _last + _state + _slid + _cmd + _goto + _format);
}



//Https Links
function profilefr() {
 window.location.href="https://"+location.host+"/jeancoutuprofile/default.aspx?langtype=3084";
}

function profileen() {
 window.location.href="https://"+location.host+"/jeancoutuprofile/default.aspx?langtype=1033";
}

//Https Links Cards
function giftcardsfr() {
 window.location.href="https://"+location.host+"/cartescadeaux/default.aspx?langtype=3084";
}

function giftcardsen() {
 window.location.href="https://"+location.host+"/giftcards/default.aspx?langtype=1033";
}




