//*****FAQ Toggle Accordian*******************************************************************//
function faqToggle() {
	$('#faq ul li a').click(function() {														 
		if($(this).siblings('ul:visible').length){
			$(this).siblings('ul').fadeOut();
		} else {
			$(this).siblings('ul').fadeIn();
		}
		$('#faq ul li ul').not($(this).siblings('ul')).fadeOut();
		return false;
	});
}
//*****jQuery clear value from july 21st 2009 comment on http://www.joesak.com/2008/11/19/a-jquery-function-to-auto-fill-input-fields-and-clear-them-on-click*****//
function clearDefaultValue() {
  $(':input').focus(function() {
    if($(this).val() == $(this).attr('title')) {
      $(this).val('');
    }
  }).blur(function() {
    if($(this).val() == '') {
      $(this).val($(this).attr('title'));
    }
  });
  $('#sendbutton').click(function() {
	  $(':input').each(function (i) {
      if($(this).val() == $(this).attr('title')) {
        $(this).val('');
      }
    });
  });
}
//*****Replace target attribute with class**************************************************//
function replaceTarget() {
  if (!document.getElementsByTagName('a')) return false;
  $('a[target]').addClass('newwindow').removeAttr('target');
}
//*****The following function make it possible to have web standard popups**************************************************//
function strictNewWindow() {
  if (!document.getElementsByTagName('a')) return false;
  $('a.newwindow').click(function() {
    window.open($(this).attr('href'));
    return false;
  });
}
//*****Load all functions**************************************************//
$(document).ready(function(){
  clearDefaultValue();
	faqToggle();
	replaceTarget();
	strictNewWindow();
});
