var win = null;
function NewWindow(mypage,myname,w,h,scroll){
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  settings =
  'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',status=0,toolbar=1,resizable=1'
  win = window.open(mypage,myname,settings)
}

function hideshow(obj) { 
  if (parseInt(navigator.appVersion) >= 5 || navigator.appVersion.indexOf["MSIE 5"] != -1) {
    if (obj.style.display=="none") 
      obj.style.display="";
    else
      obj.style.display="none";
  }
}

function chpage(url, tar) {
  var tmprnd = Math.round(Math.random()*1000000); 
  if (tar == "1") {
    NewWindow(url,tmprnd,'800','600','yes')
  }
  else {
    top.location.href = url;
  }
}

function cc(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else var expires = "";
  document.cookie = name+"="+encodeURIComponent(value)+expires+"; path=/";
}

function cclass(divid, thecl, dl) {
  if (dl > 0) {
    setTimeout("document.getElementById('"+divid+"').className='"+thecl+"'", dl);
  }
  else {
    document.getElementById(divid).className=thecl;
  }
}

function shsubm(id, nbid) {
  var i=0;
  if (document.getElementById("sub_"+id).style.display == "") {
    var closesm = true;
  }
  while (i<nbid) {
    i++;
    document.getElementById("sub_"+i).style.display="none";
  }
  if (closesm != true) {
    document.getElementById("sub_"+id).style.display="";
  }
}

function showres(critere) {
  jx('?c=1&keyword='+document.frm_search.keyword.value+'&sec_ent='+document.frm_search.sec_ent.value+'&sec_act='+document.frm_search.sec_act.value, '/rech_res.php', 'resultats', 0);
  return false;
}

function reg_mem() {
  jx('?lv=1&l='+document.frm_sub.langue.value+'&sufirstname='+document.frm_sub.sufirstname.value+'&sulastname='+document.frm_sub.sulastname.value+'&suemail='+document.frm_sub.suemail.value, '/colonne/subscribe.php', 'col_sub', 0);
  return false;
}

function mycarousel_initCallback(carousel) {
  carousel.buttonNext.bind('click', function() {
    carousel.startAuto(0);
  });

  carousel.buttonPrev.bind('click', function() {
    carousel.startAuto(0);
  });

  carousel.clip.hover(function() {
    carousel.stopAuto();
  }, function() {
    carousel.startAuto();
  });
};

