function flash_print_xml(filepath, width, height, xml_name) {
	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" border="0" width="' + width + '" height="' + height + '">');
	document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
	document.writeln('<param name="movie" value="' + filepath + '" />');
	document.writeln('<param name="quality" value="High" />');
	document.writeln('<param name="wmode" value="transparent" />');
	document.writeln('<param name="FlashVars" value="xml_name=' + xml_name + '" />');
	document.writeln('<embed src="' + filepath + '" style="display: block;" FlashVars="xml_name=' + xml_name + '" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj3" quality="High" width="' + width + '" height="' + height + '" />');
	document.writeln('</object>');
}

function flash_print(filepath, width, height) {
	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" border="0" width="' + width + '" height="' + height + '">');
	document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
	document.writeln('<param name="movie" value="' + filepath + '" />');
	document.writeln('<param name="quality" value="High" />');
	document.writeln('<param name="wmode" value="transparent" />');
	document.writeln('<embed src="' + filepath + '" style="display: block;" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj3" quality="High" width="' + width + '" height="' + height + '" />');
	document.writeln('</object>');
}

function window_open(url, width, height) {
	window.open(url, 'NewWin','left=0, top=0, width=' + width + ', height=' + height + ', scrollbars=yes, resizable=yes, toolbar=no, menubar=no');
}

function chg_class_id(obj_id, class_name) {
	var obj = document.getElementById(obj_id);
	obj.className = class_name;
}

function chg_class(obj, class_name) {
	obj.className = class_name;
}

function chg_font_size(size) {	
	var obj = document.getElementById("article_div");
	obj.style.fontSize = size + 'px';
}

function validate(lang_id) {
	var inp = document.getElementsByTagName('input');
	var flag = 0;
	var msg = "";
	for (var i=0; i<inp.length; i++) {
		var ii = inp[i].getAttribute('id');
		if (ii == 'required' && inp[i].value == '') {
			var titlos = inp[i].getAttribute('title');
			msg = msg + titlos + "\n";
			flag++;
		}
	}
	var inp = document.getElementsByTagName('textarea');
	for (var i=0; i<inp.length; i++) {
		var ii = inp[i].getAttribute('id');
		if (ii == 'required' && inp[i].value == '') {
			var titlos = inp[i].getAttribute('title');
			msg = msg + titlos + "\n";
			flag++;
		}
	}
	var inp = document.getElementsByTagName('select');
	for (var i=0; i<inp.length; i++) {
		var ii = inp[i].getAttribute('id');
		if (ii == 'required' && inp[i].value == '0') {
			var titlos = inp[i].getAttribute('title');
			msg = msg + titlos + "\n";
			flag++;
		}
	}
	if (flag > 0) {
		if (lang_id == 1) alert("Παρακαλώ, συμπληρώστε τα υποχρεωτικά πεδία:\n" + msg);
		else alert("Please, fill the required fields:\n" + msg);
		return(false);
	}
	else return(true);
}

function chk_email(obj) {
	apos = obj.value.indexOf("@");
	dotpos = obj.value.lastIndexOf(".");
	if ((apos < 1 || dotpos - apos < 2) && obj.value != '') {
		alert('Please, fill a valid e-mail address.');
		obj.value = '';
		return false;
	}
	else return true;
}

function chk_int(obj) {
	obj.value = obj.value.replace(",", ".");
	if (!isNaN(obj.value)) return true;
	else if (obj.value != '') {
		alert("Please, fill a valid number.");
		obj.value = '';
		return false;
	}
}

function open_menu(obj_id, foto) {
	var obj = document.getElementById("submenu_" + obj_id);
	obj.style.display = "";
	var obj = document.getElementById("parent_menu_" + obj_id);
	chg_menu_img(obj, foto);
}

function close_menu(obj_id, foto) {
	var obj = document.getElementById("submenu_" + obj_id);
	obj.style.display = "none";
	var obj = document.getElementById("parent_menu_" + obj_id);
	chg_menu_img(obj, foto);
}

function show_tab(obj_id, my_link) {
	if (obj_id == '1') {
		document.getElementById("tab_1").style.display = "";
		document.getElementById("tab_2").style.display = "none";
		document.getElementById("tab_3").style.display = "none";
		chg_class_id("tab_btn_1", "tab_selected");
		chg_class_id("tab_btn_2", "");
		chg_class_id("tab_btn_3", "");
		document.getElementById("tab_bottom_link").innerHTML = '<a href="' + my_link +'">View All Videos</a>';
	}
	else if (obj_id == '2') {
		document.getElementById("tab_1").style.display = "none";
		document.getElementById("tab_2").style.display = "";
		document.getElementById("tab_3").style.display = "none";
		chg_class_id("tab_btn_1", "");
		chg_class_id("tab_btn_2", "tab_selected");
		chg_class_id("tab_btn_3", "");
		document.getElementById("tab_bottom_link").innerHTML = '<a href="' + my_link +'">View All Latest News</a>';
	}
	else if (obj_id == '3') {
		document.getElementById("tab_1").style.display = "none";
		document.getElementById("tab_2").style.display = "none";
		document.getElementById("tab_3").style.display = "";
		chg_class_id("tab_btn_1", "");
		chg_class_id("tab_btn_2", "");
		chg_class_id("tab_btn_3", "tab_selected");
		document.getElementById("tab_bottom_link").innerHTML = '<a href="' + my_link +'">View All Most Read Articles</a>';
	}
}

function polls_form_submit() {
	var inp = document.getElementsByTagName('input');
	var flag = 0;
	for (var i=0; i<inp.length; i++) {
		var ii = inp[i].getAttribute('name');
		if (ii == 'polls_answer' && inp[i].checked == true) flag++;
	}
	if (flag == 0) {
		alert("Please select an answer.");
		return false;
	}
	else {
		document.polls_form.submit();
		return true;
	}
}

function home_slide_chg(obj_id) {
	if (obj_id == '1') {
		chg_class_id("home_slide_1", "home_slide_btn_over");
		chg_class_id("home_slide_2", "home_slide_btn");
		chg_class_id("home_slide_3", "home_slide_btn");
		chg_class_id("home_slide_4", "home_slide_btn");
		document.getElementById("home_slide_title_1").style.color = '#ffffff';
		document.getElementById("home_slide_title_2").style.color = '#333333';
		document.getElementById("home_slide_title_3").style.color = '#333333';
		document.getElementById("home_slide_title_4").style.color = '#333333';
		document.getElementById("home_slide_date_1").style.color = '#ffffff';
		document.getElementById("home_slide_date_2").style.color = '#333333';
		document.getElementById("home_slide_date_3").style.color = '#333333';
		document.getElementById("home_slide_date_4").style.color = '#333333';
		document.getElementById("home_slide_link_1").style.color = '#ffffff';
		document.getElementById("home_slide_link_2").style.color = '#333333';
		document.getElementById("home_slide_link_3").style.color = '#333333';
		document.getElementById("home_slide_link_4").style.color = '#333333';
	}
	else if (obj_id == '2') {
		chg_class_id("home_slide_1", "home_slide_btn");
		chg_class_id("home_slide_2", "home_slide_btn_over");
		chg_class_id("home_slide_3", "home_slide_btn");
		chg_class_id("home_slide_4", "home_slide_btn");
		document.getElementById("home_slide_title_1").style.color = '#333333';
		document.getElementById("home_slide_title_2").style.color = '#ffffff';
		document.getElementById("home_slide_title_3").style.color = '#333333';
		document.getElementById("home_slide_title_4").style.color = '#333333';
		document.getElementById("home_slide_date_1").style.color = '#333333';
		document.getElementById("home_slide_date_2").style.color = '#ffffff';
		document.getElementById("home_slide_date_3").style.color = '#333333';
		document.getElementById("home_slide_date_4").style.color = '#333333';
		document.getElementById("home_slide_link_1").style.color = '#333333';
		document.getElementById("home_slide_link_2").style.color = '#ffffff';
		document.getElementById("home_slide_link_3").style.color = '#333333';
		document.getElementById("home_slide_link_4").style.color = '#333333';
	}
	else if (obj_id == '3') {
		chg_class_id("home_slide_1", "home_slide_btn");
		chg_class_id("home_slide_2", "home_slide_btn");
		chg_class_id("home_slide_3", "home_slide_btn_over");
		chg_class_id("home_slide_4", "home_slide_btn");
		document.getElementById("home_slide_title_1").style.color = '#333333';
		document.getElementById("home_slide_title_2").style.color = '#333333';
		document.getElementById("home_slide_title_3").style.color = '#ffffff';
		document.getElementById("home_slide_title_4").style.color = '#333333';
		document.getElementById("home_slide_date_1").style.color = '#333333';
		document.getElementById("home_slide_date_2").style.color = '#333333';
		document.getElementById("home_slide_date_3").style.color = '#ffffff';
		document.getElementById("home_slide_date_4").style.color = '#333333';
		document.getElementById("home_slide_link_1").style.color = '#333333';
		document.getElementById("home_slide_link_2").style.color = '#333333';
		document.getElementById("home_slide_link_3").style.color = '#ffffff';
		document.getElementById("home_slide_link_4").style.color = '#333333';
	}
	else if (obj_id == '4') {
		chg_class_id("home_slide_1", "home_slide_btn");
		chg_class_id("home_slide_2", "home_slide_btn");
		chg_class_id("home_slide_3", "home_slide_btn");
		chg_class_id("home_slide_4", "home_slide_btn_over");
		document.getElementById("home_slide_title_1").style.color = '#333333';
		document.getElementById("home_slide_title_2").style.color = '#333333';
		document.getElementById("home_slide_title_3").style.color = '#333333';
		document.getElementById("home_slide_title_4").style.color = '#ffffff';
		document.getElementById("home_slide_date_1").style.color = '#333333';
		document.getElementById("home_slide_date_2").style.color = '#333333';
		document.getElementById("home_slide_date_3").style.color = '#333333';
		document.getElementById("home_slide_date_4").style.color = '#ffffff';
		document.getElementById("home_slide_link_1").style.color = '#333333';
		document.getElementById("home_slide_link_2").style.color = '#333333';
		document.getElementById("home_slide_link_3").style.color = '#333333';
		document.getElementById("home_slide_link_4").style.color = '#ffffff';
	}
	var foto = document.getElementById("home_slide_foto_" + obj_id).getAttribute('title');
	var mylink = document.getElementById("home_slide_link_" + obj_id).getAttribute('href');
	document.getElementById("home_slide_foto_holder").innerHTML = '<a href="' + mylink + '"><img id="home_slide_foto" src="' + foto + '" alt="" border="0" /></a>';
}

function home_slide_auto_chg() {
	if (document.getElementById("home_slide_1").className == 'home_slide_btn_over') home_slide_chg("2");
	else if (document.getElementById("home_slide_2").className == 'home_slide_btn_over') home_slide_chg("3");
	else if (document.getElementById("home_slide_3").className == 'home_slide_btn_over') home_slide_chg("4");
	else if (document.getElementById("home_slide_4").className == 'home_slide_btn_over') home_slide_chg("1");
}

function home_slide_interval() {
	homeSlideInterval = window.setInterval("home_slide_auto_chg()", 5000);
}

function home_slide_stop_interval() {
	window.clearInterval(homeSlideInterval);
}

function form_count_char() {	
	var max_char = 999;
	var obj = document.comment_form.comment;
	if (obj.value.length > max_char) obj.value = obj.value.substr(0, max_char);
}

function open_close_comments() {
	var obj_div = document.getElementById("hidden_comments");
	var obj_link = document.getElementById("hidden_comments_link");
	if (obj_div.style.display == 'none') {
		obj_div.style.display = '';
		obj_link.innerHTML = 'Hide comments';
	}
	else {
		obj_div.style.display = 'none';
		obj_link.innerHTML = 'View all comments';
	}
}

