function countdown(){
		var time=$('#countdown').attr('title');
		$('.countdown').countdown({
				until: +time, 
				format: 'DHMS',
				layout: '<!--start days-->'+
						'<div class="times">{dnnn}</div>'+			
						
						':<div class="times">{hnn} </div>'+
												
						':<div class="times">{mnn} </div>'+
					
						':<div class="times">{snn}</div>'
		});
}
function newsletter()
{
	$('.subscribe').validate();	
	
	$('input#subsName').focus(function(){
		if($(this).val()=='Enter Your Full Name')
		{
			$(this).val('');	
		}	
	})
	
	$('input#subsEmail').focus(function(){
		if($(this).val()=='Enter Your Email')
		{
			$(this).val('');	
		}	
	})
	
	$('#search').focus(function(){
		if($(this).val()=='Search...')
		{
			$(this).val('');
		}	
	})
	
}

function scrollphoto(div)
{
	var thumnails_con = $(div).parent();
	var cnt = $(thumnails_con).find('.thumb').size();
	if($(div).hasClass('next')){
		if(cnt > 8 && img_pos < (cnt-8)){
			img_move=img_move+46;
			img_pos++;
			$(thumnails_con).find('.photo_scroll').animate( {marginLeft:'-'+String(img_move)+'px'},'slow');
		}
		var src=$('div.active').next('.thumb').children('img.img_thumb').attr('src');
		var title=$('div.active').next('.thumb').children('img.img_thumb').attr('alt');
		$('div.active').next('.thumb').addClass('tmpActive');
		$('.thumb').removeClass('active');
		$('.tmpActive').addClass('active').removeClass('tmpActive');
		$('.main').children('img').hide(); $('.main').children('.title_img').hide();
		$('.main').children('img').attr('src',src);
		$('.main').children('.title_img').html('<p>'+title+'</p>');
		$('.main').children('img').fadeIn('slow'); $('.main').children('.title_img').fadeIn('slow');
	}else{
		if(img_pos > 0 ){
			img_move=img_move-46;
			img_pos--; 
			$(thumnails_con).find('.photo_scroll').animate( {marginLeft:'-'+String(img_move)+'px'},'slow');
		} 
		
		var src=$('div.active').prev('.thumb').children('img.img_thumb').attr('src');
		var title=$('div.active').prev('.thumb').children('img.img_thumb').attr('alt');
		$('div.active').prev('.thumb').addClass('tmpActive');
		$('.thumb').removeClass('active');
		$('.tmpActive').addClass('active').removeClass('tmpActive');
		$('.main').children('img').hide(); $('.main').children('.title_img').hide();
		$('.main').children('img').attr('src',src);
		$('.main').children('.title_img').html('<p>'+title+'</p>');
		$('.main').children('img').fadeIn('slow'); $('.main').children('.title_img').fadeIn('slow');
	}

} 

function scrollSpon()
{
	$('img.pointer').click(function(){
		var no=$('div.sponitem').size();
		if($(this).hasClass('pointerLeft'))
		{
			if(no > 7)
			{
				$('div.scrollBox').animate({marginLeft:'-121px'},'slow');
				setTimeout('left()',700);	
			}
		}else
		{
			if(no > 3)
			{
				$('div.scrollBox').animate({marginLeft:'121px'},'slow');
				setTimeout('right()',700);	
			}
		}
	});	
}

function left()
{
	var obj=$('div.scrollBox').children('.sponitem:first');
	$('div.scrollBox').children('.sponitem:first').remove();
	$('div.scrollBox').append('<div class="sponitem">'+obj.html()+'</div>')
	$('div.scrollBox').css('margin-left','0px');
}

function right()
{
	var obj=$('div.scrollBox').children('.sponitem:last');
	$('div.scrollBox').children('.sponitem:last').remove();
	$('div.scrollBox').html('<div class="sponitem">'+obj.html()+'</div>'+$('div.scrollBox').html())
	$('div.scrollBox').css('margin-left','0px');
}

function tabHandler()
{
	$('.tab').click(function(){
		if($(this).hasClass('active')!=true)
		{
			$('.tab').removeClass('active');
			$(this).addClass('active');	
			$('.tab-content').hide();
			$('.tab-content:eq('+$('.tab').index(this)+')').fadeIn('slow');
		}	
	})
}

function autoScroll()
{
	if($('div.active').next('.thumb').length > 0)
	{
		var cnt = $('.thumb').size();
		if(cnt > 8 && img_pos < (cnt-8)){
			
			
			img_move=img_move+46;
			img_pos++;
			$('.photo_scroll').animate( {marginLeft:'-'+String(img_move)+'px'},'slow');
		}
		
		var src=$('div.active').next('.thumb').children('img.img_thumb').attr('src');
		var title=$('div.active').next('.thumb').children('img.img_thumb').attr('alt');
		$('div.active').next('.thumb').addClass('tmpActive');
		$('.thumb').removeClass('active');
		$('.tmpActive').addClass('active').removeClass('tmpActive');
		$('.main').children('img').hide(); $('.main').children('.title_img').hide();
		$('.main').children('img').attr('src',src);
		$('.main').children('.title_img').html('<p>'+title+'</p>');
		$('.main').children('img').fadeIn('slow'); $('.main').children('.title_img').fadeIn('slow');
		
	
		
	}else
	{
		
		$('.thumb').removeClass('active');
		$('.thumb:first').addClass('active');
		var src=$('.thumb:first').children('img.img_thumb').attr('src');
		var title=$('.thumb:first').children('img.img_thumb').attr('alt');
		$('.main').children('img').hide(); $('.main').children('.title_img').hide();
		$('.main').children('img').attr('src',src);
		$('.main').children('.title_img').html('<p>'+title+'</p>');
		$('.main').children('img').fadeIn('slow'); $('.main').children('.title_img').fadeIn('slow');
		
		if(img_pos > 0 ){
			$('.photo_scroll').animate( {marginLeft:'0px'},'slow');
		}
		img_pos=0;
		img_move=0;
	}
	
	
}

$(function() {
	setInterval( "autoScroll()", 8000 );
});


