toggleShowHide = function(handle, element, txtShow, txtHide, showIcons) {
	if($(element).css('display') == "none")
	{
		$(element).show();
		if(showIcons == 1)
		{
			$(handle).html('<img src="' + homepageUrl + 'images/ifc/icons/close.gif" alt="' + txtHide + '" /> ' + '<span>' + txtHide + '</span>');
		} else {
			$(handle).html(txtHide);
		}
	} else  {
		$(element).hide();
		if(showIcons == 1)
		{
			$(handle).html('<img src="' + homepageUrl + 'images/ifc/icons/show.gif"  alt="' + txtShow + '" /> ' + '<span>' + txtShow + '</span>');
		} else {
			$(handle).html(txtShow);
		}
	}
};


searchtext = function()
{
	var search_text = 'search...';
	var box = $("#search");
	box.focus( function() { if(box.val() == search_text) { box.val(''); } });	
	box.blur(function(){ if(box.val() == '') { box.val(search_text); } });	
}


onHover = function(elem, className)
{
	if(!className) {
		var className = 'onHover';
	}
	$(elem).hover(function() {
		$(this).addClass(className);
	}, function() {
		$(this).removeClass(className);
	});
}

contact = function()
{
    var form = $("#contactForm").serialize();
    $("#contact").html('Sending email... Please, wait...');
	$.ajax({
	   type: "POST",
	   url: HOMEPAGE + '/ajax/contact',
	   data: "data=" + escape(form),
	   success: function(msg){
	     $("#contact").html(msg);
	   }
	 });	
}

showTooltip = function()
{
	$("#whoWeAre ul li").hover(
      function () {
		$(this).text().replace(/a/i, "aaaa");
      	$(this).addClass("hilite");
        if($(this).find("p.email").html() != "&nbsp;")
        {
	       	var node = $(this).find("p.email");
	        $(this).prepend($('<div class="tooltip" style="cursor:pointer">click to see email</div>'));
	        $(".tooltip").one("click", function() {
	        		$(this).text('');
					
	        		$(this).html(node.html().replace(/\s/i, "@"));
	        	}
	        )
        }
      }, 
      function () {
      	$(this).removeClass("hilite");
        $(this).find("div:last").remove();
      }
    );	
}

String.prototype.toPHP = function() 
{ 
	var s = this;
	s=s.replace(/\\/g, "\\\\");
	s=s.replace(/\"/g, "\\\"");
	s=s.replace(/\n/g, "\\n");
	s=s.replace(/\r/g, "");
	return 's:'+s.length+':"'+s+'";'
}



$(window).load(function()
{
	searchtext();
});