/* 
=======================================
	A Dash Of Style By 
	Evolve Concepts Ltd. Hong Kong
	www.evolve.hk - info@evolve.hk
=======================================
*/
$(document).ready(function(){ 
// Banner Portal
	$('ul#banner').innerfade({
		speed: 1000, timeout: 5000,
		type: 'sequence',
		containerheight: 	'360px',
		slide_timer_on: 	'yes',
		slide_ui_parent: 	'banner',
		slide_ui_text:		'banner-desc',
		pause_button_id: 	'pause_button',
		slide_nav_id:		'slide_nav'
		});
		$.setOptionsButtonEvent();

		$("#pause_button").click(function() {
			$.pause();
		});
// JQ - Buttons
	$(".wrap-btn").click(function() {  
	window.location = $(this).find("a:first").attr("href");  
	});  
});
// JQ - Clear searchbox
$(document).ready(function(){
	var clearMePrevious = '';
	$('.clearMeFocus').focus(function()
	{
		if($(this).val()==$(this).attr('title'))
		{
			clearMePrevious = $(this).val();
			$(this).val('');
		}
	});
	$('.clearMeFocus').blur(function()
	{
		if($(this).val()=='')
		{
			$(this).val(clearMePrevious);
		}
	});
});
// JQ - Scroll to top
$(document).ready(function() {
	$("a.topLink").click(function() {
		$("html, body").animate({
			scrollTop: $($(this).attr("href")).offset().top + "px"
		}, {
			duration: 800,
			easing: "swing"
		});
		return false;
	});

});
// JQ - BGpos
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);
$(function(){
	$('#menu-top a, #footer-menu a, #topofpage a, #maincontent p a, #maincontent ul a, #maincontent ol a, #wrap-news a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(600px 0)"}, {duration:300})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0px 0)"}, {duration:300, complete:function(){
				$(this).css({backgroundPosition: "0 0"})
			}})
		})

});
jQuery(function(){
	jQuery('ul.sf-menu').superfish();

	$('#footer-menu li:last').addClass('last');
});


/* 
 jQuery(function($){
    
     var images = ['ico_aboutkely.png', 'ico_youth.png', 'ico_services.png', 'ico_school.png', 'ico_parents.png', 'ico_donations.png', 'ico_contact.png'];
    
    $('ul:first > li').each(function(i){
        $(this).addClass('myClass').find('span').eq(0).before('<img src="/../assets/images/logos/' + images[i] + '" />');    
     });
	 
	$('.sf-menu a:active, .myClass, li:first').corner("20px");
	$('.sf-menu li:hover, li:first').corner("20px");
	
 });
*/
