
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];}
}

function Validate_Email(the_object) {
	var ok_email = "true";
	var ok_str = "yes"
	var valid_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@-."
    var message1 = "\nAêõñï e-mail";
    var message2 = " (Ëáôéíéêïýò ×áñáêôÞñåò) \n";
	email = the_object.value ;
	temp = email.split("@");
	if ( ! temp[1] || ! temp[0] ) {	ok_email ="false";  }
	else {
		p = temp[1];
		t = p.split(".") ;
		if ( ! t[1]  || ! t[0]  ) { ok_email ="false";  }
		else {
			for (i=0; i<the_object.value.length; i++) {
				tp = "" + the_object.value.substring(i, i+1);
				if (valid_str.indexOf(tp) == "-1") ok_str = "no";
			}
			if (ok_str == "no") {
			   ok_email ="false";
			   message1 = message1 + message2 ;
			}
		}	  
    }
	if (ok_email =="false") {
		alert(message1) ;
		the_object.value="";
		the_object.focus();
	}
	return (ok_email);
}

function Validate_AFM(the_object) {
	var ok_afm = "true";
    var message1 = "\nÁêõñï Á.Ö.Ì.  \n";
	afm = the_object.value ;
    if (afm.length != 9) { 	ok_afm ="false"; }
	else {
		a = "" ;	  c = 0 ;
		for (x = 0 ; x < 8 ; x++) {
		   a = afm.charAt(x)   ;
			psyfio = a.charCodeAt(0) -48 ;
			dinami = 1 ;
			for (i = 0 ; i < 8 - x ; i++) {   dinami *= 2 ;	 }
			c +=  psyfio * dinami ;
		}
		ypolipo = 0 ;  ypolipo = c % 11 ;
		if (ypolipo == 10) { ypolipo = 0 ;} ;
		a = afm.charAt(8)   ;
		psyfio = a.charCodeAt(0) -48 ;
		if ( psyfio != ypolipo) {
		    ok_afm ="false"; 
		}
	}
	if (ok_afm =="false") {
		alert(message1) ;
		the_object.value="";
		the_object.focus();
	}
	return (ok_afm);
}
function Validate_str(the_str,needed) {
	var valid_str1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	var valid_str2 = "ÁÂÃÄ¸ÅÆ¹ÇÈºÉÊËÌÍÎ¼ÏÐÑÓÔ¾ÕÖ×Ø¿Ù ÜáâãäÝåæÞçèßúéêëìíîüïðñóôýõö÷øþù";
	var valid_str3 = "0123456789_@+-,.";
    var te = String.fromCharCode(13,10) ;
	var valid_str = valid_str1 + valid_str2 + valid_str3 + te ;
	var ok_str = "true";
	var tp;
	if (the_str.value!="") {
		//alert(needed);
    	//alert(the_str.value);
		for (i=0; i<the_str.value.length; i++) {
			tp = "" + the_str.value.substring(i, i+1);
			if (valid_str.indexOf(tp) == "-1") ok_str ="false";
		}
		if (ok_str =="false") {
			alert("¸ãêõñïé ×áñáêôÞñåò ("+valid_str+").") ;
			the_str.value="";
			the_str.focus();
		}
	}
	else {
		if (needed==1) {
			alert("Áðáñáßôçôï ðåäßï.") ;
			ok_str ="false";
			the_str.focus();
		}
	}
	return (ok_str);
}
function Validate_num(the_str,needed) {
	var valid_str = "0123456789";
	var ok_str = "true";
	var tp;
	if (the_str.value!="") {
		for (i=0; i<the_str.value.length; i++) {
			tp = "" + the_str.value.substring(i, i+1);
			if (valid_str.indexOf(tp) == "-1") ok_str ="false";
		}
		if (ok_str =="false") {
			alert("¸ãêõñïé ×áñáêôÞñåò (0123456789).") ;
			the_str.value="";
			the_str.focus();
		}
	}
	else {
		if (needed==1) {
			ok_str ="false";
			alert("Áðáñáßôçôï ðåäßï.") ;
			the_str.focus();
		}
	}
	return (ok_str);
}

 function loadframes(page) 
 { 

	parent.frames[4].location.href =  page + "_main.htm";
	parent.frames[1].location.href =  page + "_menu.htm";
	parent.frames[3].location.href =  page + "_title.htm";

 }

 //GLOBALS
	var w3c = (document.getElementById) ? 1:0
	var ns4 = (document.layers) ? 1:0  //browser detect for NS4 & W3C standards
    var hasCookies = false;
  
	// returns an object reference.
	function getObject(obj) {
		if (w3c)
			var theObj = document.getElementById(obj);
		else
			if (ns4)
				var theObj = eval("document." + obj);
		return theObj;
	}
	
	// swaps text in a layer.
	function swapText(text, divID, innerDivID) {
		var content = "<span class=\"commandDesc\">" + text + "</span>";
		if (w3c) {
			var theObj = getObject(divID);
			if (theObj) theObj.innerHTML = text;
		}
    else if (ns4) {
			var innerObj = divID + ".document." + innerDivID;
			var theObj = getObject(innerObj);
			if (theObj) {
				theObj.document.open();
				theObj.document.write(content);
				theObj.document.close();
			}
		}
	}


    
	function showHideModule(divID, theme) {
		var state = toggleFoldyPersistState(divID);
		var ok=false;
		if(w3c) {
			var divIDobj = MM_findObj(divID);
		//	var toggleobj = MM_findObj(divID +"Toggle");
			if(divIDobj != null ) {
				ok=true;
				if(state=="c") {
				//	toggleobj.src=eval(divID + "Toggle_on.src");
					divIDobj.style.display = "none";
				}
				else {
				//	toggleobj.src=eval(divID + "Toggle_off.src");
					divIDobj.style.display = "";
				}
			}
		}
		if(!ok){
			document.location = document.location;
		}
		window.status = '';
	}
	
	function toggleFoldyPersistState(divID) {
		var divIDobj = MM_findObj(divID);
		var state="e";
		if (divIDobj.style.display == "none") {
			state="e";
		}
		else {
			state="c";
		}
		return state;
	}

	
	