//
//	Name: prevImage, nextImage, specificImage
//	Author: theodore peristeris
//	Date: 29/06/02
//	Desc: These routines will cause an existing image, to be replaced by another.
//        Image names must be of the form name_nn.ext, where "name" is any name, "nn"
//        are digits, and "ext" is any graphic extension (e.g.  photo_01.jpg, photo_02.jpg, etc...)
//		  Image indexes must start at one (e.g. groupphoto_01.gif)
//
//        These routines are invoked when clicking the up "previous" or "next" navigation
//		  arrows, which should be on the screen.  The arrows must be made to appear faded
//        when the selections they represent (prev, and next) must not be used.  For
//        example, when viewing the 1st image, the "previous" arrow is made diabled).
//
//        Finally, for this code to work, the images themselves must be given appropriate "name" attributes
//        (for example <img src'./images/photo_01.jpg' name="studentImg' alt='grad students'>  )

textekdi	= new Array("\n     Δέκα χρόνια Σχολής με Διεύθυνση Μαίρης Βογιατζή Τράγκα",
						"\n     25 Μαρτίου στη Βουλή των Ελλήνων",
						"\n     25 Μαρτίου στη Βουλή των Ελλήνων",
						"\n     28 Οκτωβριου - Φιλολογικός Σύλλογος Παρνασσός",
						"\n     Αγιασμός, Απονομή Διπλωμάτων στο Θέατρο \'Έναστρον\'",
						"Ο Αρχιεπίσκοπος Αθηνών και πάσης Ελλάδος\nκ.Χριστόδουλος τίμησε με την παρουσιασή του στο\nΘέατρο \"Έναστρον\" την παράσταση \"Εγώ ο Ντοστογιέφσκι\"\nμε την Τζένη Ρουσσέα και τον Χρήστο Τσάγκα ",
						"28 Οκτωβρίου");
textekdiEN	= new Array("\n     The School celebrates its ten-year anniversary",
                        "\n     March 25th - at the Hellenic Parliament",
                        "\n     March 25th - at the Hellenic Parliament",
                        "\n     28th of October - the \'Parnassos\' Cultural Society",
                        "\n     Receiving diplomas, at the \'Enastron\' Theater",
                        "");

textdiploma	= new Array("\n      Κωστής Παλαμάς, Μορφωτικός Σύλλογος Μεσολογγίου",
						"\n      Κέντρο Ελληνικής Λογοτεχνείας Κωστής Παλαμάς",
						"\n     Από το Σπίτι της Ευρωπής και τους \n Lions Αθηνών - Πνύκα",
						"\nΔΙΟΙΚΗΣΗ ΟΜΟΣΠΟΝΔΙΑΣ ΔΙΕΘΝΩΝ ΛΕΣΧΩΝ ΛΑΪΟΝΣ 118Τ\n40 ΧΡΟΝΙΑ ΥΠΗΡΕΤΟΥΜΕ ΜΕ ΑΓΑΠΗ\n\nΕΓΓΡΑΦΟ ΕΥΧΑΡΙΣΤΙΩΝ\nΠρος ΣΧΟΛΗ ΘΕΑΤΡΟΥ ΑΞΙΟΤΙΜΗΣ ΜΑΙΡΗ ΒΟΓΙΑΤΖΗ ΤΡΑΓΚΑ\n\nΗ πολύτιμη εργασία και προσφορά σας σρην χώρα μας και στους ανθρώπους μας κατά την περίοδο εργασίας 2002-2003, που είναι το 40 έτος του Λαϊονισμου στην Τουρκία, με την πίστη σας στην επιτυχία του δύσκολου, θα εξακολουθήσουν να αποτελούν παραδειγμα κάθε περίοδο. ",
						"\n     Σκηνικό της Παράστασης Βάκχες",
						"\n     Βραβείο Ουνέσκο: καλύτερης Παρουσίας Σχολής, με το έργο \n Η Σφίγγα γελάεί πάντα \n Ανώτερη Σχολή Δραματικής Τέχνης\n Μαίρης Βογιατζή Τράγκα  \n Hyperion 2002",
						"\n     Βραβείο Διοργάνωσης Hyperion: καλύτερης Παρουσίας Σχολής, με το έργο \n Η Σφίγγα γελάεί πάντα \n Ανώτερη Σχολή Δραματικής Τέχνης\n Μαίρης Βογιατζή Τράγκα  \n Hyperion 2002",
						"\n     Βραβείο Ουνέσκο: Πρώτου Αντρικού ρόλου, Γιώργος Χουλιάρας \n Hyperion 2002",
						"\n     Βραβείο Διοργάνωσης Hyperion: Πρώτου Γυναικείου ρόλου, Ελισάβετ Αριστοτέλους \n Hyperion 2002",
						"\n     Βραβείο Διοργάνωσης Hyperion: Πρώτου Αντρικού ρόλου, Γιώργος Χουλιάρας Hyperion 2002");
textdiakr	= new Array("\nΑναμνηστική φωτογραφία μετά την θριαμβευτική παράσταση στην Κωνσταντινούπολη κ.κ.Τράγκα,ο Γεν.Διοικητής της  Ομοσπονδίας Διεθνών Λεσχών κ. Αλί Σουάτ Ερντουράν .Η Θεατρική Ομάδα της Σχολής και μέλη της Ομοσπονδίας.\n\n10 Μαίου 2003\nΚωνσταντινούπολη",
						"\nΟ Γενικός Διοικητής της Ομοσπονδίας  Διεθνών Λεσχών Λάϊονς κ. Αλί Σουάτ Ερντουράν και ο Καθητητής - Διεθνολόγος του Παντείου Πανεπιστημίου προσφέρουν  Τιμητικό Δίπλωμα ευχαριστιών στην κ. Μαίρη Τράγκα και  1 υποτροφία σε σπουδαστή της Σχολής.",
						"\nΗ Μαίρη Τράγκα με τον Σκηνοθέτη και Καθηγητή της Σχολής κ.Βασίλη Ρίτσο και με την θεατρική ομάδα των Σπουδαστών που βραβεύτηκαν στο Διεθνές Φεστιβάλ Δραματικών Σχολών στο Βουκουρέστι.",
						"\n     Μαίρη Τράγκα με τον Σκηνοθέτη και Καθηγητή της Σχολής κ.Βασίλη Ρίτσο και με την θεατρική ομάδα των Σπουδαστών στο Εθνικό Θέατρο Βουκουρεστίου",
						"\n     Ο Σκηνοθέτης και Καθηγητής της Σχολής κ.Βασίλη Ρίτσο στην παραλαβή του θεατρικού βραβείου",
						"\n     Η απόφοιτος της Σχολής Ελισάβετ Αριστοτέλους στην παραλαβή του Θεατρικού Βραβείου",
						"\n     Η Θεατρική ομάδα και η Διευθύντρια της Σχολής μετά την αναγγελία της επιτυχίας",
						"\n     Ο Απόφοιτος της Σχολής Γιώργος Χουλιάρας, στην παραλαβή τπυ θεατρικού Βραβείου",
						"\n     Η Διευθύντρια της Σχολης Μαίρη Βογιατζή Τράγκα \n Μα τον πρύτανη του Πανεπιστημίου Hyperion",
						"");
function activateNavImg(navimgName)	{
	document.images[navimgName].src=(document.images[navimgName].src).replace('Opaque', '' );
}
function deactivateNavImg(navimgName)	{
	if ((document.images[navimgName].src).search('0.gif') != -1)	{
		document.images[navimgName].src=(document.images[navimgName].src).replace('0.gif', 'Opaque.gif');
	}
	else	{
		document.images[navimgName].src=(document.images[navimgName].src).replace('.gif', 'Opaque.gif');
	}
}
//
//	This function is invoked when the user presses an arrow indicating he wants to see the previous image.
//  Such an arrow, may be either left-pointing (left) or upwards-pointing (prev).
//  For any of the two cases, we establish whether this action causes us to arrive at the first image,
//    in which case the arrow must be replaced by a faded-out copy, showing that the user can't press it
//    (because when you get to the 1st image, there are no more previous images).
//  Also, if we are at the last image, and press just such an arrow (a "prev" or "left" arrow),
//    then the other arrow, corresponding to "next" (downwards-pointing) or to "right" (right-pointing)
//    must be changed from a faded arrow (denoting de-activated) to a normal arrow, thus indicating that the
//    option to view the next image, is now made permissible (since we now have a next image, and are not at
//    the last one).
//
//  This function has increased in complexity, due to a requirement that we can more than one such
//    slide-show image per page, each with its two arrows for viewing the previous and next images.
//  We try to handle this additional complexity, by coding, so that any arrow, which has a prefix of any of
//    the following { prev, next, left, right }, can be properly handled.
//  For example, in one page, the arrows for one image may be named "left" and "right", while for a 2nd image
//    on the same page, they may be named "left1" and "right1".
//
function prevImage(imgName, maxIdx, navImgPrefix, frmNo) {
    if ( (idx = (document.images[imgName].src).search(/_\d{2}/) ) != -1 )    {
		var oldStr = (document.images[imgName].src).substr(idx+1,2);
		if ( ( oldNum = Number(oldStr)) >= 2)	{
			var former = new String() ;
			var subsequent = new String() ;
			// Establish names for "preceeding image", and "following image" nav buttons
			if ( (navImgPrefix.indexOf("prev") != -1) || (navImgPrefix.indexOf("next") != -1) )	{
				if ((former = (navImgPrefix.indexOf("prev") != -1) ? navImgPrefix : "").length > 0)	{
					subsequent = (new String("next")).concat(navImgPrefix.substr(4));
				}
				else {
					subsequent = navImgPrefix ;
					former = (new String("prev")).concat(navImgPrefix.substr(4));
				}
			} else if ( (navImgPrefix.indexOf("left") != -1) || (navImgPrefix.indexOf("right") != -1) )	{
				if ((former = (navImgPrefix.indexOf("left") != -1) ? navImgPrefix : "").length > 0)	{
					subsequent = (new String("right")).concat(navImgPrefix.substr(4));
				}
				else {
					subsequent = navImgPrefix ;
					former = (new String("left")).concat(navImgPrefix.substr(5));
				}
			}
		//		alert("navImgPrefix = " + navImgPrefix + "\nformer = " + former + "\nsubsequent = " + subsequent);
			if (oldNum <= 2)	{	// If moved to 1st image, de-activate prev arrow
				deactivateNavImg(former);
			}
			if (oldNum == maxIdx)	{	// If moved off last image, re-activate next arrow
				activateNavImg(subsequent);
			}
			if ( (newStr = new String(oldNum-1)).length == 1)	{
				newStr = "0" + newStr;
			}
			document.images[imgName].src=(document.images[imgName].src).replace(oldStr, newStr );
			if (document.forms.length >= 1)	{
				if (arguments.length < 4)	{	// If last arg not provided, use 0 as default
					frmNo = 0;	
				}	
				// Test for Win NT 4.0 - this accepts English, but not Greek characters in the text area
	//			if ((navigator.userAgent.indexOf("Windows NT 5.0") == -1) &&
	//				(navigator.userAgent.indexOf("Windows NT") != -1) )	{
	//				eval("document.forms[frmNo].txtArea" +".value=text" + imgName + "EN[" + (oldNum-2) + "];" );
	//			}
	//			else	{
				// Textarea gets new message - in reality, oldNum-2 index corresponds to
				// what we want which is num of newStr, less two, because indicies are zero-based
				eval("document.forms["+frmNo+"].txtArea.value=text" + imgName+ "[" + (oldNum-2) + "];" );
	//			};
			};
		}
    }
}
function nextImage(imgName, maxIdx, navImgPrefix, frmNo) {
    if ( (idx = (document.images[imgName].src).search(/_\d{2}/) ) != -1 )    {
		var oldStr = (document.images[imgName].src).substr(idx+1,2);
		if ( ( oldNum = Number(oldStr)) < maxIdx)	{
			var former;
			var subsequent;
			
			// Establish names for "preceeding image", and "following image" nav buttons
			if ( (navImgPrefix.indexOf("prev") != -1) || (navImgPrefix.indexOf("next") != -1) )	{
				if ((former = (navImgPrefix.indexOf("prev") != -1) ? navImgPrefix : "").length > 0)	{
					subsequent = (new String("next")).concat(navImgPrefix.substr(4));
				}
				else {
					subsequent = navImgPrefix ;
					former = (new String("prev")).concat(navImgPrefix.substr(4));
				}
			} else if ( (navImgPrefix.indexOf("left") != -1) || (navImgPrefix.indexOf("right") != -1) )	{
				if ((former = (navImgPrefix.indexOf("left") != -1) ? navImgPrefix : "").length > 0)	{
					subsequent = (new String("right")).concat(navImgPrefix.substr(4));
				}
				else {
					subsequent = navImgPrefix ;
					former = (new String("left")).concat(navImgPrefix.substr(5));
				}
			}
		//		alert("navImgPrefix = " + navImgPrefix + "\nformer = " + former + "\nsubsequent = " + subsequent);
			if (oldNum == 1)	{	// If moved off 1st image, activate prev arrow
				activateNavImg(former);
			}
			if (oldNum >= maxIdx - 1)	{	// If moved on to last image, de-activate next arrow
				deactivateNavImg(subsequent);
			}
			if ( (newStr = new String(oldNum+1)).length == 1)	{
				newStr = "0" + newStr;
			}
			document.images[imgName].src=(document.images[imgName].src).replace(oldStr, newStr );
			if (document.forms.length >= 1)	{
				if (arguments.length < 4)	{	// If last arg not provided, use 0 as default
					frmNo = 0;	
				}	
				// Test for Win NT 4.0 - this accepts English, but not Greek characters in the text area
	//			if ((navigator.userAgent.indexOf("Windows NT 5.0") == -1) &&
	//				(navigator.userAgent.indexOf("Windows NT") != -1) )	{
	//				eval("document.forms[frmNo].txtArea" + ".value=text"+imgName+"EN["+oldNum+"];");
	//			}
	//			else	{
					// Textarea gets new message - in reality, oldNum index corresponds to
					// what we want which is num of newStr, less one, because indicies are zero-based
				eval("document.forms["+frmNo+"].txtArea.value=text"+imgName+"["+oldNum+"];");
	//			};
			};
		}
    }
    return;
}
function specificImage(imgName, imgIdx, maxIdx, navImgPrefix) {
    if ( (idx = (document.images[imgName].src).search(/_\d{2}/) ) != -1 )    {
		var oldStr = (document.images[imgName].src).substr(idx+1,2);
		if ( ( oldNum = Number(oldStr)) != imgIdx)	{	//  Do only if not already displaying image
		
			var former;
			var subsequent;
			
			if ((navImgPrefix == "prev") || (navImgPrefix == "next"))	{
				former="prev";	subsequent="next"
			}
			else if ((navImgPrefix == "left") || (navImgPrefix == "right"))	{
				former="left";	subsequent="right"
			}
			
			if (imgIdx <= 1)	{	deactivateNavImg(former);	}
			else	{				activateNavImg(former);		}
			
			if (imgIdx >= maxIdx)	{	deactivateNavImg(subsequent);	}
			else	{					activateNavImg(subsequent);		}
			
			if ( (newStr = new String(imgIdx)).length == 1)	{
				newStr = "0" + newStr;
			}
			document.images[imgName].src=(document.images[imgName].src).replace(oldStr, newStr );
		}
    }
    return;
}

function doRollOvr(imgName) {
    // If this navigation-item is not named opaque, (and hence it is active) then we do the mouseover
    if ( (document.images[imgName].src).search("Opaque") == -1 )    {
		if ((document.images[imgName].src).search("0.gif") != -1)	{
			document.images[imgName].src=(document.images[imgName].src).replace("0.gif", ".gif" );
		}
		// we want to replace next.gif by next0.gif, or prev,gif by prev0.gif
		// in order to do the rollover
		else if ((document.images[imgName].src).search(/[vt].gif/) != -1)	{
			document.images[imgName].src=(document.images[imgName].src).replace(".gif", "0.gif" );
		}
    }
}

function largeImage(imgIdx, orientation, page)
{
	imgLarge= new Image();
	imgLarge.src = "../images/"+page+"/"+page+"_"+imgIdx+"_F.jpg" ;
	
	var windowName = "photo_"+imgIdx+"_win" ;
	
	if (navigator.appName.indexOf("Microsoft") != -1)	{
		if (orientation == "vert")	{
			// You must return a result to a new object, or screen cursor stays as "hourglass"
			fotoWin = window.open(imgLarge.src, windowName, "width=290, height=424, left=300, top=110, resizable=no" );
		}
		else if (orientation == "horiz")	{
			fotoWin = window.open(imgLarge.src, windowName, "width=418, height=295, left=300, top=210, resizable=no" );
		}
	//	if (typeof(fotoWin) != "undefined")	{
	//		fotoWin.document.body.style.backgroundColor="#fca";
	//	}
	}
	else if (navigator.appName.indexOf("Netscape") != -1)	{
		fotoWin = window.open(imgLarge.src, windowName);
		if (orientation == "vert")	{
			fotoWin.outerWidth=310;		// Putting in open's feature list, does not work
			fotoWin.outerHeight=526;
			fotoWin.moveTo(200,10);
		}
		else if (orientation == "horiz")	{
			fotoWin.outerWidth=430;
			fotoWin.outerHeight=395;
			fotoWin.moveTo(300,20);
		}
	}
	else if ( is_opera6up )	{
		if (orientation == "vert")	{
			// You must return a result to a new object, or screen cursor stays as "hourglass"
			fotoWin = window.open(imgLarge.src, windowName, "width=300, height=414, left=300, top=110, resizable=no" );
		}
		else if (orientation == "horiz")	{
			fotoWin = window.open(imgLarge.src, windowName, "width=426, height=285, left=300, top=210, resizable=no" );
		}
	}
}

function redirectLink() {	//	Re-direct when coming from outside, so all pass through main page
	if (document.referrer == "" || document.referrer.indexOf("www.tragadramaschool.gr") == -1)	{
		window.location = ".."	;
	}
}
function resolver(pgName) 
{
    var pxHeight17inch = 601 ;
	
	if ( typeof(window.screen.height)!="undefined" )	{
		self.location.replace((window.screen.height >= pxHeight17inch ) ? "./mam/" : "./mam");
	} else if ( typeof(screen.availHeight)!="undefined" )	{	// Opera - @1024x768 avail=1024x716
		self.location.replace((screen.availHeight >= pxHeight17inch ) ? "./mam/" : "./mam");
	} else if ( typeof(window.innerHeight)!="undefined" )	{
		self.location.replace((window.innerHeight >= pxHeight17inch ) ? "./mam" : "./mam");
	} else	{	// Other browser - non-standard DOM
		//s="";for(ii in document) s+=ii+":"+document[ii]+"\t";  alert(s); return;
		self.location.replace( "./mam" );
	}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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