
// javascript for the edge profile area by stu 

$(document).ready(function() 
{
	
	
	// request a shoot link
	$('#requestShootLink').click(function()
	{
		$('#requestShootWrap').show();
		
	});
	$('#requestShootWrap').submit(function()
	{
		$(this).load('_profileRequestShoot.php');
		return false;
	});
	
	$('#requestReShootLink').click(function()
	{
		$('#requestReShootWrap').show();
		
	});
	$('#requestReShootWrap').submit(function()
	{
		$(this).load('_profileRequestShoot.php');
		return false;
	});
	
	
	
	
	if ( !$.browser.msie )
	{
		// put shadows on the boxes
		$('.boxFull').not('.noShadow').css('position', 'relative').each(function()
		{
			$(this).append('<img src="/img/layout/shadowFull.png" alt="Shadow" style="display:block;position:absolute;left:0;bottom:-9px;height:8px;width:928px;" />');
		});
		$('.boxFullBorder').not('.noShadow').css('position', 'relative').each(function()
		{
			$(this).append('<img src="/img/layout/shadowFull.png" alt="Shadow" style="clear:left;display:block;position:absolute;left:0;bottom:-14px;height:8px;width:936px;" />');
		});
		
		
		$('.boxThreeQuarter').not('.noShadow').css('position', 'relative').each(function()
		{
			$(this).append('<img src="/img/layout/shadowThreeQuarter.png" alt="Shadow" style="clear:left;display:block;position:absolute;left:0;bottom:-8px;height:8px;" />');
		});
		$('.boxThreeQuarterBorder').not('.noShadow').css('position', 'relative').each(function()
		{
			$(this).append('<img src="/img/layout/shadowThreeQuarter.png" alt="Shadow" style="display:block;position:absolute;left:0;bottom:-14px;height:8px;" />');
		});
		
		
		$('.boxHalf').not('.noShadow').css('position', 'relative').each(function()
		{
			$(this).append('<img src="/img/layout/shadowHalf.png" alt="Shadow" style="display:block;position:absolute;left:0;bottom:-8px;height:8px;width:464px;" />');
		});
		$('.boxHalfBorder').not('.noShadow').css('position', 'relative').each(function()
		{
			$(this).append('<img src="/img/layout/shadowHalf.png" alt="Shadow" style="display:block;position:absolute;left:0;bottom:-14px;height:8px;width:452px;" />');
		});
		
		
		$('.boxQuarter').not('.noShadow').css('position', 'relative').each(function()
		{
			$(this).append('<img src="/img/layout/shadowQuarter.png" alt="Shadow" style="display:block;position:absolute;left:0;bottom:-8px;height:8px;width:228px;" />');
		});
		$('.boxQuarterBorder').not('.noShadow').css('position', 'relative').each(function()
		{
			$(this).append('<img src="/img/layout/shadowQuarter.png" alt="Shadow" style="display:block;position:absolute;left:0;bottom:-14px;height:8px;width:216px;" />');
		});
	}	
	
	if($.browser.msie){
		$('#jobbid_home_box').css('height', '218px');
		$('#uselect_home_box').css('height', '218px');
	}
	
	
	// make h1 clickable
	$('h1').css('cursor','pointer').click(function()
	{
		window.location = '/';
	});
	
	
	
	// about > what we do - sector rollovers
	$('#aboutWhatWeDoSectorHoverWrap a img').css('cursor', 'pointer')
	.mouseover(function()
	{
		$(this).attr('src', $(this).attr('src').replace(/.png/, 'o.png'));
		
	}).mouseout(function()
	{
		$(this).attr('src', $(this).attr('src').replace(/o.png/, '.png'));
		
	});
	
	
	
	// toggle search boxes
	$('#showSearchPane').click(function()
	{
		// show  basic search
		$('#jobSearchAdvanced').css('display', 'block');
		$(this).blur();
		$('#results').css('display', 'none');
		return false;
	});
	
	$('#jobbid_form_link').click(function()
	{
		$('#jobbid_form').slideToggle();
		$('#jobbid_temp_staff').css('height', 'auto');
		return false;
	});

	//Toggle duration box when temporary work selected
	$('#job_type_contract').click(function()
	{
		$('#duration_row').show();
	});	
	
	$('#job_type_permanent').click(function()
	{
		$('#duration_row').hide();
	});	
	
	
	//Clear job description box on focus
	$('#job_description').focus(function()
	{
		if(this.value == 'Enter job description or upload a file'){
			this.value = '';
		}
	});
	
	// ie stuff	
	if ( $.browser.msie )
	{


		// ie7 image cycle thing
		if ( $.browser.version > 6 )
		{
			$('#featuredEmployersList div').css('margin-left', '-80px');
			
			$('#footerWrap').css('margin-top', '0'); // how fooking insane is that?

			$('#indexQuickJobSearch').css('height', '230px');
			$('#indexFeaturedJobs').css('height', '230px');
		}

		// ie6 homepage
		if ( $.browser.version == 6 )
		{
			// image cycled employers
			$('#featuredEmployersList').css({'left':'-80px'});
			// login headings
			$('#indexProfileBanner h4 img').css({'height':'20px', 'display':'block', 'width':'auto'});
			// login / register links - the arrows
			$('#indexProfileBanner p a img').css({'position':'relative', 'top':'0', 'height':'9px'});
			
			// logo - hide text...
			$('h1').css({'height':'127px', 'overflow':'hidden'});
			
		}

		// fix ie6 and ie7. fucking rubbish.
		// featured employers images
		$('img.ie6pushDown').css('margin-top', '20px');
		$('img.reflectedImage').css('opacity', 0.5);


	}
	



	// open external links in new windows...
	$('a[@href^=http]').each(function()
	{
		if ( this.href.indexOf(location.hostname) == -1 )
		{
			$(this).attr('target', '_blank');
		}
	});




	$('head').append('<style type="text/css">@import url("/css/index.css");</style>');



	
});
