﻿//disable right click
//document.oncontextmenu=new Function("return false")


	//Scripts for the image loading
// Set speed (milliseconds)
var speed = 4000
// Set Picture Array
var Pic = new Array()

// Set Pics

//Pic[0] = 'site_images/front/front15.jpg'
Pic[0] = '/ethelsite/site_images/front/front20b.jpg'


Pic[1] = '/ethelsite/site_images/front/front29b.jpg'
Pic[2] = '/ethelsite/site_images/front/front26b.jpg'
Pic[3] = '/ethelsite/site_images/front/front34b.jpg'


Pic[4] = '/ethelsite/site_images/front/front2b.jpg'
Pic[5] = '/ethelsite/site_images/front/front24b.jpg'
Pic[6] = '/ethelsite/site_images/front/front9b.jpg'
Pic[7] = '/ethelsite/site_images/front/front28b.jpg'


Pic[8] = '/ethelsite/site_images/front/front15b.jpg'



Pic[9] = '/ethelsite/site_images/front/front37b.jpg'
//Pic[13] = '/ethelsite/site_images/front/front2b.jpg'


//Pic[2] = 'site_images/front/front8.jpg'
/**
Pic[4] = 'site_images/front/front9.jpg'
Pic[5] = 'site_images/front/front19.jpg'
Pic[6] = 'site_images/front/front17.jpg'
Pic[7] = 'site_images/front/front10.jpg'
Pic[8] = 'site_images/front/front12.jpg'
Pic[9] = 'site_images/front/front18.jpg'

Pic[10] = 'site_images/front/front16.jpg'
Pic[11] = 'site_images/front/front1.jpg'

Pic[13] = 'site_images/front/front21.jpg'
Pic[14] = 'site_images/front/front22.jpg'

**/



var t
var j = 0
var p = Pic.length

var preLoad = new Array()
	for (i = 0; i < p; i++){
	preLoad[i] = new Image()
	preLoad[i].src = Pic[i]
}

function runBGSlideShow(){
if (document.body){

document.getElementById('header').style.backgroundImage  = "url("+Pic[j] +")";<!---Here is where the error is supposidly occurring--->

j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runBGSlideShow()', speed)
}
}

var speed2 = 2000

var Text = new Array();
Text[0] = "";
Text[1] = "";
Text[2] = "";
Text[3] = "";
Text[4] = "Μια πόλη με άλλον αέρα";
Text[5] = "";
Text[6] = "";
Text[7] = "";
Text[8] = "";
Text[9] = "Αγαπάμε την πόλη – Μετακινούμαστε με αστικές συγκοινωνίες";
Text[10] = ""
Text[11] = "";
Text[12] = "";
Text[13] = "";
Text[14] = "";
Text[15] = "";
Text[16] = "";
Text[17] = "Μια πόλη με άλλον αέρα";
Text[18] = "";
Text[19] = "";


var TextEn = new Array();
TextEn[0] = "ETHEL takes us everywhere, everytime";
TextEn[1] = "";
TextEn[2] = "";
TextEn[3] = "";
TextEn[4] = "A city with different air";
TextEn[5] = "";
TextEn[6] = "";
TextEn[7] = "";
TextEn[8] = "";
TextEn[9] = "We love our city – We use public transportation";
TextEn[10] = ""
TextEn[11] = "";
TextEn[12] = "";
TextEn[13] = "ETHEL takes us everywhere, everytime";
TextEn[14] = "";
TextEn[15] = "";
TextEn[16] = "";
TextEn[17] = "A city with different air";
TextEn[18] = "";
TextEn[19] = "";


var z
var l = 0
var k = Text.length

var preTextLoad = new Array()
	for (m = 0; m < k; m++){
	preTextLoad[m] = new Object()
	preTextLoad[m].innerText = Text[m]
}




var preTextEnLoad = new Array()
	for (m = 0; m < k; m++){
	preTextEnLoad[m] = new Object()
	preTextEnLoad[m].innerText = TextEn[m]
}

function runTextSlideShow(){
if (document.body){


document.getElementById('headerLetter').innerText  = Text[l] <!---Here is where the error is supposidly occurring--->

l = l + 1
if (l > (k-1)) l=0
z = setTimeout('runTextSlideShow()', speed2)
}
}


function runTextEnSlideShow(){
if (document.body){


document.getElementById('headerLetter').innerText  = TextEn[l] <!---Here is where the error is supposidly occurring--->

l = l + 1
if (l > (k-1)) l=0
z = setTimeout('runTextEnSlideShow()', speed2)
}
}


function openPdfWindow(url) {
	window.open(url, '', 'scrollbars=yes,width=800,height=600', '_blank');
	
}


function hideIcon(iconIdToHide) {


	
	
	numberId = iconIdToHide.substr(iconIdToHide.indexOf('_')+1);
	
	document.getElementById(iconIdToHide).style.display = "none";
	
	if (iconIdToHide.indexOf('minus')>-1) {
	
		idToDisplay = 'plus_'+ numberId;
		
	
		document.getElementById(idToDisplay).style.display = "inline";
		document.getElementById('ticket_'+numberId).style.display = "none";
		
	} else {
	
	
		 
		for(i = 0; i < document.getElementsByTagName("img").length; i++) {
		 if (document.getElementsByTagName("img")[i].id!="" ) {
			if (document.getElementsByTagName("img")[i].id.indexOf("minus_")!=-1 && (document.getElementsByTagName("img")[i].id!= "minus_"+numberId) && (document.getElementsByTagName("img")[i].style.display == 'inline')) {
			
			var ar = document.getElementsByTagName("img")[i].id.split('_');
			document.getElementById('ticket_'+ar[1]).style.display = "none";
			document.getElementById('plus_'+ar[1]).style.display = "inline";
			document.getElementById('minus_'+ar[1]).style.display = "none";
				
				
			}
			
		 }
		}
		
		
	
		idToDisplay = 'minus_'+ numberId;
	
	
		document.getElementById(idToDisplay).style.display = "inline";
		document.getElementById('ticket_'+numberId).style.display = "inline";
	
	}
}


function checkContactFormFields() {




	var contactForm = document.getElementById("contactForm");
	var atLeastOneEmptyField = false;
	var atLeastOneΙnvalidField = false;
	var emptyMessage = "Τα παρακάτω πεδία είναι κενά:\n\n";
	var invalidMessage = "Τα παρακάτω πεδία περιλαμβάνουν μη έγκυρες τιμές:\n\n";
	
	var otherError = false;
	
	
	
	if (IsEmpty(contactForm.firstname)) {
		atLeastOneEmptyField = true;
		emptyMessage +=" Όνομα \n";
	}
	if (IsEmpty(contactForm.lastname)) {
		atLeastOneEmptyField = true;
		emptyMessage +=" Επώνυμο \n";
	}
	if (IsEmpty(contactForm.email)) {
		atLeastOneEmptyField= true;
		emptyMessage +=" E-mail \n";
	} else {
		if (!(isValidEmail(contactForm.email))) {
		atLeastOneΙnvalidField = true;
		invalidMessage += " E-mail\n";
		
		}
	
	}
	
	if (IsEmpty(contactForm.phone)) {
		atLeastOneEmptyField= true;
		emptyMessage +=" Τηλέφωνο \n";
	} else {
		
		if (!(IsNumeric(contactForm.phone))) {
		
			atLeastOneΙnvalidField = true;
			invalidMessage += " Τηλέφωνο \n";
		}
	}
	
	
	
	if (IsEmpty(contactForm.address)) {
		atLeastOneEmptyField= true;
		emptyMessage +=" Οδός \n";
	}
	
	if (IsEmpty(contactForm.number)) {
		atLeastOneEmptyField= true;
		emptyMessage +=" Αριθμός \n";
	} 
	
	
	
	if (IsEmpty(contactForm.city)) {
		atLeastOneEmptyField= true;
		emptyMessage +=" Πόλη \n";
	}
	
	if (IsEmpty(contactForm.code)) {
		atLeastOneEmptyField= true;
		emptyMessage +=" Ταχυδρομικός κώδικας \n";
	}
	
	if (atLeastOneEmptyField && atLeastOneΙnvalidField) {
	
		emptyMessage +="\n" + invalidMessage;
	} if (atLeastOneEmptyField) {
		alert(emptyMessage);
	} else if (atLeastOneΙnvalidField) {
		alert(invalidMessage);
	} else {
		contactForm.submit();
	}	
	
	
	
	
	

}


function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
      return true;
   }
   else { return false; }
}	



function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail = strEmail.value;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
     
      return false;
    } 
    return true; 
}


function IsNumeric(sText) {
	
	sText = sText.value;
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) {
      Char = sText.charAt(i); 	
      if (ValidChars.indexOf(Char) == -1) {	
         IsNumber = false;
      }
    }
   return IsNumber;   
}


//check ENTER for form so as not to be submitted if the appropriate button is not clicked
function checkEnter(e){ 
 e = e || event; 
 return (e.keyCode || event.which || event.charCode || 0) !== 13; 
} 


function openNewSpecialPage (url, width,height,left,top) {

/*var userWidth = screen.availWidth;   
var userHeight = screen.availHeight;

var leftPos = (userWidth - width) / 2;
var  topPos = (userHeight - height) / 2;
88 */
//window.open(url,"resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=no,width="+width+",height="+height+",left="+left+",top="+top+"");
window.open(url, '', 'scrollbars=no,menubar=no,status=no,directories=no,width=1000,height=600,left=150,top=117', '_blank');

}

//check ENTER for form so as not to be submitted if the appropriate button is not clicked
function checkEnter(e){ 
 e = e || event; 
 return (e.keyCode || event.which || event.charCode || 0) !== 13; 
} 

