// JavaScript Document
function starforfait(theURL)
{ 
  //alert();
  pw=window.open(theURL,'ppop2','scrollbars=YES,top=10,left=10,resizable=NO,width=900,height=700');
  pw.window.focus();
}
function pwin2(theURL)
{ 
  //alert();
  pw=window.open(theURL,'ppop2','scrollbars=YES,top=10,left=10,resizable=NO,width=500,height=550');
  pw.window.focus();
}
function fwin(theURL) { //v2.0
  pw2=window.open(theURL,'fpack','scrollbars=YES,resizable=NO,width=740,height=510');
  pw2.window.focus();
}
function fullwin(theURL) { //v2.0
  //pwfull=window.open(theURL,'fullpack','scrollbars=YES,resizable=YES,top=1,left=1,width='+screen.availWidth+',height='+screen.availHeight);
  var ww = screen.availWidth - 10;
  var hh = screen.availHeight - 10;
  alert( ww + ' _ ' + hh);
  pwfull=window.open(theURL,'fullpack','toolbar=YES,status=YES,menubar=YES,location=YES,scrollbars=YES,resizable=YES,top=1,left=1,width='+ww+',height='+hh);
  pwfull.window.focus();
}
function inscription()
{
  le_mail = nlh2.mail.value;
  if (le_mail !='') {
  //	alert(le_mail);
	if (MM_validateForm('mail','','isEmail')){ 
	  //alert(le_mail);
      //url_str = 'newsletter.asp?lan=fr&action=abo&serv=<%=site_code%>&langue=fr&mail=' + le_mail;
	  url_str = 'newsletter.asp?action=abo&serv=<%=site_code%>&mail=' + le_mail;
	  //alert(url_str);
      popup =window.open(url_str,'nlhome2','scrollbars=no,status=no,width=450,height=270');
	  popup.window.focus();
	}
  } else { 
    alert('Vous devez préciser un email...'); 
    return;
  }

}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { 
  	test=args[i+2]; 
	val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- l\'adresse e-mail n\'est pas valide.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' doit contenir un chifres.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' doit contenir chifres antre '+min+' et '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') erreurss += '- '+nm+' est obligatoire.\n'; }
  } 
  if (errors) alert('Erreur:\n'+errors); 
  return (errors == '');
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function gal_win(le_url,hh,ww, titre) {
//'articles.asp?id=4821&amp;popup=1'
	le_url = le_url +'&amp;TB_iframe=true&amp;height=' + hh + '&amp;width=' + ww;
	//alert(le_url);
	//document.getElementById("tetiere").style.visibility = "hidden";
	TB_show(titre, le_url, false);

}
function visu_galeries(le_type,le_theme,gale_type,titre)
{

  switch (le_type) {
	case  'galerie' :
		le_link = "visu-galeries/gal_visu.asp?site=SCIJ&amp;le_type=galerie&amp;theme="+le_theme+"&amp;galerie_type="+gale_type ;
		//le_link = "visu-galeries/aa.asp?site=SCIJ&amp;le_type=galerie&amp;theme="+le_theme+"&amp;galerie_type="+gale_type ;
		gal_win(le_link,570,700,titre);
		//pw2=window.open(le_link,'gfpack','scrollbars=NO,resizable=NO,width=700,height=560,top=1,left=1');
  		//pw2.window.focus();
		break;
	case 'diapo' :
		le_link = "diapo_visu.asp?site=tourisme_de_terroir&amp;le_type=diapo&amp;theme="+le_theme ;
		pw3=window.open(le_link,'dfpack','scrollbars=NO,resizable=NO,width=270,height=330,top=1,left=1');
  		pw3.window.focus();
		break;
  }
}

function visu_panorama()
{
		le_link = "panorama/principal_out.html?id=11" ;
		gal_win(le_link,495,780,"Panorama");
}
function visu_galeries_old(le_type,le_theme,gale_type)
{
	if ( le_type == 'galerie' )
	{
		le_link = "gal_visu.asp?site=SCIJ&le_type=diapo&theme="+le_theme+"&galerie_type="+gale_type ;
		pw2=window.open(le_link,'gfpack','scrollbars=NO,resizable=NO,width=600,height=490,top=1,left=1');
  		pw2.window.focus();
	}
	if ( le_type == 'diapo' )
	{
		le_link = "diapo_visu.asp?site=SCIJ&le_type=diapo&theme="+le_theme ;
		pw3=window.open(le_link,'dfpack','scrollbars=NO,resizable=NO,width=270,height=330,top=1,left=1');
  		pw3.window.focus();
	}
}
function winsndart(theID) { //v2.0
  pw32=window.open('envoyez-article.asp?id='+theID,'fp2ack','scrollbars=NO,resizable=YES,width=850,height=600');
  pw32.window.focus();
}
/*
* Le code suivant va apprendre la balise blink ŕ IE
*/
if ( document.all )
{
	function blink_show()
	{
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ )
		{
			blink_tags[i].style.visibility = 'visible';
		}
		
		window.setTimeout( 'blink_hide()', 700 );
	}
	
	function blink_hide()
	{
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ )
		{
			blink_tags[i].style.visibility = 'hidden';
		}
		
		window.setTimeout( 'blink_show()', 250 );
	}
	
	window.onload = blink_show;
}
