//   ************************************************************************//
//   * Module Name		: InitParam.js										*//
//   * Release			: 2.0												*//
//   * Date				: 20/01/2009										*//
//   * Project			: AGSE_TT											*//
//   * Author			: aCOSwt											*//
//   * Description		: Scripts associated with Parametres.html			*//
//   * History			: 1.0 : First Site Version							*//
//	 *					: 1.1 : Update 2008									*//
//	 *					: 2.0 : Update regarding new ids and new cookies	*//
//   * Language			: JavaScript										*//
//   * Compatibility	: FireFox 2 - IE 7 - Opera 9 - Konqueror 3			*//
//   ************************************************************************//
	
//**************************** Page Inistializations ************************//

function InitParam(){

	var	i, j, z, formul, cookbk, cookid, ids, bks;
	
	initPage(1,0,8);
	ids=new Array();
	bks=new Array();
	cookid=readCookie("myAGSEuids");
	if(cookid)
		ids=cookid.split('/');
	cookbk=readCookie("myAGSEBk");
	if(cookbk)
		bks=cookbk.split('/');
	for(j=1,z=0;j<5;j++,z++)
		for(i=1;i<_AtoID.length;i++){
			formul=document.forms["FRMNAM_"+j].elements["SLCT_"+j];
			formul.options[formul.options.length] = new Option(_MB[_AtoID[i]][1]+" "+_MB[_AtoID[i]][2],'');
			if(z<ids.length)
				if(_AtoID[i]==ids[z])
					formul.options[formul.options.length-1].selected=true;}
	for(j=6,z=0;j<10;j++,z++)
		for(i=1;i<PageList.length;i++){
			formul=document.forms["FRMNAM_"+j].elements["SLCT_"+j];
			formul.options[formul.options.length] = new Option(PageList[i][0],'');
			if(z<bks.length)
				if(bks[z]==(i))
					formul.options[formul.options.length-1].selected=true;}}
		
//*************************** Preferences Submit ****************************//
		
function SubmitForm(){

	var	i, ident, cookieVal, mod;

	mod=0;
	for(i=1,cookieVal="";i<5;i++){
		ident=document.forms["FRMNAM_"+i].elements["SLCT_"+i].selectedIndex;
		if(ident)
			cookieVal=cookieVal+_AtoID[ident]+"/";}
	if(cookieVal!=""){
		createCookie("myAGSEuids",cookieVal.substring(0,cookieVal.length-1),365);
		mod=1;}
	for(i=6,cookieVal="";i<10;i++){
		ident=document.forms["FRMNAM_"+i].elements["SLCT_"+i].selectedIndex;
		if(ident)
			cookieVal=cookieVal+ident.toString()+"/";}
	if(cookieVal!=""){
		createCookie("myAGSEBk",cookieVal.substring(0,cookieVal.length-1),365);
		mod=1;}
	if(mod)
		document.getElementById("VALID").style.backgroundColor="green";}