$('html').addClass('hasjs');

Cufon.replace('h1#tagline, #pnav li a, #pnav li, .model a, .productName a, .button', { 
	fontFamily: 'DIN Regular',
	hover: true
});

Cufon.replace('h1 strong, h1:not(h1#tagline, .print h1)', { 
	fontFamily: 'DIN Bold',
	hover: true
});

$(document).ready(function() {

/* Home Page & Installations Cycling */
$('#slideshow, #installList').after('<div id="slidernav"></div>');
$('#slideshow, #installList ul').cycle({
		fx:     'scrollLeft',
		speed:       500, 
    timeout:     5000, 
    pager:      '#slidernav', 
    pagerEvent: 'click',
    //after:   onAfter,
    pagerAnchorBuilder: function(idx, slide) {
    	if(idx==0){
    		return '<li><a href="#">&nbsp;</a></li>';
    	}else{
    		return '<li><a href="#">&nbsp;</a></li>';
    	}
			},
    pauseOnPagerHover: true
    });    
 
function onAfter(){
	$('#slidernav .activeSlide').addClass('&#8226;');
	$('#slidernav li:not(.activeSlide)').html('&nbsp;');
}

$('#repList div').hide();

//preload mapped images
$('#map area').each(function(){
	var src= $(this).attr('href');
	$('<img>').attr('src', src );
});

/* Rep Map */
$('.sales-reps #map area').hover(function(){
	var src= $(this).attr('rel');
	//console.log(src);
	$('#imageMap').attr('src', src );

});

// change out the contact information below, area alt must match the div class
$('.sales-reps #map area').click(function(){
	var alt= $(this).attr('alt');
	$('#repList div').hide();
	$('#repList div.'+alt).show();
	return false;
});

// Show complete list {
$('#completeList').click(function(){
	$('#repList div').show();
	return false;

});


/* Team Map */
// hide all Rollovers
$('#mapRollovers div').hide();


$('.team #map area').mouseenter(function(e){
	var src= $(this).attr('href');
	var coor = $(this).attr('rel');
	coor = coor.split(',');
	var topY = coor[0]+"px";
	var leftX = coor[1]+"px";
	//console.log(src);
	$('#imageMap').attr('src', src );
	
	var title = $(this).attr('alt');
	//console.log(title);
	title = title.split(',');
	$('#mapRollovers div h6').html(title[0]);
	$('#mapRollovers div p').html(title[1]);
	
	
	$('#mapRollovers div').css({top: topY, left: leftX });
	
	$('#mapRollovers div').show();
	
});

$('.team #map area').mouseleave(function(){
	$('#mapRollovers div').hide();
});

$('.team #map area').click(function(){
	return false;
});


$('#addmycollective').click(function(){
	$('#lightbox').submit();

});

$('#go').click(function(){
	$('#searchform').submit();
});

$('#signin,#submit').click(function(){
	$('form').submit();
});

$('#search').click(function(){
	if ($(this).val() == 'Search') {
		$(this).val('');
	}
});


});



