// Check if search field is filled
function check_search(){
value=document.atomz.elements['sp-q'].value;
	if(value == "" || value == "Search"){
		alert("Please enter your search term");
		return false;
	}else{
		return true;
	}
}

// Cleanup default search field content
function clear_field(thefield){
	if(thefield.defaultValue == thefield.value){
		thefield.value = "";
	}
} 

/***********************/
// Code Macromedia
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

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;
}

/***********************/

// Classic popup window set sb to 1 to show scrollbars
//HREF="javascript:open_window('http://','500','550','1')"
function open_window(url, w, h, sb){
	var t = (screen.height-w)/2;
	var l = (screen.width-w)/2;
	win = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + sb + ',resizable=0,width=' + w + ',height=' + h + ',top=' + t + ',left=' + l + '');
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

// Create thumbnail image with popup link
function show_thumb(thumb_path, image_path){
	document.write('<A HREF="javascript:open_image(\''+image_path+'\')"><IMG SRC="'+thumb_path+'" HSPACE=0 VSPACE=0 BORDER=0 ALT="Click to zoom image"></A>');
}

// Popup image window that automaticaly fits image size
function open_image(image_path){
	i1 = new Image;
	i1.src = image_path;
	html = '<HTML><HEAD><TITLE>Image</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER><IMG SRC="'+image_path+'" BORDER=0 NAME=PopupImage onLoad="window.resizeTo(document.PopupImage.width+14,document.PopupImage.height+32)"></CENTER></BODY></HTML>';
	win = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
	win.document.open();
	win.document.write(html);
	win.document.close();
}

// Attente validation
function form_wait(form_name){
	form_name.submit_bt.value = "Please wait...";
	form_name.submit_bt.disabled = true;
	form_name.submit();
}


// Confirmation de formulaire
function confirm_link(theLink, item, msg){
	
	var msg_txt = 'WARNING ! \nDo you really want to perform this action ?';
	
//	if(msg == 1){
//		
//	}else if(msg == 2){
//		
//	}
	
	var is_confirmed = confirm(msg_txt);
	
	if (is_confirmed) {
		theLink.href;
	}
	
	return is_confirmed;
}


// Confirmation et attente
function check_it(form_name){
	
	var msg_txt = 'Did you carrefully double checked the data you\'re about to sent to the Treasurer?\n\nOnce accepted, it can\'t be cancelled.';
	
	if(!confirm(msg_txt)){
		return false;
	}
	
	form_wait(form_name);
	return false;
}

// Masquage du ligne selon l'option choisie
function switch_row(val){
	
	var row_id = document.getElementById("row1");
	
	if(val > 1){
		row_id.style.display = "";
	}else{
		row_id.style.display = "none";
	}
}

function show_hide(ref) {
	var id_element1 = document.getElementById(ref+"_data");
	//var id_element2 = document.getElementById(ref+"_txt");
	if( id_element1.style.display != "none" ){
		id_element1.style.display = 'none';
		document.getElementById(ref+"_txt").innerHTML = 'Show more upcoming events';
	}else{
		id_element1.style.display = '';
		document.getElementById(ref+"_txt").innerHTML = 'Hide upcoming events';
	}
}

// Rendre un texte clignotant
function startBlink() {
  // Make sure it is IE4
  if (document.all){
	 setInterval("doBlink()",400);
  }
}

function doBlink() {
  var blink = document.all.tags("BLINK");
  for (var i=0; i < blink.length; i++){
	 blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "";
  }
}

// script gestion du menu ACTION
	domok = document.getElementById;
	var pos_left;
	var ps_top;
	// Repère la position du pointeur
	function menu_get_pos(){
		if (domok){
			if(navigator.appName.substring(0,3) == "Net")
				document.captureEvents(Event.MOUSEMOVE);
		var x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
		var y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
		pos_left = x - 400;
		ps_top = 2;
		}
	}
	// Repère la position du pointeur et affiche le menu
	function menu_close(data_menu){
		var layer_style = document.getElementById("menu_pi").style;
		var content = "<TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' BGCOLOR='#FFE9D2' WIDTH='100%' HEIGHT='100%' STYLE='border:1.5pt solid #4063ae'>";
		content +="<TR><TD ALIGN='CENTER' HEIGHT='22' STYLE='border-bottom:1.5pt solid #4063ae'><B>Quick Access to the Pratical Information</B></TD></TR><TR><TD>";
		content += data_menu;
		content +="<TR><TD ALIGN='RIGHT' STYLE='border-top:1pt solid #4063ae'><I><A href='javascript:;' Onclick='close_menu()'>Close</A></I></TD></TR><TR><TD>";
		content +="</TD></TR></TABLE>";
		if (domok){
		  	document.getElementById("menu_pi").innerHTML = content;
		  	layer_style.visibility = "visible";
			layer_style.left = pos_left;
			layer_style.top = ps_top;
	  	}
	}
	// Efface le menu
	function close_menu(){
		var layer_style = document.getElementById("menu_pi").style;
		if (domok){
			layer_style.visibility = "hidden";
			document.getElementById("menu_pi").innerHTML = '';
		}
	}
	
	
////// Fonction pour Online Meeting Registration
// Confirmation et attente
function omr_check_it(form_name){
	
	var msg_txt = 'Did you carefully double-check the data you are about to send to the meeting organisers?\n';
	
	if(!confirm(msg_txt)){
		return false;
	}
	
	form_wait(form_name);
	return false;
}
////////////////////////////////////////////////