// JavaScript Document
$(function() {
jQuery('.show_all_features a')
	.click(function() {
		//what was clicked
			var clicked = '#' + jQuery(this).attr('id');
			//create var for action to expand
			var tableIdtoExpand = clicked
			//gets info about open div if not null
			var expanded = '#' + jQuery('.open').attr('id');

			var heightOf = jQuery(clicked + ' table').height();
			var expandHeight = parseInt(heightOf) + "px";
			if($(clicked).is('.open')){
				$(clicked).animate( {
					height : "0px"
				}, {
					duration : 1000,
					complete : function() {
						jQuery(clicked).addClass('hidden_overflow');
					}
				});
				jQuery('td.show_all_features a' + tableIdtoExpand).html('Show all');
				jQuery('td.show_all_features a' + tableIdtoExpand).removeClass('show_hidden');
				jQuery(clicked).removeClass('open');
			}
			else{
				jQuery(tableIdtoExpand).animate(
						{
							height : expandHeight
						},
						{
							duration : 1000,
							complete : function() {
								jQuery(tableIdtoExpand).removeClass('hidden_overflow');
							}
						});
				//add extra parameter showing which div is open based on toggle event
				jQuery(tableIdtoExpand).addClass('open');
				jQuery('td.show_all_features a' + tableIdtoExpand).html('Hide');
				jQuery('td.show_all_features a' + tableIdtoExpand).addClass('show_hidden');
			}
			/*jQuery('div.open').animate( {
				height : "0px"
			}, {
				duration : 1000,
				complete : function() {
					jQuery(expanded).addClass('hidden_overflow');
				}
			});*/
			/*jQuery('td.show_all_features a').html('Show all');
			jQuery('td.show_all_features a').removeClass('show_hidden');
			jQuery(expanded).removeClass('open');
			if (clicked != expanded) {
				jQuery(tableIdtoExpand).animate(
						{
							height : expandHeight
						},
						{
							duration : 1000,
							complete : function() {
								jQuery(tableIdtoExpand).removeClass(
										'hidden_overflow');
							}
						});
				//add extra parameter showing which div is open based on toggle event
				jQuery(tableIdtoExpand).addClass('open');
				jQuery('td.show_all_features a' + tableIdtoExpand)
						.html('Hide');
				jQuery('td.show_all_features a' + tableIdtoExpand).addClass('show_hidden');
			}*/
			;
		});
jQuery('.show_all_features_el a')
	.click(function() {
		//what was clicked
			var clicked = '#' + jQuery(this).attr('id');
			//create var for action to expand
			var tableIdtoExpand = clicked
			//gets info about open div if not null
			var expanded = '#' + jQuery('.open').attr('id');

			var heightOf = jQuery(clicked + ' table').height();
			var expandHeight = parseInt(heightOf) + "px";

			/*jQuery('div.open').animate( {
				height : "0px"
			}, {
				duration : 1000,
				complete : function() {
					jQuery(expanded).addClass('hidden_overflow');
				}
			});
			jQuery('td.show_all_features_el a').html('Εμφάνιση όλων των χαρακτηριστικών');
			jQuery('td.show_all_features_el a').removeClass('show_hidden');
			jQuery(expanded).removeClass('open');*/
			if($(clicked).is('.open')){
				$(clicked).animate( {
					height : "0px"
				}, {
					duration : 1000,
					complete : function() {
						jQuery(clicked).addClass('hidden_overflow');
					}
				});
				jQuery('td.show_all_features_el a' + tableIdtoExpand).html('Εμφάνιση όλων των χαρακτηριστικών');
				jQuery('td.show_all_features_el a' + tableIdtoExpand).removeClass('show_hidden');
				jQuery(clicked).removeClass('open');
			}
			else{
				jQuery(tableIdtoExpand).animate(
						{
							height : expandHeight
						},
						{
							duration : 1000,
							complete : function() {
								jQuery(tableIdtoExpand).removeClass('hidden_overflow');
							}
						});
				//add extra parameter showing which div is open based on toggle event
				jQuery(tableIdtoExpand).addClass('open');
				jQuery('td.show_all_features_el a' + tableIdtoExpand).html('Απόκρυψη');
				jQuery('td.show_all_features_el a' + tableIdtoExpand).addClass('show_hidden');
			}
			/*if (clicked != expanded || 1) {
				jQuery(tableIdtoExpand).animate(
						{
							height : expandHeight
						},
						{
							duration : 1000,
							complete : function() {
								jQuery(tableIdtoExpand).removeClass('hidden_overflow');
							}
						});
				//add extra parameter showing which div is open based on toggle event
				jQuery(tableIdtoExpand).addClass('open');
				jQuery('td.show_all_features_el a' + tableIdtoExpand).html('Απόκρυψη');
				jQuery('td.show_all_features_el a' + tableIdtoExpand).addClass('show_hidden');
			}*/
			;
		});
});

