// JavaScript Document


$(function(){
		   
	//Hover state
	$('input').hover(function(){$(this).addClass('hover')},	function(){$(this).removeClass('hover')})
	
	//slidebar
	$('.slidebar_col:last-child').css('border-right','none');
	
	//slidebar
	//  $('.slidebar_col:last-child').css('border','none');
	//  $('.slidebar_col:last-child').css('width','265px');
	//  $('.slidebar_col:last-child').css('margin-right','0px');
	  
    //slide show
	//  $('.slide-content').cycle({
	//	  fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	//	  next:   '#next-button', 
	//	  prev:   '#prev-button', 
	//	  pager:  '#s-nav'
	//  });
	//  $('.image-hover').hover(
	//	  function(){
	//		  $(this).parent().find('.home_link a').addClass('active');
	//	  },
	//	  function(){
	//		  $(this).parent().find('.home_link a').removeClass('active');	
	//	  }
	// )
	  
	// menu
	$('.dropdown').bind({
		mouseenter:function(){
			$(this).find('ul').slideDown('fast');
			$(this).addClass('active')
		},
		mouseleave:function(){
			$(this).find('ul').slideUp(0);
			$(this).removeClass('active');
			//$(this).parent().find('.dropdown a.active').addClass('active');
		}
	})
/*	
	if($('.first').hasClass('active')) {
		$(this).find('.sublinks').hover(
		function(){
			$(this).parent().find('.dropdown').addClass('active');
			$(this).parent().find('.first').addClass('active');
		},
		function(){
			$(this).parent().find('.dropdown').removeClass('active');
		}
	)
	}
	$('.sublinks').hover(
		function(){
			$(this).parent().find('.dropdown').addClass('active');
			$(this).parent().find('.first').addClass('active');
		},
		function(){
			$(this).parent().find('.dropdown').removeClass('active');
			$(this).parent().find('.first').removeClass('active');
		}
	)
*/
    //right link
   	$(".right_bg").click(function(){
	  //window.location=$(this).find(".right_link a").attr("href");
	});	
	$('.sub').hover(
		function(){
			$(this).parent().find('.right_link a').addClass('active');
		},
		function(){
			$(this).parent().find('.right_link a').removeClass('active');	
		}
	)
	
	//programs
	$(".toggle_link").toggle(
	  function() {
		  var infos = $(this).parent().prev();
		infos.show('fast');
		//$(".info_text").show("fast");
		$(this).text("- collapse");
	  },
	  function() {
		  var infos = $(this).parent().prev();
		infos.hide("fast");
		$(this).text("+ view more");
	  }
	);
	
	//faq
	$(".faq_content").hide(); 
	//Slide up and down on hover
	$(".list_faq li a.question").toggle(
		function () {					   
		  $(this).next(".faq_content").slideToggle("fast");
		  $(this).children('span').css('background-position','bottom left');
		},
		function () {					   
		  $(this).next(".faq_content").slideToggle("fast");
		  $(this).children('span').css('background-position','top left');
		}
	);
	
	
	//search box
	$('#g_search input').focus(function(){
		$(this).parent().css('background-position', 'bottom left');	
		$(this).css({'background': '#fff', 'color':'#333' });	
	})
	$('#g_search input').blur(function(){
		$(this).parent().css('background-position', 'top left');
		$(this).css({'background': '#386396', 'color':'#82a1c6' });
	})
	
	
	//when click textarea
	$('.tipfield').each(function(){
	$(this).val('Max 1000 characters');
		
	}).blur(function(){
		if ($(this).val() == '') {
			$(this).val('Max 1000 characters');
		}
	}).focus(function(){
		if ($(this).val() == 'Max 1000 characters') {
			$(this).val('');
		}
	});
	
	
	
});



