JQuery Debug

Help!!!

Nothing below

//This script is the navigation expansion script //
function doSomething(elem) {
$(elem).parents("ul").children("li").show();
$(elem).parent("li").hide();
}
//End this script is the navigation expansion script //

Open in new window


is working!

Here's my code!

<script>
//This script is the script that returns XML locations //
$(document).ready(function() {
$("#loc").autocomplete({
source: function(request, response){
$.ajax({
url:"/scripts/locations.asp",
dataType:"xml",
data: {"term":request.term},
success: function(data){
var items = [];
$("item", data).each(function(i,v) {
var item = { location: $("location",v).text(), region: $("region",v).text(), label:$("label",v).text() };
items.push(item);
})
response(items);
}
});
},
//			minLength: 2,
select: function( event, ui ) {
$("#location").val(ui.item.location);
$("#region").val(ui.item.region);
$("#loc").val(ui.item.label);
}
});
});
// End this script is the script that returns XML locations //	

// Profile Page Only //

// this script hides profile boxes //	
$(document).ready(function() {
	$('#Personal_Statement').hide();
	$('#Skills_Expertise').hide();
	$('#Work_History').hide();
	$('#QualificationSelect').hide();
	$('#GCSE').hide();
	$('#Alevel').hide();
	$('#Degree').hide();
	$('#Masters').hide();
	$('#phd').hide();
	$('#other').hide();
	$('#Covering_Letter').hide();
	$('#CVs').hide();
	$('#Availability').hide();
	$('#Edit_Personal_Statement').hide();
	$('#Edit_Work_History').hide();
	$('#Edit_Qualifications').hide();
	$('#Edit_Covering_Letter').hide();
});
// End this script hides profile boxes //

// this script shows personal statement//	

$(document).ready(
    function(){
        $("#AddProfile a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Availability').hide();
            $('#Personal_Statement').show();
        });

    });

// End this script shows personal statement//	

// this script shows availability//	

$(document).ready(
    function(){
        $("#AvailabilityDetail a.editlinks").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').show();
        });

    });
$(document).ready(
    function(){
        $("#AvailabilityDetail a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').show();
        });

    });

// End this script shows availability//	


// this script shows Skills_Expertise //	

$(document).ready(
    function(){
        $("#AddSkills a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').hide();
            $('#Skills_Expertise').show();
        });

    });
$(document).ready(
    function(){
        $("#AddSkills a.editlinks").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').hide();
            $('#Skills_Expertise').show();
        });

    });

// End this script shows Skills_Expertise//	


// this script shows Work_History//	

$(document).ready(
    function(){
        $("#AddWorkHistory a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
			$('#Availability').hide();
            $('#Work_History').show();
        });

    });

// End this script shows Work_History//	


// this script shows QualificationSelect/	

$(document).ready(
    function(){
        $("#AddQualificationSelect a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
			$('#Availability').hide();
            $('#QualificationSelect').show();
        });

    });

// End this script shows QualificationSelect//	


// this script shows Covering_Letter//	

$(document).ready(
    function(){
        $("#AddCoveringLette a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#CVs').hide();
			$('#Availability').hide();
            $('#Covering_Letter').show();
        });

    });

// End this script shows Covering_Letter//	


// this script shows CVs//	

$(document).ready(
    function(){
        $("#AddCV a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
			$('#Availability').hide();
            $('#CVs').show();
        });

    });

// End this script shows CVs//	

// xxxxx //

$(document).ready(
    function(){
        $("#AddProfile a.editlinks").click(function () {
       		$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Availability').hide();
			$('#Edit_Personal_Statement').show();
        });

    });
// xxxxxxxxx //

// Edit covering letter //
 $(document).ready(
    function(){
        $("#AddCoveringLette a.editlinks").click(function () {
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Edit_Personal_Statement').hide();
			$('#Availability').hide();
			$('#Edit_Covering_Letter').show();
        });

    });

// End Edit covering letter //

//Edit work history //

$(document).ready(
    function(){
        $("#AddWorkHistory a.editlinks").click(function () {
	   		$('#Edit_Job_Title').val($(this).data('jobtitle'));
	   		$('#Edit_Company').val($(this).data('company'));
	   		$('#Edit_start_date').val($(this).data('startdate'));
	   		$('#Edit_end_date').val($(this).data('enddate'));
	   		$('#Edit_job_description').val($(this).data('description'));

			tinymce.init({
        selector: "textarea",
        toolbar1: "paste | bold italic underline  | alignleft aligncenter alignright alignjustify | bullist numlist | ",

        menubar: false,
        toolbar_items_size: 'small',
    	paste_as_text: true,
		browser_spellcheck : true,
		statusbar : false,
		height : 400,

        style_formats: [
                {title: 'Bold text', inline: 'b'},
        ],

});
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Edit_Personal_Statement').hide();
            $('#Work_History').hide();
			$('#Availability').hide();
       		$('#Edit_Work_History').show();
        });

    });
	
// End Edit work history //

// Qualification Select //
$(function () {
  $("#QualificationType").change(function() {
         $("#GCSE").hide();
         $("#Alevel").hide();
         $("#Degree").hide();
         $("#Masters").hide();
         $("#phd").hide();
         $("#other").hide();
    var val = $(this).val();
    if(val === "GCSE") {
        $("#GCSE").show();
    }
    if(val === "ALevel") {
        $("#Alevel").show();
    }
    if(val === "Degree") {
        $("#Degree").show();
    }
    if(val === "Masters") {
        $("#Masters").show();
    }
    if(val === "PHD") {
        $("#phd").show();
    }
    else if(val === "Other") {
        $("#other").show();
    }
  });
});

// End of Qualification Select //

// End Profile Page Only  //	


//This script is the Twitter script //
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');// End this script is the Twitter script //
//This script is the Facebook script //
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
//End this script is the Facebook script //
//This script is the Google + script //
window.___gcfg = {lang: 'en-GB'};

(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
//End this script is the Google + script //
//This script is the Sticky script //
$(document).ready(function() {
// grab the initial top offset of the navigation 
var stickyNavTop = $('.nav').offset().top;
// our function that decides weather the navigation bar should have "fixed" css position or not.
var stickyNav = function(){
var scrollTop = $(window).scrollTop(); // our current vertical position from the top

// if we've scrolled more than the navigation, change its position to fixed to stick to top,
// otherwise change it back to relative
if (scrollTop > stickyNavTop) { 
$('.nav').addClass('sticky');
} else {
$('.nav').removeClass('sticky'); 
}
};
stickyNav();
// and run it again every time you scroll
$(window).scroll(function() {
stickyNav();
});
});
//End this script is the Sticky script //
//This script is the navigation expansion script //
function doSomething(elem) {
$(elem).parents("ul").children("li").show();
$(elem).parent("li").hide();
}
//End this script is the navigation expansion script //

//Date Picker //

  $(function() {
    $( ".datepicker" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true
    });
  });
// End date picker //
 
///////////////////////////////////////////////////////////////////////////////////////////////////////

/*
*  Simple image gallery. Uses default settings
*/

$('.fancybox').fancybox({
openEffect : 'none',
helpers : {
title : null            
}           
});

/*
*  Different effects
*/

// Change title type, overlay closing speed
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});

// Disable opening and closing animations, change title type
$(".fancybox-effects-b").fancybox({
openEffect  : 'none',
closeEffect	: 'none',

helpers : {
title : {
type : 'over'
}
}
});

// Set custom style, close if clicked, change title type and overlay color
$(".fancybox-effects-c").fancybox({
wrapCSS    : 'fancybox-custom',
closeClick : true,

openEffect : 'none',

helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(238,238,238,0.85)'
}
}
}
});

// Remove padding, set opening and closing animations, close if clicked and disable overlay
$(".fancybox-effects-d").fancybox({
padding: 0,

openEffect : 'elastic',
openSpeed  : 150,

closeEffect : 'elastic',
closeSpeed  : 150,

closeClick : true,

helpers : {
overlay : null
}
});

/*
*  Button helper. Disable animations, hide close button, change title type and content
*/

$('.fancybox-buttons').fancybox({
openEffect  : 'none',
closeEffect : 'none',

prevEffect : 'none',
nextEffect : 'none',

closeBtn  : false,

helpers : {
title : {
type : 'inside'
},
buttons	: {}
},

afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});


/*
*  Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/

$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',

closeBtn  : false,
arrows    : false,
nextClick : true,

helpers : {
thumbs : {
width  : 50,
height : 50
}
}
});

/*
*  Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
*/
$('.fancybox-media')
.attr('rel', 'media-gallery')
.fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',

arrows : false,
helpers : {
media : {},
buttons : {}
}
});

/*
*  Open manually
*/

$("#fancybox-manual-a").click(function() {
$.fancybox.open('1_b.jpg');
});

$("#fancybox-manual-b").click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 5
});
});

$("#fancybox-manual-c").click(function() {
$.fancybox.open([
{
href : '1_b.jpg',
title : 'My title'
}, {
href : '2_b.jpg',
title : '2nd title'
}, {
href : '3_b.jpg'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});
/* End of Fancybox 8/
/* File input */
VIGET.fileInputs = function() {
  var $this = $(this),
      $val = $this.val(),
      valArray = $val.split('\\'),
      newVal = valArray[valArray.length-1],
      $button = $this.siblings('.button'),
      $fakeFile = $this.siblings('.file-holder');
  if(newVal !== '') {
    $button.text('Photo Chosen');
    if($fakeFile.length === 0) {
      $button.after('' + newVal + '');
    } else {
      $fakeFile.text(newVal);
    }
  }
};
 
$(document).ready(function() {
  $('.file-wrapper input[type=file]')
  .bind('change focus click', VIGET.fileInputs);
});
/* End of file input */
/* Enable submitbutton */
$(function(){
$("input[type=submit]").removeAttr('disabled');
});
/* End Enable submitbutton */
///////////////////////////////////////////////////////////////////////////////////////////////////////
</script>

Open in new window


Please help!

Thank you
garethtnashAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom BeckCommented:
Maybe because everything below that doSomething() function is outside of a $(document).ready() function. That's despite the fact that you have no less than FOURTEEN $(document).ready() functions above that script!! Yikes!
garethtnashAuthor Commented:
Thanks Tom, I'm quite new to JQuery, could you confirm what you mean? thanks
Do i just put one $(document).ready()?
garethtnashAuthor Commented:
I've tried this, but now nothing functions!

<script>
//This script is the script that returns XML locations //
$(document).ready(function() {
$(function() {
$("#loc").autocomplete({
source: function(request, response){
$.ajax({
url:"/scripts/locations.asp",
dataType:"xml",
data: {"term":request.term},
success: function(data){
var items = [];
$("item", data).each(function(i,v) {
var item = { location: $("location",v).text(), region: $("region",v).text(), label:$("label",v).text() };
items.push(item);
})
response(items);
}
});
},
//			minLength: 2,
select: function( event, ui ) {
$("#location").val(ui.item.location);
$("#region").val(ui.item.region);
$("#loc").val(ui.item.label);
}
});
});
// End this script is the script that returns XML locations //	

// Profile Page Only //

// this script hides profile boxes //	
$(function() {
	$('#Personal_Statement').hide();
	$('#Skills_Expertise').hide();
	$('#Work_History').hide();
	$('#QualificationSelect').hide();
	$('#GCSE').hide();
	$('#Alevel').hide();
	$('#Degree').hide();
	$('#Masters').hide();
	$('#phd').hide();
	$('#other').hide();
	$('#Covering_Letter').hide();
	$('#CVs').hide();
	$('#Availability').hide();
	$('#Edit_Personal_Statement').hide();
	$('#Edit_Work_History').hide();
	$('#Edit_Qualifications').hide();
	$('#Edit_Covering_Letter').hide();
});
// End this script hides profile boxes //

// this script shows personal statement//	

$(function(){
        $("#AddProfile a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Availability').hide();
            $('#Personal_Statement').show();
        });

    });

// End this script shows personal statement//	

// this script shows availability//	

$(function(){
        $("#AvailabilityDetail a.editlinks").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').show();
        });

    });
$(function(){
        $("#AvailabilityDetail a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').show();
        });

    });

// End this script shows availability//	


// this script shows Skills_Expertise //	

$(function(){
        $("#AddSkills a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').hide();
            $('#Skills_Expertise').show();
        });

    });
$(function(){
        $("#AddSkills a.editlinks").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').hide();
            $('#Skills_Expertise').show();
        });

    });

// End this script shows Skills_Expertise//	


// this script shows Work_History//	

$(function(){
        $("#AddWorkHistory a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
			$('#Availability').hide();
            $('#Work_History').show();
        });

    });

// End this script shows Work_History//	


// this script shows QualificationSelect/	

$(function(){
        $("#AddQualificationSelect a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
			$('#Availability').hide();
            $('#QualificationSelect').show();
        });

    });

// End this script shows QualificationSelect//	


// this script shows Covering_Letter//	

$(function(){
        $("#AddCoveringLette a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#CVs').hide();
			$('#Availability').hide();
            $('#Covering_Letter').show();
        });

    });

// End this script shows Covering_Letter//	


// this script shows CVs//	

$(function(){
        $("#AddCV a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
			$('#Availability').hide();
            $('#CVs').show();
        });

    });

// End this script shows CVs//	

// xxxxx //

$(function(){
        $("#AddProfile a.editlinks").click(function () {
       		$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Availability').hide();
			$('#Edit_Personal_Statement').show();
        });

    });
// xxxxxxxxx //

// Edit covering letter //
 $(function(){
        $("#AddCoveringLette a.editlinks").click(function () {
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Edit_Personal_Statement').hide();
			$('#Availability').hide();
			$('#Edit_Covering_Letter').show();
        });

    });

// End Edit covering letter //

//Edit work history //

$(function(){
        $("#AddWorkHistory a.editlinks").click(function () {
	   		$('#Edit_Job_Title').val($(this).data('jobtitle'));
	   		$('#Edit_Company').val($(this).data('company'));
	   		$('#Edit_start_date').val($(this).data('startdate'));
	   		$('#Edit_end_date').val($(this).data('enddate'));
	   		$('#Edit_job_description').val($(this).data('description'));

			tinymce.init({
        selector: "textarea",
        toolbar1: "paste | bold italic underline  | alignleft aligncenter alignright alignjustify | bullist numlist | ",

        menubar: false,
        toolbar_items_size: 'small',
    	paste_as_text: true,
		browser_spellcheck : true,
		statusbar : false,
		height : 400,

        style_formats: [
                {title: 'Bold text', inline: 'b'},
        ],

});
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Edit_Personal_Statement').hide();
            $('#Work_History').hide();
			$('#Availability').hide();
       		$('#Edit_Work_History').show();
        });

    });
	
// End Edit work history //

// Qualification Select //
$(function () {
  $("#QualificationType").change(function() {
         $("#GCSE").hide();
         $("#Alevel").hide();
         $("#Degree").hide();
         $("#Masters").hide();
         $("#phd").hide();
         $("#other").hide();
    var val = $(this).val();
    if(val === "GCSE") {
        $("#GCSE").show();
    }
    if(val === "ALevel") {
        $("#Alevel").show();
    }
    if(val === "Degree") {
        $("#Degree").show();
    }
    if(val === "Masters") {
        $("#Masters").show();
    }
    if(val === "PHD") {
        $("#phd").show();
    }
    else if(val === "Other") {
        $("#other").show();
    }
  });
});

// End of Qualification Select //

// End Profile Page Only  //	


//This script is the Twitter script //
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');// End this script is the Twitter script //
//This script is the Facebook script //
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
//End this script is the Facebook script //
//This script is the Google + script //
window.___gcfg = {lang: 'en-GB'};

(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
//End this script is the Google + script //
//This script is the Sticky script //
$(document).ready(function() {
// grab the initial top offset of the navigation 
var stickyNavTop = $('.nav').offset().top;
// our function that decides weather the navigation bar should have "fixed" css position or not.
var stickyNav = function(){
var scrollTop = $(window).scrollTop(); // our current vertical position from the top

// if we've scrolled more than the navigation, change its position to fixed to stick to top,
// otherwise change it back to relative
if (scrollTop > stickyNavTop) { 
$('.nav').addClass('sticky');
} else {
$('.nav').removeClass('sticky'); 
}
};
stickyNav();
// and run it again every time you scroll
$(window).scroll(function() {
stickyNav();
});
});
//End this script is the Sticky script //
//This script is the navigation expansion script //
function doSomething(elem) {
$(elem).parents("ul").children("li").show();
$(elem).parent("li").hide();
}
//End this script is the navigation expansion script //

//Date Picker //
$(function() {
$( ".datepicker" ).datepicker({
showOtherMonths: true,
selectOtherMonths: true
});
});
// End date picker //
 /* Enable submitbutton */
$(function(){
$("input[type=submit]").removeAttr('disabled');
});
/* End Enable submitbutton */

///////////////////////////////////////////////////////////////////////////////////////////////////////

/*
*  Simple image gallery. Uses default settings
*/

$('.fancybox').fancybox({
openEffect : 'none',
helpers : {
title : null            
}           
});

/*
*  Different effects
*/

// Change title type, overlay closing speed
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});

// Disable opening and closing animations, change title type
$(".fancybox-effects-b").fancybox({
openEffect  : 'none',
closeEffect	: 'none',

helpers : {
title : {
type : 'over'
}
}
});

// Set custom style, close if clicked, change title type and overlay color
$(".fancybox-effects-c").fancybox({
wrapCSS    : 'fancybox-custom',
closeClick : true,

openEffect : 'none',

helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(238,238,238,0.85)'
}
}
}
});

// Remove padding, set opening and closing animations, close if clicked and disable overlay
$(".fancybox-effects-d").fancybox({
padding: 0,

openEffect : 'elastic',
openSpeed  : 150,

closeEffect : 'elastic',
closeSpeed  : 150,

closeClick : true,

helpers : {
overlay : null
}
});

/*
*  Button helper. Disable animations, hide close button, change title type and content
*/

$('.fancybox-buttons').fancybox({
openEffect  : 'none',
closeEffect : 'none',

prevEffect : 'none',
nextEffect : 'none',

closeBtn  : false,

helpers : {
title : {
type : 'inside'
},
buttons	: {}
},

afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});


/*
*  Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/

$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',

closeBtn  : false,
arrows    : false,
nextClick : true,

helpers : {
thumbs : {
width  : 50,
height : 50
}
}
});

/*
*  Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
*/
$('.fancybox-media')
.attr('rel', 'media-gallery')
.fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',

arrows : false,
helpers : {
media : {},
buttons : {}
}
});

/*
*  Open manually
*/

$("#fancybox-manual-a").click(function() {
$.fancybox.open('1_b.jpg');
});

$("#fancybox-manual-b").click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 5
});
});

$("#fancybox-manual-c").click(function() {
$.fancybox.open([
{
href : '1_b.jpg',
title : 'My title'
}, {
href : '2_b.jpg',
title : '2nd title'
}, {
href : '3_b.jpg'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});
/* End of Fancybox 8/
/* File input */
VIGET.fileInputs = function() {
  var $this = $(this),
      $val = $this.val(),
      valArray = $val.split('\\'),
      newVal = valArray[valArray.length-1],
      $button = $this.siblings('.button'),
      $fakeFile = $this.siblings('.file-holder');
  if(newVal !== '') {
    $button.text('Photo Chosen');
    if($fakeFile.length === 0) {
      $button.after('' + newVal + '');
    } else {
      $fakeFile.text(newVal);
    }
  }
};
 
$(function() {
  $('.file-wrapper input[type=file]')
  .bind('change focus click', VIGET.fileInputs);
});
});
/* End of file input */
///////////////////////////////////////////////////////////////////////////////////////////////////////
</script>

Open in new window

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Tom BeckCommented:
Your named functions like:
function doSomething(elem) {
$(elem).parents("ul").children("li").show();
$(elem).parent("li").hide();
}

Open in new window

can go outside of the $(document).ready() function but any traversing of the DOM like

 $('some selector').function()

need to be inside of a $(document).ready() function. ONE ready function per page is all you need.
Tom BeckCommented:
There's a lot that can be done to simplify your script but I don't have the time. Realize that:

$(function(){
});

Is just shorthand for:

$(document).ready(function(){
});

You have many instances of:

function() {
}

That serve no purpose.

Also, indenting lines of code for readability is important.

Try this syntax. It's untested of course because I don't have you html.
//This script is the script that returns XML locations //
$(document).ready(function () {
        $("#loc").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/scripts/locations.asp",
                    dataType: "xml",
                    data: {
                        "term": request.term
                    },
                    success: function (data) {
                        var items = [];
                        $("item", data).each(function (i, v) {
                            var item = {
                                location: $("location", v).text(),
                                region: $("region", v).text(),
                                label: $("label", v).text()
                            };
                            items.push(item);
                        })
                        response(items);
                    }
                });
            },
            //			minLength: 2,
            select: function (event, ui) {
                $("#location").val(ui.item.location);
                $("#region").val(ui.item.region);
                $("#loc").val(ui.item.label);
            }
		});
    // End this script is the script that returns XML locations //	

    // Profile Page Only //

    // this script hides profile boxes //
        $('#Personal_Statement').hide();
        $('#Skills_Expertise').hide();
        $('#Work_History').hide();
        $('#QualificationSelect').hide();
        $('#GCSE').hide();
        $('#Alevel').hide();
        $('#Degree').hide();
        $('#Masters').hide();
        $('#phd').hide();
        $('#other').hide();
        $('#Covering_Letter').hide();
        $('#CVs').hide();
        $('#Availability').hide();
        $('#Edit_Personal_Statement').hide();
        $('#Edit_Work_History').hide();
        $('#Edit_Qualifications').hide();
        $('#Edit_Covering_Letter').hide();
    // End this script hides profile boxes //

    // this script shows personal statement//
        $("#AddProfile a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Availability').hide();
            $('#Personal_Statement').show();
        });
    // End this script shows personal statement//	

    // this script shows availability//	
        $("#AvailabilityDetail a.editlinks").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Availability').show();
        });
        $("#AvailabilityDetail a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Availability').show();
        });

    // End this script shows availability//	


    // this script shows Skills_Expertise //
        $("#AddSkills a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Availability').hide();
            $('#Skills_Expertise').show();
        });
        $("#AddSkills a.editlinks").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Availability').hide();
            $('#Skills_Expertise').show();
        });

    // End this script shows Skills_Expertise//	


    // this script shows Work_History//	
        $("#AddWorkHistory a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Availability').hide();
            $('#Work_History').show();
        });

    // End this script shows Work_History//	


    // this script shows QualificationSelect/
        $("#AddQualificationSelect a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#Availability').hide();
            $('#QualificationSelect').show();
        });

    // End this script shows QualificationSelect//	


    // this script shows Covering_Letter//	
        $("#AddCoveringLette a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#CVs').hide();
            $('#Availability').hide();
            $('#Covering_Letter').show();
        });


    // End this script shows Covering_Letter//	


    // this script shows CVs//	
        $("#AddCV a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#Availability').hide();
            $('#CVs').show();
        });

    // End this script shows CVs//	

    // xxxxx //
        $("#AddProfile a.editlinks").click(function () {
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Availability').hide();
            $('#Edit_Personal_Statement').show();
        });
    // xxxxxxxxx //

    // Edit covering letter //
        $("#AddCoveringLette a.editlinks").click(function () {
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Edit_Personal_Statement').hide();
            $('#Availability').hide();
            $('#Edit_Covering_Letter').show();
        });
    // End Edit covering letter //

    //Edit work history //
        $("#AddWorkHistory a.editlinks").click(function () {
            $('#Edit_Job_Title').val($(this).data('jobtitle'));
            $('#Edit_Company').val($(this).data('company'));
            $('#Edit_start_date').val($(this).data('startdate'));
            $('#Edit_end_date').val($(this).data('enddate'));
            $('#Edit_job_description').val($(this).data('description'));

            tinymce.init({
                selector: "textarea",
                toolbar1: "paste | bold italic underline  | alignleft aligncenter alignright alignjustify | bullist numlist | ",

                menubar: false,
                toolbar_items_size: 'small',
                paste_as_text: true,
                browser_spellcheck: true,
                statusbar: false,
                height: 400,

                style_formats: [{
                    title: 'Bold text',
                    inline: 'b'
                }, ],

            });
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Edit_Personal_Statement').hide();
            $('#Work_History').hide();
            $('#Availability').hide();
            $('#Edit_Work_History').show();
        });

    // End Edit work history //

    // Qualification Select //
        $("#QualificationType").change(function () {
            $("#GCSE").hide();
            $("#Alevel").hide();
            $("#Degree").hide();
            $("#Masters").hide();
            $("#phd").hide();
            $("#other").hide();
            var val = $(this).val();
            if (val === "GCSE") {
                $("#GCSE").show();
            }
            if (val === "ALevel") {
                $("#Alevel").show();
            }
            if (val === "Degree") {
                $("#Degree").show();
            }
            if (val === "Masters") {
                $("#Masters").show();
            }
            if (val === "PHD") {
                $("#phd").show();
            } else if (val === "Other") {
                $("#other").show();
            }
        });

    // End of Qualification Select //

    // End Profile Page Only  //	


    //This script is the Twitter script //
    ! function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0],
            p = /^http:/.test(d.location) ? 'http' : 'https';
        if (!d.getElementById(id)) {
            js = d.createElement(s);
            js.id = id;
            js.src = p + '://platform.twitter.com/widgets.js';
            fjs.parentNode.insertBefore(js, fjs);
        }
    }(document, 'script', 'twitter-wjs'); // End this script is the Twitter script //
    //This script is the Facebook script //
    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s);
        js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    //End this script is the Facebook script //
    //This script is the Google + script //
    window.___gcfg = {
        lang: 'en-GB'
    };

    (function () {
        var po = document.createElement('script');
        po.type = 'text/javascript';
        po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(po, s);
    })();
    //End this script is the Google + script //
    //This script is the Sticky script //
    $(document).ready(function () {
        // grab the initial top offset of the navigation 
        var stickyNavTop = $('.nav').offset().top;
        // our function that decides weather the navigation bar should have "fixed" css position or not.
        var stickyNav = function () {
            var scrollTop = $(window).scrollTop(); // our current vertical position from the top

            // if we've scrolled more than the navigation, change its position to fixed to stick to top,
            // otherwise change it back to relative
            if (scrollTop > stickyNavTop) {
                $('.nav').addClass('sticky');
            } else {
                $('.nav').removeClass('sticky');
            }
        };
        stickyNav();
        // and run it again every time you scroll
        $(window).scroll(function () {
            stickyNav();
        });
    });
    //End this script is the Sticky script //
    //This script is the navigation expansion script //
    function doSomething(elem) {
        $(elem).parents("ul").children("li").show();
        $(elem).parent("li").hide();
    }
    //End this script is the navigation expansion script //

    //Date Picker //
    $(function () {
        $(".datepicker").datepicker({
            showOtherMonths: true,
            selectOtherMonths: true
        });
    });
    // End date picker //
    /* Enable submitbutton */
    $(function () {
        $("input[type=submit]").removeAttr('disabled');
    });
    /* End Enable submitbutton */

    ///////////////////////////////////////////////////////////////////////////////////////////////////////

    /*
     *  Simple image gallery. Uses default settings
     */

    $('.fancybox').fancybox({
        openEffect: 'none',
        helpers: {
            title: null
        }
    });

    /*
     *  Different effects
     */

    // Change title type, overlay closing speed
    $(".fancybox-effects-a").fancybox({
        helpers: {
            title: {
                type: 'outside'
            },
            overlay: {
                speedOut: 0
            }
        }
    });

    // Disable opening and closing animations, change title type
    $(".fancybox-effects-b").fancybox({
        openEffect: 'none',
        closeEffect: 'none',

        helpers: {
            title: {
                type: 'over'
            }
        }
    });

    // Set custom style, close if clicked, change title type and overlay color
    $(".fancybox-effects-c").fancybox({
        wrapCSS: 'fancybox-custom',
        closeClick: true,

        openEffect: 'none',

        helpers: {
            title: {
                type: 'inside'
            },
            overlay: {
                css: {
                    'background': 'rgba(238,238,238,0.85)'
                }
            }
        }
    });

    // Remove padding, set opening and closing animations, close if clicked and disable overlay
    $(".fancybox-effects-d").fancybox({
        padding: 0,

        openEffect: 'elastic',
        openSpeed: 150,

        closeEffect: 'elastic',
        closeSpeed: 150,

        closeClick: true,

        helpers: {
            overlay: null
        }
    });

    /*
     *  Button helper. Disable animations, hide close button, change title type and content
     */

    $('.fancybox-buttons').fancybox({
        openEffect: 'none',
        closeEffect: 'none',

        prevEffect: 'none',
        nextEffect: 'none',

        closeBtn: false,

        helpers: {
            title: {
                type: 'inside'
            },
            buttons: {}
        },

        afterLoad: function () {
            this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
        }
    });


    /*
     *  Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
     */

    $('.fancybox-thumbs').fancybox({
        prevEffect: 'none',
        nextEffect: 'none',

        closeBtn: false,
        arrows: false,
        nextClick: true,

        helpers: {
            thumbs: {
                width: 50,
                height: 50
            }
        }
    });

    /*
     *  Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
     */
    $('.fancybox-media')
        .attr('rel', 'media-gallery')
        .fancybox({
        openEffect: 'none',
        closeEffect: 'none',
        prevEffect: 'none',
        nextEffect: 'none',

        arrows: false,
        helpers: {
            media: {},
            buttons: {}
        }
    });

    /*
     *  Open manually
     */

    $("#fancybox-manual-a").click(function () {
        $.fancybox.open('1_b.jpg');
    });

    $("#fancybox-manual-b").click(function () {
        $.fancybox.open({
            href: 'iframe.html',
            type: 'iframe',
            padding: 5
        });
    });

    $("#fancybox-manual-c").click(function () {
        $.fancybox.open([{
            href: '1_b.jpg',
            title: 'My title'
        }, {
            href: '2_b.jpg',
            title: '2nd title'
        }, {
            href: '3_b.jpg'
        }], {
            helpers: {
                thumbs: {
                    width: 75,
                    height: 50
                }
            }
        });
    });
    /* End of Fancybox 8/
/* File input */
    VIGET.fileInputs = function () {
        var $this = $(this),
            $val = $this.val(),
            valArray = $val.split('\\'),
            newVal = valArray[valArray.length - 1],
            $button = $this.siblings('.button'),
            $fakeFile = $this.siblings('.file-holder');
        if (newVal !== '') {
            $button.text('Photo Chosen');
            if ($fakeFile.length === 0) {
                $button.after('' + newVal + '');
            } else {
                $fakeFile.text(newVal);
            }
        }
    };

    $(function () {
        $('.file-wrapper input[type=file]')
            .bind('change focus click', VIGET.fileInputs);
    });
});
/* End of file input */
///////////////////////////////////////////////////////////////////////////////////////////////////////

Open in new window

garethtnashAuthor Commented:
Thanks Tom,

Sorry, have tried updating my code, but still nothing is firing...

<script>
//This script is the script that returns XML locations //
$(document).ready(function() {
function() {
$("#loc").autocomplete({
source: function(request, response){
$.ajax({
url:"/scripts/locations.asp",
dataType:"xml",
data: {"term":request.term},
success: function(data){
var items = [];
$("item", data).each(function(i,v) {
var item = { location: $("location",v).text(), region: $("region",v).text(), label:$("label",v).text() };
items.push(item);
})
response(items);
}
});
},
//			minLength: 2,
select: function( event, ui ) {
$("#location").val(ui.item.location);
$("#region").val(ui.item.region);
$("#loc").val(ui.item.label);
}
});
}
// End this script is the script that returns XML locations //	

// Profile Page Only //

// this script hides profile boxes //	
function() {
	$('#Personal_Statement').hide();
	$('#Skills_Expertise').hide();
	$('#Work_History').hide();
	$('#QualificationSelect').hide();
	$('#GCSE').hide();
	$('#Alevel').hide();
	$('#Degree').hide();
	$('#Masters').hide();
	$('#phd').hide();
	$('#other').hide();
	$('#Covering_Letter').hide();
	$('#CVs').hide();
	$('#Availability').hide();
	$('#Edit_Personal_Statement').hide();
	$('#Edit_Work_History').hide();
	$('#Edit_Qualifications').hide();
	$('#Edit_Covering_Letter').hide();
}
// End this script hides profile boxes //

// this script shows personal statement//	

function(){
        $("#AddProfile a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Availability').hide();
            $('#Personal_Statement').show();
        });

    }

// End this script shows personal statement//	

// this script shows availability//	

function(){
        $("#AvailabilityDetail a.editlinks").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').show();
        });

    }
function(){
        $("#AvailabilityDetail a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').show();
        });

    }

// End this script shows availability//	


// this script shows Skills_Expertise //	

function(){
        $("#AddSkills a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').hide();
            $('#Skills_Expertise').show();
        });

    }
$(function(){
        $("#AddSkills a.editlinks").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
			$('#Availability').hide();
            $('#Skills_Expertise').show();
        });

    });

// End this script shows Skills_Expertise//	


// this script shows Work_History//	

function(){
        $("#AddWorkHistory a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
			$('#Availability').hide();
            $('#Work_History').show();
        });

    }

// End this script shows Work_History//	


// this script shows QualificationSelect/	

function(){
        $("#AddQualificationSelect a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
			$('#Availability').hide();
            $('#QualificationSelect').show();
        });

    }

// End this script shows QualificationSelect//	


// this script shows Covering_Letter//	

function(){
        $("#AddCoveringLette a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#CVs').hide();
			$('#Availability').hide();
            $('#Covering_Letter').show();
        });

    }

// End this script shows Covering_Letter//	


// this script shows CVs//	

function(){
        $("#AddCV a.add").click(function () {
			$('#Edit_Personal_Statement').hide();
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
			$('#Availability').hide();
            $('#CVs').show();
        });

    }

// End this script shows CVs//	

// xxxxx //

function(){
        $("#AddProfile a.editlinks").click(function () {
       		$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Availability').hide();
			$('#Edit_Personal_Statement').show();
        });

    }
// xxxxxxxxx //

// Edit covering letter //
function(){
        $("#AddCoveringLette a.editlinks").click(function () {
			$('#Edit_Work_History').hide();
			$('#Edit_Qualifications').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Edit_Personal_Statement').hide();
			$('#Availability').hide();
			$('#Edit_Covering_Letter').show();
        });

    }

// End Edit covering letter //

//Edit work history //

function(){
        $("#AddWorkHistory a.editlinks").click(function () {
	   		$('#Edit_Job_Title').val($(this).data('jobtitle'));
	   		$('#Edit_Company').val($(this).data('company'));
	   		$('#Edit_start_date').val($(this).data('startdate'));
	   		$('#Edit_end_date').val($(this).data('enddate'));
	   		$('#Edit_job_description').val($(this).data('description'));

			tinymce.init({
        selector: "textarea",
        toolbar1: "paste | bold italic underline  | alignleft aligncenter alignright alignjustify | bullist numlist | ",

        menubar: false,
        toolbar_items_size: 'small',
    	paste_as_text: true,
		browser_spellcheck : true,
		statusbar : false,
		height : 400,

        style_formats: [
                {title: 'Bold text', inline: 'b'},
        ],

});
			$('#Edit_Qualifications').hide();
			$('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
			$('#Edit_Personal_Statement').hide();
            $('#Work_History').hide();
			$('#Availability').hide();
       		$('#Edit_Work_History').show();
        });

    }
	
// End Edit work history //

// Qualification Select //
function () {
  $("#QualificationType").change(function() {
         $("#GCSE").hide();
         $("#Alevel").hide();
         $("#Degree").hide();
         $("#Masters").hide();
         $("#phd").hide();
         $("#other").hide();
    var val = $(this).val();
    if(val === "GCSE") {
        $("#GCSE").show();
    }
    if(val === "ALevel") {
        $("#Alevel").show();
    }
    if(val === "Degree") {
        $("#Degree").show();
    }
    if(val === "Masters") {
        $("#Masters").show();
    }
    if(val === "PHD") {
        $("#phd").show();
    }
    else if(val === "Other") {
        $("#other").show();
    }
  });
}

// End of Qualification Select //

// End Profile Page Only  //	


//This script is the Twitter script //
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');// End this script is the Twitter script //
//This script is the Facebook script //
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
//End this script is the Facebook script //
//This script is the Google + script //
window.___gcfg = {lang: 'en-GB'};

(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
//End this script is the Google + script //
//This script is the Sticky script //
$(document).ready(function() {
// grab the initial top offset of the navigation 
var stickyNavTop = $('.nav').offset().top;
// our function that decides weather the navigation bar should have "fixed" css position or not.
var stickyNav = function(){
var scrollTop = $(window).scrollTop(); // our current vertical position from the top

// if we've scrolled more than the navigation, change its position to fixed to stick to top,
// otherwise change it back to relative
if (scrollTop > stickyNavTop) { 
$('.nav').addClass('sticky');
} else {
$('.nav').removeClass('sticky'); 
}
};
stickyNav();
// and run it again every time you scroll
$(window).scroll(function() {
stickyNav();
});
});
//End this script is the Sticky script //
//This script is the navigation expansion script //
function doSomething(elem) {
$(elem).parents("ul").children("li").show();
$(elem).parent("li").hide();
}
//End this script is the navigation expansion script //

//Date Picker //
function() {
$( ".datepicker" ).datepicker({
showOtherMonths: true,
selectOtherMonths: true
});
}
// End date picker //
 /* Enable submitbutton */
function(){
$("input[type=submit]").removeAttr('disabled');
}
/* End Enable submitbutton */

///////////////////////////////////////////////////////////////////////////////////////////////////////

/*
*  Simple image gallery. Uses default settings
*/

$('.fancybox').fancybox({
openEffect : 'none',
helpers : {
title : null            
}           
});

/*
*  Different effects
*/

// Change title type, overlay closing speed
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});

// Disable opening and closing animations, change title type
$(".fancybox-effects-b").fancybox({
openEffect  : 'none',
closeEffect	: 'none',

helpers : {
title : {
type : 'over'
}
}
});

// Set custom style, close if clicked, change title type and overlay color
$(".fancybox-effects-c").fancybox({
wrapCSS    : 'fancybox-custom',
closeClick : true,

openEffect : 'none',

helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(238,238,238,0.85)'
}
}
}
});

// Remove padding, set opening and closing animations, close if clicked and disable overlay
$(".fancybox-effects-d").fancybox({
padding: 0,

openEffect : 'elastic',
openSpeed  : 150,

closeEffect : 'elastic',
closeSpeed  : 150,

closeClick : true,

helpers : {
overlay : null
}
});

/*
*  Button helper. Disable animations, hide close button, change title type and content
*/

$('.fancybox-buttons').fancybox({
openEffect  : 'none',
closeEffect : 'none',

prevEffect : 'none',
nextEffect : 'none',

closeBtn  : false,

helpers : {
title : {
type : 'inside'
},
buttons	: {}
},

afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});


/*
*  Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/

$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',

closeBtn  : false,
arrows    : false,
nextClick : true,

helpers : {
thumbs : {
width  : 50,
height : 50
}
}
});

/*
*  Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
*/
$('.fancybox-media')
.attr('rel', 'media-gallery')
.fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',

arrows : false,
helpers : {
media : {},
buttons : {}
}
});

/*
*  Open manually
*/

$("#fancybox-manual-a").click(function() {
$.fancybox.open('1_b.jpg');
});

$("#fancybox-manual-b").click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 5
});
});

$("#fancybox-manual-c").click(function() {
$.fancybox.open([
{
href : '1_b.jpg',
title : 'My title'
}, {
href : '2_b.jpg',
title : '2nd title'
}, {
href : '3_b.jpg'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});
/* End of Fancybox 8/
/* File input */
VIGET.fileInputs = function() {
  var $this = $(this),
      $val = $this.val(),
      valArray = $val.split('\\'),
      newVal = valArray[valArray.length-1],
      $button = $this.siblings('.button'),
      $fakeFile = $this.siblings('.file-holder');
  if(newVal !== '') {
    $button.text('Photo Chosen');
    if($fakeFile.length === 0) {
      $button.after('' + newVal + '');
    } else {
      $fakeFile.text(newVal);
    }
  }
};
 
function() {
  $('.file-wrapper input[type=file]')
  .bind('change focus click', VIGET.fileInputs);
}
});
/* End of file input */
///////////////////////////////////////////////////////////////////////////////////////////////////////
</script>

Open in new window


I'm guessing i have a random '}):' in there somewhere...

Console gives me -

SyntaxError: Function statements must have a name.
      (anonymous function) (default.asp, line 536)

line 536 being;

function() {
$("#loc").autocomplete({
source: function(request, response){
$.ajax({
url:"/scripts/locations.asp",
garethtnashAuthor Commented:
Hi Tom,

thanks for your feedback, I've tidied up most of the code, which is below; Now everything works, except the last three sections;

navigation expansion script
File input
File input  Function

The last two I got from http://viget.com/inspire/custom-file-inputs-with-a-bit-of-jquery

Here is my code now;

$(document).ready(function () {
//This script is the script that returns XML locations //

   /* JBE Emailform submit */ 
        $("#EmailAlertsForm, #EmailAlertsFormRegistered").submit(function () {
            var email = $("#JBEemail").val();
            var UserID = $("#JBEUserID").val();
            var Validated = $("#JBEValidated").val();
            var Sector = $("#JBESector").val();
            var Region = $("#JBERegion").val();
            var Location = $("#JBELocation").val();
            var datastring = $("#EmailAlertsForm, #EmailAlertsFormRegistered").serialize();

            if(email=='' || UserID=='') {
                $('.error').fadeOut(200).show();
            }
            else {
                //$.ajax({
                //    type: "POST",
                //    url: "/actions/jbe.asp",
                //    data: dataString,
                //    success: function () {
                        $('.EmailAlertsForm').fadeOut(200).hide();
                        $('#EmailAlertsFormSuccess').fadeIn('slow');
					if(UserID=='') {
	                        $('#EmailAlertsFormSuccess').html('<span>xxxxxx</span><br /><p>We have added Sector jobs in Location, Region to your alerts</p><div class="clearfix"></div>');
					}
					else{
	                        $('#EmailAlertsFormSuccess').html('<span>Job Done !</span><p>We\'ll send you daily alerts about the latest ' + Sector + 'jobs in ' + Region +', ' + Location +' but before we do, please click the link on the email we have sent you to validate this email alert</p><div class="clearfix"></div>');
					}
                //    }
                //});
            }
            return false;
        });
/* End JBE Emailform submit */ 

   
    // End this script is the script that returns XML locations //	
   
        $("#loc").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/scripts/locations.asp",
                    dataType: "xml",
                    data: {
                        "term": request.term
                    },
                    success: function (data) {
                        var items = [];
                        $("item", data).each(function (i, v) {
                            var item = {
                                location: $("location", v).text(),
                                region: $("region", v).text(),
                                label: $("label", v).text()
                            };
                            items.push(item);
                        })
                        response(items);
                    }
                });
            },
            //			minLength: 2,
            select: function (event, ui) {
                $("#location").val(ui.item.location);
                $("#region").val(ui.item.region);
                $("#loc").val(ui.item.label);
            }
		});
    // End this script is the script that returns XML locations //	

    //Date Picker //
        $(".datepicker").datepicker({
            showOtherMonths: true,
            selectOtherMonths: true
        });
    // End date picker //
    /* Enable submitbutton */
        $("input[type=submit]").removeAttr('disabled');
    /* End Enable submitbutton */



    // Profile Page Only //

    // this script hides profile boxes //
        $('#Personal_Statement').hide();
        $('#Skills_Expertise').hide();
        $('#Work_History').hide();
        $('#QualificationSelect').hide();
        $('#GCSE').hide();
        $('#Alevel').hide();
        $('#Degree').hide();
        $('#Masters').hide();
        $('#phd').hide();
        $('#other').hide();
        $('#Covering_Letter').hide();
        $('#CVs').hide();
        $('#Availability').hide();
        $('#Edit_Personal_Statement').hide();
        $('#Edit_Work_History').hide();
        $('#Edit_Qualifications').hide();
        $('#Edit_Covering_Letter').hide();
    // End this script hides profile boxes //

    // this script shows personal statement//
        $("#AddProfile a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Availability').hide();
            $('#Personal_Statement').show();
        });
    // End this script shows personal statement//	

    // this script shows availability//	
        $("#AvailabilityDetail a.editlinks").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Availability').show();
        });
        $("#AvailabilityDetail a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Availability').show();
        });

    // End this script shows availability//	


    // this script shows Skills_Expertise //
        $("#AddSkills a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Availability').hide();
            $('#Skills_Expertise').show();
        });
        $("#AddSkills a.editlinks").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Availability').hide();
            $('#Skills_Expertise').show();
        });

    // End this script shows Skills_Expertise//	


    // this script shows Work_History//	
        $("#AddWorkHistory a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Availability').hide();
            $('#Work_History').show();
        });

    // End this script shows Work_History//	


    // this script shows QualificationSelect/
        $("#AddQualificationSelect a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#Availability').hide();
            $('#QualificationSelect').show();
        });

    // End this script shows QualificationSelect//	


    // this script shows Covering_Letter//	
        $("#AddCoveringLette a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#CVs').hide();
            $('#Availability').hide();
            $('#Covering_Letter').show();
        });


    // End this script shows Covering_Letter//	


    // this script shows CVs//	
        $("#AddCV a.add").click(function () {
            $('#Edit_Personal_Statement').hide();
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#Availability').hide();
            $('#CVs').show();
        });

    // End this script shows CVs//	

    // xxxxx //
        $("#AddProfile a.editlinks").click(function () {
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Availability').hide();
            $('#Edit_Personal_Statement').show();
        });
    // xxxxxxxxx //

    // Edit covering letter //
        $("#AddCoveringLette a.editlinks").click(function () {
            $('#Edit_Work_History').hide();
            $('#Edit_Qualifications').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#Work_History').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Edit_Personal_Statement').hide();
            $('#Availability').hide();
            $('#Edit_Covering_Letter').show();
        });
    // End Edit covering letter //

    //Edit work history //
        $("#AddWorkHistory a.editlinks").click(function () {
            $('#Edit_Job_Title').val($(this).data('jobtitle'));
            $('#Edit_Company').val($(this).data('company'));
            $('#Edit_start_date').val($(this).data('startdate'));
            $('#Edit_end_date').val($(this).data('enddate'));
            $('#Edit_job_description').val($(this).data('description'));

            tinymce.init({
                selector: "textarea",
                toolbar1: "paste | bold italic underline  | alignleft aligncenter alignright alignjustify | bullist numlist | ",

                menubar: false,
                toolbar_items_size: 'small',
                paste_as_text: true,
                browser_spellcheck: true,
                statusbar: false,
                height: 400,

                style_formats: [{
                    title: 'Bold text',
                    inline: 'b'
                }, ],

            });
            $('#Edit_Qualifications').hide();
            $('#Edit_Covering_Letter').hide();
            $('#Personal_Statement').hide();
            $('#Skills_Expertise').hide();
            $('#QualificationSelect').hide();
            $('#GCSE').hide();
            $('#Alevel').hide();
            $('#Degree').hide();
            $('#Masters').hide();
            $('#phd').hide();
            $('#other').hide();
            $('#Covering_Letter').hide();
            $('#CVs').hide();
            $('#Edit_Personal_Statement').hide();
            $('#Work_History').hide();
            $('#Availability').hide();
            $('#Edit_Work_History').show();
        });

    // End Edit work history //

    // Qualification Select //
        $("#QualificationType").change(function () {
            $("#GCSE").hide();
            $("#Alevel").hide();
            $("#Degree").hide();
            $("#Masters").hide();
            $("#phd").hide();
            $("#other").hide();
            var val = $(this).val();
            if (val === "GCSE") {
                $("#GCSE").show();
            }
            if (val === "ALevel") {
                $("#Alevel").show();
            }
            if (val === "Degree") {
                $("#Degree").show();
            }
            if (val === "Masters") {
                $("#Masters").show();
            }
            if (val === "PHD") {
                $("#phd").show();
            } else if (val === "Other") {
                $("#other").show();
            }
        });

    // End of Qualification Select //

    // End Profile Page Only  //	


        // grab the initial top offset of the navigation 
        var stickyNavTop = $('.nav').offset().top;
        // our function that decides weather the navigation bar should have "fixed" css position or not.
        var stickyNav = function () {
            var scrollTop = $(window).scrollTop(); // our current vertical position from the top

            // if we've scrolled more than the navigation, change its position to fixed to stick to top,
            // otherwise change it back to relative
            if (scrollTop > stickyNavTop) {
                $('.nav').addClass('sticky');
            } else {
                $('.nav').removeClass('sticky');
            }
        };
        stickyNav();
        // and run it again every time you scroll
        $(window).scroll(function () {
            stickyNav();
        });
    //End this script is the Sticky script //

	
	    //This script is the Twitter script //
    ! function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0],
            p = /^http:/.test(d.location) ? 'http' : 'https';
        if (!d.getElementById(id)) {
            js = d.createElement(s);
            js.id = id;
            js.src = p + '://platform.twitter.com/widgets.js';
            fjs.parentNode.insertBefore(js, fjs);
        }
    }(document, 'script', 'twitter-wjs'); // End this script is the Twitter script //
    //This script is the Facebook script //
    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s);
        js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    //End this script is the Facebook script //
    //This script is the Google + script //
    window.___gcfg = {
        lang: 'en-GB'
    };

    (function () {
        var po = document.createElement('script');
        po.type = 'text/javascript';
        po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(po, s);
    })();
    //End this script is the Google + script //
    //This script is the Sticky script //
    
//This script is the navigation expansion script //
(function doSomething(elem) {
$(elem).parents("ul").children("li").show();
$(elem).parent("li").hide();
});
//End this script is the navigation expansion script //
/* File input */
VIGET.fileInputs = function() {
  var $this = $(this),
      $val = $this.val(),
      valArray = $val.split('\\'),
      newVal = valArray[valArray.length-1],
      $button = $this.siblings('.button'),
      $fakeFile = $this.siblings('.file-holder');
  if(newVal !== '') {
    $button.text('Photo Chosen');
    if($fakeFile.length === 0) {
      $button.after('' + newVal + '');
    } else {
      $fakeFile.text(newVal);
    }
  }
};
 
(function() {
  $('.file-wrapper input[type=file]')
  .bind('change focus click', VIGET.fileInputs);
});
/* End of file input */

});

Open in new window


Any ideas why these are not working?

Thanks
Tom BeckCommented:
I don't see any need for the IIFEs. There's no variables inside that need to be isolated.
//This script is the navigation expansion script //
function doSomething(elem) {
  $(elem).parents("ul").children("li").show();
  $(elem).parent("li").hide();
}
//End this script is the navigation expansion script //
/* File input */
VIGET.fileInputs = function() {
  var $this = $(this),
      $val = $this.val(),
      valArray = $val.split('\\'),
      newVal = valArray[valArray.length-1],
      $button = $this.siblings('.button'),
      $fakeFile = $this.siblings('.file-holder');
  if(newVal !== '') {
    $button.text('Photo Chosen');
    if($fakeFile.length === 0) {
      $button.after('' + newVal + '');
    } else {
      $fakeFile.text(newVal);
    }
  }
};
 
  $('.file-wrapper input[type=file]').bind('change focus click', VIGET.fileInputs);
/* End of file input */

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
garethtnashAuthor Commented:
Excellent thank you Tom
Tom BeckCommented:
You're welcome. Thanks for the points.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.