function changeLoc(newloc) {
 location.replace(newloc);
}

function VALITATEFORM(form,lang) {
	name = form.name.value;
	phone = form.phone.value;
	if (name == '') {
		if (lang == 'gr') {
			alert("Παρακαλώ εισάγετε το ονομά σας");
		} else if (lang == 'en') {
			alert("Please enter your name");
		}
		return false;
	} else if (phone == '') {
		if (lang == 'gr') {
			alert("Παρακαλώ εισάγετε το τηλεφωνό σας");
		} else if (lang == 'en') {
			alert("Please enter your phone number");
		}
		return false;
	} else {
		return true;
	}
}

function mm_over(id, PAR_1, PAR_4, PAR_2) { 

	var COUNT_AR = PAR_4.split("|");
	var i;
	for(i=0; i<COUNT_AR.length; i++) {
		if (PAR_1 == COUNT_AR[i]) {
			document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block'; 
		} else {
			document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
		}
	}
}
function mm_out(id, PAR_1, PAR_4, PAR_2) { 
	/*var COUNT_AR = PAR_4.split("|");
	var i;
	for(i=0; i<COUNT_AR.length; i++) {
		if (PAR_2 == COUNT_AR[i]) {
			document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block'; 
		} else {
			document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
		}
	}*/
}


function TD_BGCOLOR(CASE, PAR_1, PAR_2, ROOT_PAR_1, PAR_4) {

	var COUNT_AR = PAR_4.split("|");
	var i;
	if (CASE == '1') { //over
		for(i=0; i<COUNT_AR.length; i++) {
			if (PAR_1 == COUNT_AR[i]) {
			  if ((COUNT_AR[i] != PAR_2)&&(COUNT_AR[i] != ROOT_PAR_1)) {
				document.getElementById('mm_'+COUNT_AR[i]).style.backgroundColor = 'D1E0E0';
			  } 
			  document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block'; 
			} else {
			  if ((COUNT_AR[i] != PAR_2)&&(COUNT_AR[i] != ROOT_PAR_1)) {
				document.getElementById('mm_'+COUNT_AR[i]).style.backgroundColor = 'B2CCCC';
			  } 
			  document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
			}
		}
	} 
}

function TD_SUBMENU(PAR_1, PAR_2, PAR_3, PAR_4, CASE, event) {
	
	var COUNT_AR = PAR_4.split("|");
	var i;
	var toElement = null;

	if (event.relatedTarget) {
		toElement = event.relatedTarget;
	} else if (event.toElement) {
		toElement = event.toElement;
	}
	
	while (toElement && toElement.id != 'sub_of_'+PAR_1) {
		toElement = toElement.parentNode;
	}

	if (!toElement) {
		if (document.getElementById) {
		//if (!event.fromElement.contains(event.toElement) &&!document.getElementById('sub_of_'+PAR_1).contains(event.toElement)) {	
			if ((PAR_1 != PAR_2)&&(PAR_1 != PAR_3)) {
				document.getElementById('mm_'+PAR_1).style.backgroundColor = 'B2CCCC';
			}
			for(i=0; i<COUNT_AR.length; i++) {
				if ((PAR_2 == COUNT_AR[i])||(PAR_3 == COUNT_AR[i])) {
					document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block'; 
				} else {
					document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
				}
			}
		//}
		}
	}
}

function TD_SUBMENU_SINGLE(PAR_2, PAR_3, PAR_4, event) {
	
	var COUNT_AR = PAR_4.split("|");
	var i;
	var toElement = null;

	if (event.relatedTarget) {
		toElement = event.relatedTarget;
	} else if (event.toElement) {
		toElement = event.toElement;
	}
	
	while (toElement && toElement.id != 'under_mm') {
		toElement = toElement.parentNode;
	}

	if (!toElement) {
		if (document.getElementById) {
		//if (!event.fromElement.contains(event.toElement) &&!document.getElementById('sub_of_'+PAR_1).contains(event.toElement)) {	
			/*if ((PAR_1 != PAR_2)&&(PAR_1 != PAR_3)) {
				document.getElementById('mm_'+PAR_1).style.backgroundColor = 'B2CCCC';
			}*/
			for(i=0; i<COUNT_AR.length; i++) {
				if ((PAR_2 == COUNT_AR[i])||(PAR_3 == COUNT_AR[i])) {
					document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block'; 
				} else {
					document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
					document.getElementById('mm_'+COUNT_AR[i]).style.backgroundColor = 'B2CCCC';
				}
			}
		//}
		}
	}
}

function POPUPWindow(PAGE,TITLE,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    window.POPUP_WINDOW = open(PAGE, 'POPUP_WINDOW', 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
	
}

function M_POPUP(FILE,w,h){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    window.POPUP_WINDOW = open('../web_images/menu_images/'+FILE, 'PHOTO_POPUP', 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
	
}