$(document).ready(function() {
	// Add heading to sidebar link list
	$('#tertiary-links .inner-box').prepend('<h3>Quick Links</h3>');

	// ALternating Rows
	var list = $('table.nc tbody tr');
	for(var i = 0;i < list.length;i++){
		if(i % 2 == 1){
		$(list[i]).addClass('Alt');
		}
	}
	
	/* Move the price to the top of the page on product view */
	$('body.product .main-wrap').prepend($('body.product .price-box'));

	/* Add a class of 'Button' to all submit buttons so they work in IE6 */
	$('input[type="submit"]').addClass('Button');

	/* On product list replace the 'Add to Enquiry' button with 'Full Details' */
	$('#product-list .options form.enquiry').each(
		function(){
		
			// Change action url
			var newAction = $(this).closest('li').find('a').first().attr('href');
			$(this).get(0).setAttribute('action', newAction); //this works
		
			// Change method
			$(this).attr('method','get');
			
			// Remove hidden fields
			$(this).find('input[type=hidden]').remove()
			
			// Change button text
			$(this).find('input[type=submit]').first().val('Full Details');
			
			// Change button action for bloody ie6
			$(this).submit(function(){
				window.location = newAction;
				return false;
			});
			
		}
	);

	/* Add Catalogue Request Button */
	$('#secondary .content').append('<a href="/request.html" class="CatalogueRequest SidebarButton"><span>Catalogue Request</span></a>');

	/* Add Banner at the top of left hand column */
	$('#secondary').prepend('<a href="http://www.logopens.co.uk/b-loony/" target="_blank" class="SideBanner"><img src="/static/Image/PensClickBanner.gif" alt="--"/></a>');

/*MANDATORY FIELDS*/
catalogForm = $("body#www-marketingproductsdirect-com.page.catalogue-request #primary form");
  if (catalogForm.length){
      catalogForm.submit(function(){
          if ($.trim($("#primary input#formfield-first_name").val()) == '' ){
              alert('Please enter your First Name');
              return false;
          }
          if ($.trim($("#primary input#formfield-surname").val()) == '' ){
              alert('Please enter your Surname');
              return false;
          }
          if ($.trim($("#primary input#formfield-phone").val()) == '' ){
              alert('Please enter your Phone Number');
              return false;
          }
          if ($.trim($("#primary input#formfield-email").val()) == '' ){
              alert('Please enter your Email Address');
              return false;
          }
          if ($.trim($("#primary input#formfield-company").val()) == '' ){
              alert('Please enter your Company');
              return false;
          }
          if ($.trim($("#primary input#formfield-address1").val()) == '' ){
              alert('Please enter Address 1');
              return false;
          }
          if ($.trim($("#primary input#formfield-address2").val()) == '' ){
              alert('Please enter Address 2');
              return false;
          }
          if ($.trim($("#primary input#formfield-postcode").val()) == '' ){
              alert('Please enter your Post Code');
              return false;
          }
      });
}

enquiryForm = $("body#www-marketingproductsdirect-com.page.enquiry-basket #primary form.datamate");
  if (enquiryForm.length){
      enquiryForm.submit(function(){
          if ($.trim($("#primary input#first_name").val()) == '' ){
              alert('Please enter your First Name');
              return false;
          }
          if ($.trim($("#primary input#surname").val()) == '' ){
              alert('Please enter your Surname');
              return false;
          }
          if ($.trim($("#primary input#phone").val()) == '' ){
              alert('Please enter your Phone Number');
              return false;
          }
          if ($.trim($("#primary input#email").val()) == '' ){
              alert('Please enter your Email Address');
              return false;
          }
          if ($.trim($("#primary input#company").val()) == '' ){
              alert('Please enter your Company');
              return false;
          }
          if ($.trim($("#primary input#address1").val()) == '' ){
              alert('Please enter Address 1');
              return false;
          }
          if ($.trim($("#primary input#address2").val()) == '' ){
              alert('Please enter Address 2');
              return false;
          }
          if ($.trim($("#primary input#postcode").val()) == '' ){
              alert('Please enter your Post Code');
              return false;
          }
      });
}

});// JavaScript Document
