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=no, resizable=no, toolbar=no, menubar=no');
}

function chg_img(obj_id, src) {
	var a = document.getElementById(obj_id);
	a.src = src;
}

function change_class(obj, class_name) {
	obj.className = class_name;
}

function chg_display(obj_id, on_off) {
	var obj = document.getElementById(obj_id);
	if (obj.style.display == "none") obj.style.display = "";
	else obj.style.display = "none";
}

function chg_plus_minus(obj) {
	if (obj.alt == 'plus') {
		obj.alt = 'minus';
		obj.src = 'images/minus_o.gif';
	}
	else {
		obj.alt = 'plus';
		obj.src = 'images/plus_o.gif';
	}
}

function validate() {
	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++;
		}
	}
	if (flag > 0) {
		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_close_menu(obj_id) {
	var a = document.getElementById("menu_id_" + obj_id);
	if (a.style.display == "none") {
		a.style.display = "";
		close_menu(obj_id);
	}
	else if (a.style.display == "") {
		a.style.display = "none";
	}
}

function close_menu(obj_id) {
	var obj = document.getElementsByTagName('span');
	for (var i=0; i<obj.length; i++) {
		if (obj_id != obj[i].title && document.getElementById("menu_id_" + obj[i].title)) {
			var menu = document.getElementById("menu_id_" + obj[i].title);
			menu.style.display = "none";
		}
	}
}

function open_menu(obj_id) {
	var a = document.getElementById("menu_id_" + obj_id);
	a.style.display = "";
}
