$(function(){
	$('#nav').superfish({
		autoArrows: false
		});
	/*//QUICK CONTACT
	$('#submit').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=name]');
		var phone = $('input[name=phone]');
		var email = $('input[name=email]');
		var comment = $('textarea[name=comment]');
		var contactvia = $('select[name=contact_via]');
		var besttime = $('select[name=best_time]');
		var interest = $('select[name=interested_in]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (phone.val()=='') {
			phone.addClass('hightlight');
			return false;
		} else phone.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
		
		if (comment.val()=='') {
			comment.addClass('hightlight');
			return false;
		} else comment.removeClass('hightlight');
		
		//organize the data properly
		var data = 'name=' + name.val() + '&phone=' + phone.val() + '&email=' + email.val() + '&comment=' + encodeURIComponent(comment.val()) + '&contactvia=' + contactvia.val() + '&besttime=' + besttime.val() + '&interest=' + interest.val();
		
		//disabled all the text fields
		$('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "process.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.form').fadeOut('slow');					
					
					//show the success message
					$('.done').fadeIn('slow');
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Sorry, unexpected error. Please try again later.');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	*/
	
	
	$('input[title]').each(function() {
	  if($(this).val() === '') {
	   $(this).val($(this).attr('title')); 
	  }
	  
	  $(this).focus(function() {
	   if($(this).val() === $(this).attr('title')) {
		$(this).val('').addClass('focused'); 
	   }
	  });
	  
	  $(this).blur(function() {
	   if($(this).val() === '') {
		$(this).val($(this).attr('title')).removeClass('focused'); 
	   }
	  });
	 });
	 
	 $('textarea[title]').each(function() {
	  if($(this).val() === '') {
	   $(this).val($(this).attr('title')); 
	  }
	  
	  $(this).focus(function() {
	   if($(this).val() === $(this).attr('title')) {
		$(this).val('').addClass('focused'); 
	   }
	  });
	  
	  $(this).blur(function() {
	   if($(this).val() === '') {
		$(this).val($(this).attr('title')).removeClass('focused'); 
	   }
	  });
	 });
	 
	  $('select[title]').each(function() {
	  if($(this).val() === '') {
	   $(this).val($(this).attr('title')); 
	  }
	  
	  $(this).focus(function() {
	   if($(this).val() === $(this).attr('title')) {
		$(this).val('').addClass('focused'); 
	   }
	  });
	  
	  $(this).blur(function() {
	   if($(this).val() === '') {
		$(this).val($(this).attr('title')).removeClass('focused'); 
	   }
	  });
	 });
	 
	$('.qa').find('div').hide();
 
 	$('.qa').find('span').after('<a href="#" class="plus" >click for answer</a>');

 
 $(".plus").click(function() { 
 	if ($(this).next('div').is(":hidden")) {
      $(this).text('click to close').next('div').slideDown();
	  return false;
	} else {
		$(this).text('click for answer').next('div').slideUp();
		return false;
	}
    });
	
	var content = $('.content .leftCol').height();
	  $('.content').find('.rightCol').css('height', content + 'px');
	  
	$('#nav li ul li').has('ul').addClass('arrow');
 
});
