
// Quick Links slider

$(document).ready(function() {
	
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("fast");
	
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});		
		
});

jQuery(function($) {
	    var slide = false;
	    var height = $('#quick_links_content').height();
	    $('.quick_links').click(function() {
	        var docHeight = $(document).height();
	        var windowHeight = $(window).height();
	        var scrollPos = top;
	        $('#quick_links_content').animate({ height: "toggle"}, 1000);
	       if(slide == false) {
	            $('#quick_links_content').animate({scrollTop: scrollPos+'px'}, 1000);
	                            slide = true;
	        } else {
	                            slide = false;
	                    }
	    });
	});


	
// Faq Page Accordion





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";
	}
}

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // 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: 2,
        wrap: 'circular',
		scroll: 1,
        initCallback: mycarousel_initCallback
    });
});

    function confirm_entry()
    {
        input_box=prompt('Please check that your email address has been entered correctly', document.bionatural_reg.user_email.value);
        if (input_box)
        {
            document.bionatural_reg.user_email.value = input_box;
        }
    }

function back(){
	//handles back in IE when form with post are use.
	if ( $.browser.msie ) {
		window.history.go(-1);
		window.location.reload();
	} else {
		window.history.back();
	}
}

/*
jQuery(document).ready(function(){
	$("#job_results_ctn h4 a").click(function(){		
		//add .ajax_loading to container div
		$("#job_results_ctn").addClass("loader");
		$("#job_results_ctn").load(this.href+" #job_detail>*",function(){
			$("#job_results_header").hide();
			$("#job_detail_header").show();
			//remove .ajax_laoding
			$("#job_results_ctn").removeClass("loader");
			window.stLight.options({publisher:'152ef02e-0737-4a2f-82d1-0ef6aa8cdf9f',offsetTop:'150'});
		});
		return false;
	});
});
*/

jQuery(document).ready(function(){
	$("#job_results_ctn h4 a").click(function(){		
		var c = $("form[name='pages']").serialize();		
		$.cookie("adlogic_search", c);		
	});
});

function repeatSearch(){
	var cookie = $.cookie("adlogic_search");
	var  newform=$("#job_detail").append("<form name='pages' id='pages' action='/jobSearch' method='POST'></form>").find("#pages");
	$.each(cookie.split("&"),function(){
		var a = this.split("=");		
		var input  = "<input name='"+a[0]+"' value='"+a[1]+"' type='hidden'/>";
		newform.append(input);		
	});
	
	document.pages.submit();
}


