
	$(document).ready(function(){
	
	//Homepage CV window
		$("#cv_submit").click(function () {
			$("#cv_open").dialog("destroy");
			$("#cv_open").dialog({modal: true, title: 'Submit your CV', width: 618, height: 935});
		});    
		
		//homepage banner rotator, utilising ui tabs					   
		$("#featured1").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);
		//
		// Footer Slide out drawer
		$("#toggle a").click(function () {
			$("#linkPanel").slideToggle("slow");
		});	
		//---
		//Top slidedown drawer
		$(".trigger").click(function(){
		if ($("#topslide-inner").is(":hidden")){
					$("#topslide-inner").slideDown("slow");
				}
		  else{
					$("#topslide-inner").slideUp("slow");
		 }
		});
		
		$("#banner_ul li").hover(
			function(){
				$(this).addClass("ui-state-active");
				$(this).addClass("ui-tabs-selected");
				
			},
			function(){
				$(this).removeClass("ui-state-active");
				$(this).removeClass("ui-tabs-selected");
			}
		);
		
		//---
		//banner missing
		$('.banner img').error(function() {
			$(this).attr({
			  src: '../template_images/generic.jpg',
			  alt: 'Dolman'
			});
		  });
		
		//JOB RSS POP- UP
		$('#rssLink a').click(function(){
				$( "#jobRss" ).dialog( "destroy" );					   
				$( "#jobRss" ).dialog({
								modal: true,
								title: 'RSS Feed',
								width: 500,
								height: 300
								});
					   
		});
		//JOB SUBSCRIBE POP- UP
		$('#jobAlertLink a').click(function(){
				$( "#jobAlert" ).dialog( "destroy" );							
				$( "#jobAlert" ).dialog({
								modal: true,
								title: 'Sign up for Job alerts',
								width: 500,
								height: 300
								});
					   
		});
		
	});
	
// JavaScript Document//clear text box on click
function clearText(field){

if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;

}

// Hour switcher
function showhide(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		if (obj.style.display == "none"){
		obj.style.display = "block";
		} else {
		obj.style.display = "none";
		}
	}
}
function show(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		obj.style.display = "block";
	}
}
function hide(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		obj.style.display = "none";
	}
}
//Rounded corners
//DD_roundies.addRule('.ui-corner-all', '3px 3px 3px 3px', true);

//hot job slider
function mycarousel_initCallback(carousel)
{
    

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 15,
		scroll: 1,
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });
});

function validate_ja(){		
		
	if($("input[name='ja_name']").val() == "Name")
		$("input[name='ja_name']").val("");
	if($("input[name='ja_email']").val() == "Email Address")
		$("input[name='ja_email']").val("");
	if($("input[name='ja_surname']").val() == "Surname")
		$("input[name='ja_surname']").val("");
	if($("input[name='ja_phone']").val() == "Phone")
		$("input[name='ja_phone']").val("");
	
}
