$(document).ready(function(){

	$('.lightbox, .member_pic a').lightBox();

	var img1 = $('<img />').attr('src', 'includes/templates/Default/images/top1_hover.png');
	var img2 = $('<img />').attr('src', 'includes/templates/Default/images/top2_hover.png');
	var img3 = $('<img />').attr('src', 'includes/templates/Default/images/top3_hover.png');
	var img4 = $('<img />').attr('src', 'includes/templates/Default/images/top4_hover.png');
	var img5 = $('<img />').attr('src', 'includes/templates/Default/images/top5_hover.png');
	var img6 = $('<img />').attr('src', 'includes/templates/Default/images/top6_hover.png');

	$('.topMenu ul li.getStyle a IMG').mouseover(function(){
		var s = $(this).attr('src');
		//if(s.indexOf('_hover') == -1){
			var sh = s.replace('.png', '_hover.png');
			$(this).attr('src', sh);
		//}
	}).mouseout(function(){
		var s = $(this).attr('src');
		var so = s.replace('_hover', '');
		$(this).attr('src', so);
	});

	var bigID = 0;
	var fadeTime = 5000;
	var fadeSpeed = 1000;
	var fadeTimer;
	//$('#big_'+bigID).fadeIn(fadeSpeed);
	if($('#big_1').length){
		fadeTimer = setInterval(function(){
			var old = bigID;
			bigID++;
			if(!$('#big_'+bigID).length){
				bigID = 0;
			}
			/*$('#big_'+bigID).fadeIn(fadeSpeed, function(){
				$('#big_'+old).fadeOut(fadeSpeed);					
			});*/
			$('#big_'+bigID).animate({
				marginLeft: 0
			}, fadeSpeed);
			$('#big_'+old).animate({
				marginLeft: '960px'
			}, fadeSpeed, function(){
				$(this).css({
					marginLeft: '-960px'
				});
			});
		}, fadeTime);
	}

	/*************** Default Captcha Function please do not modify or remove anything below *************************/

	$('#chptcha_refresh').click(function(){

		$('#captcha_loading').show();
		var siteurl = $('#siteurl').text();

		$.ajax({
			url: siteurl+'/index.php?captcha_refresh=1&rand='+Math.random(),
			dataType: 'html',
			global: false,
			timeout: 2999,
			success: function(){

				$('.captcha_image').attr('src', 'includes/captcha_image.php?rand='+Math.random());
				$('#captcha_loading').hide();

			}

		});

	});

});
