$(document).ready(function(){

$('.ccp-warning').remove();

$('.ccp-tabbed .ccp-nav a').click(function() {
	$('.ccp-tabbed .ccp-nav a.ccp-current').removeClass('ccp-current');
	$(this).addClass('ccp-current');
	$('.ccp-tabbed .ccp-section').css('display', 'none');
	$('.ccp-tabbed .' + $(this).attr('href').substring(1, $(this).attr('href').length)).css('display', 'block');
	return false;
});

$('#ccp-seekers input.default').focus(function() {
	if ($(this).val() == 'Job title, skills or company' || $(this).val() == 'Baton Rouge') {
		$(this).val('').removeClass('default');
	}
});

$('#ccp-login-form').dialog({
	autoOpen: false,
	modal: true,
	title: 'Log in to your account',
	width: 376,
	height: 220,
	resizable: false
});

$('#ccp-nav .ccp-login, #ccp-employers .ccp-login').click(function() {
	$('#ccp-login-form').dialog('open');
	return false;
});

$('#ccp-feedback-form').dialog({
	autoOpen: false,
	modal: true,
	title: 'Get in touch with us',
	width: 376,
	height: 470,
	resizable: false
});

$('#ccp-footer .ccp-button').click(function() {
	$('#ccp-feedback-form').dialog('open');
	return false;
});

$('#ccp-info-form').dialog({
	autoOpen: false,
	modal: true,
	title: 'Get more information',
	width: 376,
	height: 300,
	resizable: false
});

$('.ccp-more-solutions .ccp-button').click(function() {
	$('#ccp-info-form').dialog('open');
	return false;
});

var featuredJobs = new xmlScrollView();
featuredJobs.setOutPutElement('ccp-featured-jobs');
featuredJobs.setItemRoot('Job');
featuredJobs.declareVariable('Title', '%title%');
featuredJobs.declareVariable('Employer', '%employer%');
featuredJobs.declareVariable('Location', '%location%');
featuredJobs.declareVariable('Url', '%url%');
var html = '';
html += '<li class="ccp-job">';
html += '<a class="ccp-job-title" href="%url%">%title%</a> ';
html += '<span class="ccp-job-employer">%employer%</span> ';
html += 'in <span class="ccp-job-location">%location%</span>';
html += '</li>';
featuredJobs.setTemplate(html);
featuredJobs.setScrollDelay(50);				            
featuredJobs.outputFromString(data);

$('#ccp-featured-jobs li:first-child').addClass('first');
$('#ccp-featured-jobs li:odd').addClass('alt');
	
$('#ccp-featured-jobs li').mouseover(function() {
	$(this).css('background', '#e4ceeb');
	featuredJobs.scroller.stopScroll();
});	

$('#ccp-featured-jobs li').mouseout(function() {
	if ($(this).attr('class') == 'alt') {
		$(this).css('background', '#f7f1f9');
	} else {
		$(this).css('background', '');
	}
	featuredJobs.scroller.startScroll();
});

$('#ccp-featured-jobs li').click(function() {
	var anchor = $(this).find('a:eq(0)');
	location.href = anchor.attr('href');
});

$('.ccp-seekers form').submit(function() {
	if ($('#ccp-keywords').val() == 'Job title, skills or company') {
		$('#ccp-keywords').val('');
	}
	if ($('#ccp-city').val() == 'Anywhere') {
		$('#ccp-city').val('');
	}
});	

});
