/* jr 111209 updated according to usage tests with my_gallery site */
/* jr 120110 adapted to AS site home & 2 main pages */

/* 
caution: to use properly this script one must set up:
(i) in each html widow of this family:
(i1) its number with /<script type="text/javascript">win_nbr=?;</script>
(i2) back & forth links with: onclick="my_pop(??); return false;"
(dont' forget to change possible attributes 'href' & 'target' in each 'a' tag and/or add the 'back button' image -and its css selectors !-)
(i3) add the js script link to backnforth.js such as ... <script type="text/javascript" src="/HOME/backnforth_0.js"></script>
(ii) set the variables 'disp' below for each window
(iii) caution with 'nod' points such as 'prose_main.htm (can't just call the 2 backnforth_?.js scripts -> mixup leading to errors -in error console- in calling twice the vars & functs !? must implement all the dsip[?] below in just one js)
*/

//--------- tools used to build key display data below -----------------

function f_specs(a,b,c,d,z){dir=z;loc=z;men=z;res=z;scl=z;sta=z;tit=1;too=z;return "'channelmode=0,directories="+dir+",fullscreen=0,location="+loc+",menubar="+men+",resizable="+res+",scrollbars="+scl+",status="+sta+",titlebar="+tit+",toolbar="+too+",width="+a+",height="+b+",left="+c+",top="+d+"'";};
//z=1 : default; //n.b. tit forced to 1

//reminders method window.open()=(url,name,specs); specs'default (no mandatory order):'channelmode=0,directories=1,fullscreen=0,location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1,width=...,height=...,left=...,top=...'; location (= address field); titlebar ( = may be ignored in 'no-trust' cases); n.b. IE only: channelmode (= theater mode), directories (= directory buttons), fullscreen, top (in pixels); n.b. width, height : 100 mini;
 //(quote) ...window feature in IE that's similar to "fullscreen" ...is "channelmode". With "channelmode" turned on, the window also expands to cover the entire screen, but is more user friendly in the sense that the window's title bar is preserved, allowing the user to easily close this window.(unquote)

function f_disp(u,n,w,h,x,y,t) {this.u=u; this.n=n; this.w=w; this.h=h; this.x=x; this.y=y; this.specs=f_specs(w,h,x,y,t);};
//function 'object constructor': display charact. of frames -window or tab-
//caution to this syntax here see http://www.w3schools.com/js/js_objects.asp 

//--------- tools used to build key display data below [end]----------


//------------------------ global variables-----------------------------
//decl of vars mandatory otherwise console error stoping process in funcs below

//var win_nbr; //var already declared/defined in html code with 
//<script type="text/javascript">win_nbr=3;</script>

var win = new Array();
var disp = new Array(); 
//bp = "../"; //to be used if files located in sub-files

//------ display data of various windows (mom & popups) ---------
// data below [u(rl),n(ame),w(idth),h(eight),x(left),y(top),specs]
// 1st one [0] is my 'mom' window, others [i>0] are my 'pop' windows

disp[0] = new f_disp('/index.html','home',800,700,1,1,1);
disp[1] = new f_disp('/POEMES/poemes_frames.html','poemes',900,900,600,1,1);
disp[2] = new f_disp('/PROSE/prose_main.htm','prose',600,900,550,1,1);

disp[54] = new f_disp('/PROSE/PROSE_4/ind_pr_4.php','pr_4',600,900,1000,1,1);

disp[731] = new f_disp('/JOURNAL/110207_journal_extrait/110207.htm','110207',1000,1000,1,1,1);
disp[732] = new f_disp('/JOURNAL/110501_le_totalitarisme/110501.htm','110501',1000,1000,1,1,1);
disp[733] = new f_disp('/JOURNAL/111006_Steve_Jobs_Apple/111006.htm','111006',1000,1000,1,1,1);
disp[734] = new f_disp('/JOURNAL/120104_acceleration_histoire/120104.htm','120104',1000,1000,1,1,1);
disp[735] = new f_disp('/JOURNAL/120213_meme/120213.htm','120213',1000,1000,1,1,1);

disp[80] = new f_disp('/MUSIC/Aragon_Bierstube/Aragon_Bierstube.htm','Bierstube',1000,1000,1,1,1);
disp[81] = new f_disp('/MUSIC/Candyman/Candyman.php','Candyman',1000,1000,1,1,1);
disp[82] = new f_disp('/MUSIC/Dance_me/Dance_me.htm','Dance_me',1000,1000,1,1,1);
disp[83] = new f_disp('/MUSIC/Nostalgie/Nostalgie.htm','Nostalgie',1000,1000,1,1,1);
disp[831] = new f_disp('/MUSIC/Nostalgie/Moustaki/Moustaki_bio.htm','Moustaki_bio',900,900,600,1,1);

disp[90] = new f_disp('/RECETTES/recettes.htm','recettes',550,900,1,1,1);

//--  display data of various windows (mom & popups) [end] ------

//------------------------ global variables [end]----------------------


//------------------------ fuction my_pop() ----------------------------

function my_pop(p) {
if(!win[p] || win[p].closed) 
{
win[p] = window.open(disp[p].u,disp[p].n,disp[p].specs);
};//end if
win[p].resizeTo(disp[p].w,disp[p].h);//most browsers except Op and Ch
win[p].moveTo(disp[p].x,disp[p].y);
win[p].focus();//all major browsers, but may not work if tabs (Firefox...)
//partly redundant but 'top' IE only; Opera moveTo(0,0) top left corner of browser, not screen (?); Safari: bug, use (0,1) instead of (0,0)
}//end func my_pop

// ------------------ fuction my_pop() [end] ------------------------



// ------------------ function setThisWindow() ----------------------------
// identifying the calling/associated html window of this global js script

window.name = disp[win_nbr].n;
win[win_nbr] = window.self;//(1)

// ------------------ function setThisOpener() ----------------------------
// identifying the possible opener of this calling/associated html window

if(!(window.opener==null)) {
r = window.opener.win_nbr;//opener's own win_nbr, a different win_nbr
win[r] = window.opener;//(2)
}

//-----------------  self loading/resizing  -------------------------

my_pop(win_nbr);



