//	jquery init
(function($) {

//	contact form

if(output == 'job_page') 
{

	cat = $('.pre_js').html();
	
	if		(cat == 'fashion') {cat = 'tanya'}
	else if	(cat == 'agency')  {cat = 'rick'}

	cat = cat + '@modaconsult.co.uk';
	
	$('form div').after('<p><span class="wpcf7-form-control-wrap job_title"><input type="hidden" name="job_title" value="'+$('.title').html()+'" /></span></p><p><span class="wpcf7-form-control-wrap job_to"><input type="hidden" name="job_to" value="'+cat+'" /></span></p>');

	$('.applyhere').append('<a href="mailto:'+cat+'?subject=APPLICATION FOR '+ $('.title').html() + '">EMAIL US DIRECTLY</a>');
	
	$('.job_title input').attr('value', $('.title').html());
}


//	click on logo, go back home	///////////////////////////////////

$('#logo').click(function() {document.location = $(this).children('p').html()});



//	big image flashy stuff	///////////////////////////////////////

$canvas = $('#big_img').children('#img_canvas');
loc = $canvas.html();

if(loc) 
{
	$canvas.html('');
		
	$(new Image())
		.load(function() 
		{
			$canvas.css({'background':'url('+this.src+') no-repeat'});
			
			a = [];
			c = 0;
			$('.img_line').each(function(i, v) {a.push(v)});
			
			cycle = setInterval(lines, 100);
			
			
			function lines()
			{
				$e = $(a[c]);
				
				b = false;
				c++;
				if(c == a.length)
				{
					clearInterval(cycle);
					b = function() {$canvas.fadeIn(2000)};
				}
				
				$e.fadeIn(1000, b);
			}
		})
		
		.attr('src', loc);
}



//	joblist interaction		///////////////////////////////////////

function side_over() {$(this).children('.menu').css('color', '#0070ff');	$(this).children('.to_all').css('text-decoration', 'underline');}
function side_out()  {$(this).children('.menu').css('color', '#000');		$(this).children('.to_all').css('text-decoration', 'none');}

$('.joblist').hover(side_over, side_out);
$('.joblist').click(function() {window.location = $(this).children('.link').html()});

function home_over() {$(this).children('.title').css('color', '#0070ff');	$('#'+$(this).parent().attr('id')+'_bottom').css('text-decoration', 'underline');}
function home_out()  {$(this).children('.title').css('color', '#000');		$('#'+$(this).parent().attr('id')+'_bottom').css('text-decoration', 'none');}

$('.jobcolumn').hover(home_over, home_out);
$('.jobcolumn').click(function() {window.location = $(this).children('.link').html()});

function view_over() {id = $(this).attr('id'); $('#'+id.substr(0, id.indexOf('_bottom'))).children('.jobcolumn').children('.title').css('color', '#0070ff');	$(this).css('text-decoration', 'underline');}
function view_out()  {id = $(this).attr('id'); $('#'+id.substr(0, id.indexOf('_bottom'))).children('.jobcolumn').children('.title').css('color', '#000');		$(this).css('text-decoration', 'none');}

$('.to_all').hover(view_over, view_out);
$('.to_all').click(function() {id = $(this).attr('id'); window.location = $('#'+id.substr(0, id.indexOf('_bottom'))).children('.jobcolumn').children('.link').html()});


$('.jobclick').click(function() {document.location = $(this).parent().children('.link').html();})




})(jQuery);
