$(document).ready(function(){
init();
});

function init(){

for (i=2; i<100; i++)
{
$('#clientes .cbox:eq('+i+')').after('<div class="brk clear"></div><div class="grid_4 b12"></div>');
i=i+2;
}
$('#clientes').css('visibility', 'visible');

var spt = $('.crd span');
var at = / at /;
var dot = / dot /g;
var addr = $(spt).text().replace(at,"@").replace(dot,".");
$(spt).after('<a href="mailto:'+addr+'">'+ addr +'</a>')
$(spt).remove();

$('.cbox').click(function() {
window.location = $(this).find('a:first').attr('href');
});
$('.cbox').hover(
function() {
$(this).css('cursor','pointer');
$(this).animate({backgroundColor: '#5f5e5d'}, 'fast', 'swing');
},
function() {
$(this).animate({backgroundColor: '#808080'}, 'fast', 'swing');
}
);

$('.imgc:first').load(function(){
//$('.imgc').css('border', '1px solid #b9b7b9');
$('.imgc').css('background-image', 'none');
}
);

$('.tabc').hide();
$('dl.imgs dt:first').addClass('active').show();

var x=$('#imag1').text();
client(x);
$('.tabc:first').show();

$('dl.imgs dt').click(function() {
$('dl.imgs dt').removeClass('active');
$(this).addClass('active');
$('.tabc').hide();
$('.tabcontainer').css('background-image','none');
var activeTab = $(this).find('a').attr('rel');

var x=$(activeTab).text(); 
client(x);
$(activeTab).fadeIn('1500');
return false;
});

$('.imgs dt a:eq(0)').text('1');
$('.imgs dt a:eq(1)').text('2');
$('.imgs dt a:eq(2)').text('3');
$('.imgs dt a:eq(3)').text('4');
$('.imgs dt a:eq(4)').text('5');
$('.imgs dt a:eq(5)').text('6');
$('.imgs dt a:eq(6)').text('7');
$('.imgs dt a:eq(7)').text('8');
$('.imgs dt a:eq(8)').text('9');
$('.imgs dt').css('visibility', 'visible');

};

function client(x){
var l=5-($.browser.msie);
if ($.browser.opera) {
l=6;
}
var t1=(x).length;
var t2=(t1-l);
var x1=x.slice(1,t2);
var x2=x.slice(t2,t1);
$('#dados').html('<li><strong>Mídia/ </strong>'+x1+'</li><li><strong>Ano/ </strong>'+x2+'</li>');
$('#ficha').css('visibility', 'visible');
};