function resetSearch ( action ) {
	
	if ( action == "1" ) {
		if ( document.getElementById("search").value == "Αναζήτηση..." ) {
			document.getElementById("search").value = "";
		}
	} else if ( action == "0" ) {
		if ( document.getElementById("search").value == "" ) {
			document.getElementById("search").value = "Αναζήτηση...";
		}
	}
}

function resetNewsletter ( action ) {
	if ( action == "1" ) {
		if ( document.getElementById("newsletter").value == "Το e-mail σας" ) {
			document.getElementById("newsletter").value = "";
		}
	} else if ( action == "0" ) {
		if ( document.getElementById("newsletter").value == "" ) {
			document.getElementById("newsletter").value = "Το e-mail σας";
		}
	}
}

function resetOpinion ( action ) {
	if ( action == "1" ) {
		if ( document.getElementById("opinion").value == "Παρακαλούμε αποστείλατε εδώ τα σχόλια και τις παρατηρήσεις σας" ) {
			document.getElementById("opinion").value = "";
		}
	} else if ( action == "0" ) {
		if ( document.getElementById("opinion").value == "" ) {
			document.getElementById("opinion").value = "Παρακαλούμε αποστείλατε εδώ τα σχόλια και τις παρατηρήσεις σας";
		}
	}
}

function resetEmail ( action ) {
	if ( action == "1" ) {
		if ( document.getElementById("email2").value == "Το email σας" ) {
			document.getElementById("email2").value = "";
		}
	} else if ( action == "0" ) {
		if ( document.getElementById("email2").value == "" ) {
			document.getElementById("email2").value = "Το email σας";
		}
	}
}

function showHideRes (id) {
	
	if ( document.getElementById(id).style.display == "none" ) {
		document.getElementById(id).style.display = "";
	} else {
		document.getElementById(id).style.display = "none";
	}
	
	document.getElementById("itemDetails").style.display = "none";
	
}

function swapColors (action, item ) {
	
	if ( action == "1" ) {
		document.getElementById('row'+item).style.backgroundColor='D4D0C8';
	} else if ( action == "0" ) {
		document.getElementById('row'+item).style.backgroundColor='FFFFFF';
	}
	
}

function getXY ( e ) {
	
	var x,y;
	e = e || window.event;
	if (navigator.appName.indexOf('Microsoft') != -1)
	{
		var parent = e.srcElement;
		x=e.clientX + document.body.scrollLeft;
		y=e.clientY + document.body.scrollTop;
	}
	else
	{
		x =e.pageX
		y= e.pageY
	}
	var XY = new Object();
	XY.x = x;
	XY.y = y;
	return XY;
	
}


function popHelpSearch ( e, el, id ) {
	
	var xInc = 25;
	if ( id == "popupDivSearchAdvanced" ) {
		var xInc = 320;
	}
	
	var XY = getXY(e);
	var tip = document.getElementById(id);
	tip.style.top = Number ( XY.y ) + "px";
	tip.style.left = Number ( XY.x - xInc ) + "px";
	document.getElementById(id).style.display = "block";
	
}

function closeToolTip ( divName ) {
	document.getElementById(divName).style.left = "-1000px";
	document.getElementById(divName).style.top = "-1000px";
	document.getElementById(divName).style.display = "none";
}

function StartNavBar() {
	
  $(window).scroll(function () {
  document.getElementById("navBarSearch").innerHTML = document.getElementById("navBarSearchItem").value;
  if ( document.getElementById("navBarOK").value == "1" ) {
    
    left = ($(window).width() - $('#navbar').width() - 20) / 2;
    $('#navbar').css('left', left);

    if ($(window).scrollTop() > 350) {
      if ($('#navbar').is(':hidden'))
        $('#navbar').slideDown();
    } else {
      if ($('#navbar').is(':visible'))
        $('#navbar').slideUp();
    }
    
    }
  }
  
  );
	 
}

function disableNavBar() {
	document.getElementById("navBarOK").value = "0";
	document.getElementById("navbar").style.display = "none";
}


function getObj(name)
{
  if (document.getElementById)
  {
        this.obj = document.getElementById(name);
        this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
        this.obj = document.all[name];
        this.style = document.all[name].style;
  }
  else if (document.layers)
  {
        this.obj = document.layers[name];
        this.style = document.layers[name];
  }
}


size = 13;
function changeStyle(amount)
{	
	if (!DHTML) return;
	var x = new getObj('articletext');
	size += amount;
	if ( size >16 ) {
		size = 16;
	}
	if ( size < 9 ) {
		size = 9;
	}
	x.style.fontSize = size;
}


$(document).ready(function(){
	
	$("div.search-categories").live("click", function() {
		if ( $(this).hasClass("sc-on") ) {
			$(this).removeClass("sc-on").addClass("sc-off");
		} else {
			$(this).removeClass("sc-off").addClass("sc-on");
		}
	});
	
	$("div.search-associates").live("click", function() {
		if ( $(this).hasClass("sc-on") ) {
			$(this).removeClass("sc-on").addClass("sc-off");
		} else {
			$(this).removeClass("sc-off").addClass("sc-on");
		}
		var associates=0;
		$("div.search-associates").each(function(index) {
			if ( $(this).hasClass("sc-on") ) {
				associates++;
			}
		});
		if ( associates == 0 ) {
			associates="Κανένας επιλεγμένος";
		} else if ( associates == 1 ) {
			associates="1 επιλεγμένος";
		} else {
			associates=associates+" επιλεγμένοι";
		}
		$("#so-3").children("div.search-option-title").children("span.sot-off").html("["+associates+"]");
	});
	
	$("div.search-categories, div.search-associates").live("mouseover", function() {
		$(this).css("background-color","#dddddd");
	});
	$("div.search-categories, div.search-associates").live("mouseout", function() {
		$(this).css("background-color","transparent");
	});
	
	$("span.search-option-button").live("click", function() {
		var id=$(this).attr("id");
		if ( $(this).hasClass("sob-on") ) {
			$("span.sob-off").removeClass("sob-off").addClass("sob-on");
			$(this).removeClass("sob-on").addClass("sob-off");
		}
		if ( id == "sob-1") {
			$("div.search-categories").removeClass("sc-off").addClass("sc-on");
		} else if ( id == "sob-0") {
			$("div.search-categories").removeClass("sc-on").addClass("sc-off");
		}
	});
	
	
	
});

