jQuery(function($){
	var enPatt=/[a-z]/i;
	var hePatt=/[א-ת]/;
	var enWordPatt = /[a-z]+/gi;
			
	
	if($('h1').text().match(enPatt) && $('h1').text().match(hePatt))
	{
	  Cufon.replace('#header span.right,#header span.left,#about h3');
	  CufonRTL.RTL('#header span.right,#about h3');	
	}
	else
	{
	  Cufon.replace('#header span.right,#header span.left,#about h3,h1');
	  CufonRTL.RTL('#header span.right,#about h3,h1');			
	}

  $('#contact form input[type="text"], #contact form textarea').focus(function(){
	if(!$.data(this,'oldName'))
		$.data(this,'oldName',$(this).val());
	if($.data(this,'oldName') == $(this).val())
		$(this).val('');
	$(this).css('color','#333');
  }).blur(function(){
	if($(this).val() == '')
	{
		$(this).css('color','#aaa');
		$(this).val($.data(this,'oldName'));
	}
	
  });	
  
  
  
  //contact send
  
  $("#contact_form").submit(function() {
		$(this).find("button[type=submit]").hide();
		$(this).find("#ajax_loader").css('display','block');
		$(this).find('p').hide();
		$.post("/index/mail", $(this).serialize(),function(data){
			$("#contact_form button[type=submit]").show();
			$("#ajax_loader").hide();
				if(data == "false"){
					$("#contact_form").append('<p>אירעה שגיאה בשליחת ההודעה. אנא נסו שנית מאוחר יותר.</p>');
				}
				else if(data == "error"){
					$("#contact_form").append('<p>כתובת דוא"ל אינה תקינה</p>');
				}
				else
				{
					$("#contact_form").append('<p>הודעתך נשלחה בהצלחה.</p>');
				}
		});
		
		return false;
	});
});

//accordion



