// JavaScript Document
// current issues function


//-----------------------
function changeObjContent(idObj,titleObj,contentObj){
	MM_findObj('main_page_bg').innerHTML="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"475\"><tr><td valign=\"top\" class=\"bgr\"><table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr><td height=\"323\" class=\"city_font14_blue\" id=\"main_page_text\"><? echo _home_txt_1; ?></td></tr><tr><td height=\"100\">&nbsp; </td></tr></table></td></tr></table>";
	MM_findObj(idObj).innerHTML = "<br><br><span class='city_font14_blue'>"+titleObj+"</span><br><br><span class='city_font12_black'>"+contentObj+"</span>";

}

// news function (not used)
//-------------------------
function getNews(list){
var valList = list.options[list.selectedIndex].value;
document.location="index_news.php?newsDate="+valList;
}

// menu and links displaying functions
//------------------------------------
function linkOn(menutxt){
menutxt.style.background="#394da2";
menutxt.style.color="#ffffff";
}
function linkOff(menutxt){
menutxt.style.background="#e3e5f0";
menutxt.style.color="#394da2";
}

function menuOn(menutxt,calq){
MM_findObj(menutxt).style.background="#e3e5f0";
MM_findObj(menutxt).style.color="#000000";
if (calq!="") MM_findObj(calq).style.visibility="visible";

}
function issuesOff(menutxt){
MM_findObj(menutxt).style.background="";
MM_findObj(menutxt).style.color="#ffffff";
}
function issuesOn(menutxt){
MM_findObj(menutxt).style.background="#e3e5f0";
MM_findObj(menutxt).style.color="#000000";
}

function menuOff(menutxt,calq){

MM_findObj(menutxt).style.background="";
MM_findObj(menutxt).style.color="#ffffff";
if (calq!="") MM_findObj(calq).style.visibility="hidden";

}
function menuOffMod(menutxt,calq){
MM_findObj(menutxt).style.background="#e3e5f0";
MM_findObj(menutxt).style.color="#000000";
if (calq!="") MM_findObj(calq).style.visibility="hidden";
}

// status bar content
//-------------------
window.status="City-Learning Web Site";

//*******************************************************
// Scrollable Layer
<!--
	var  end_load = 0;    // = 1 si fin de chargement du club
	var MyBox = null;
	
	function Init()		// initialisation du défilement bandeau gauche
	{
	MyBox = new Box('MyBox', 'conteneur', 1, 50, 2000, 25);
	if (end_load == 1) MyBox.start();
	}
//*******************************************************

// macromedia functions
//----------------------
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}


function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}


function resetSelf(objName,newText) { //v3.0
  objName.value = newText;
}
function fillField(list,place){
var myindex=list.selectedIndex;
var myresult=list.value;
MM_findObj(place).value = list.value;

}

function dispOther(toDisp,state){
MM_findObj(toDisp).style.visibility=state;
}

// Validate contact form
function validContact(){
	var fArray = new Array("name","company name","email address");
  var count,i,p,q,nm,test,num,min,max,errors='',args=validContact.arguments;
  count=0;
  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+='- the e-mail address is not valid.\n';
      		}
			else 	if (test!='R')
					{
						num = parseFloat(val);
					}
			}
			else if (test.charAt(0) == 'R') errors += '- '+fArray[count]+' is required.\n';
		}
		count++;
  }

  if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

// Fill in a hidden text field
function fillCheck(nbItem){

MM_findObj('textHidden').value="";
	for (var i=1;i<=nbItem;i++){
	  if(document.getElementById('item' + i)){
		if (MM_findObj('item'+i).checked){
		    //alert("CHECKED: " + MM_findObj('item'+i).value);
		    MM_findObj('textHidden').value+=MM_findObj('item'+i).value+"|";
		}else{
		    //alert("UNCHECKED: " + MM_findObj('item'+i).value);
		}
          }else{
		//alert("notelementbyid");
	  }

	}
}
// Flag News
function checkFlag(field){
if (MM_findObj('checkNews').checked){
MM_findObj(field).value=1;
}
else
{
MM_findObj(field).value=0;
}

}

// Validate Login

function MM_validateLogin() {
	var fArray = new Array("email address","password");
  var count,i,p,q,nm,test,num,min,max,errors='',args=MM_validateLogin.arguments;
  count=0;
  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+='- the e-mail address is not valid.\n';
		  }
		  else if (test!='R')
				{
					num = parseFloat(val);
					if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
				}
		}
		else if (test.charAt(0) == 'R') errors += '- '+fArray[count]+' is required.\n';
		}
		count++;
  	}
  if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


