// $(document).ready(function() {
// 	$('select[name="limit"]').change(function() {
// 		var limit = $(this).val();
// 		var rangeTwo = $('input[name="range"]').val();
// 		document.location='code-browse/'+rangeTwo+'/'+limit+'.html';
// 	});
	
// 	$('#password-clear').focus(function() {
// 		$('#password-clear').hide();
// 		$('#password').show();
// 	});
	
// 	$('#password').blur(function() {
// 		if ($('#password').val() == '') {
// 			$('#password-clear').show();
// 			$('#password').hide();
// 		}
// 	});
	
	
// 	$('input[name="loginButton"]').click(function(event) {
		
// 		$('#errors').hide();
// 		event.preventDefault();
// 		var username = $('input[name="username"]').val();
// 		var password = $('input[name="password"]').val();
		
// 		if(username=='username') { username='' };
// 		if(password=='password') { password='' };
		
// 		$.ajax({
// 			url: "user-login",
// 			type: "POST",
// 			dataType: "json",
// 			data: { username : username, password : password},
			
// 			beforeSend: function() {
// 			    //called when complete
// 			},
			
// 			success: function(data) {
// 			    if(data.error == true) {
// 					$('#errors').html(data.result).addClass('loginError').fadeIn('slow');
// 				} else {
// 					document.location=data.result+'.html';
// 				}
// 			}
// 		});
// 	});
	
// 	$('input[name="changePasswordBtn"]').click(function(event) {
		
// 		$('#pageErrors').hide();
// 		$('#pageSuccess').hide();
		
// 		$.ajax({
// 			url: "my-account/change-password.html",
// 			type: "POST",
// 			dataType: "json",
// 			data: $('#changePasswordForm').serialize(),
			
// 			beforeSend: function() {
// 			    //called when complete
// 			},
			
// 			success: function(data) {
// 			    if(data.error == true) {
// 					$('#pageErrors').html(data.result).fadeIn('slow');
// 				} else {
// 					$('#pageSuccess').html(data.result).fadeIn('slow');
// 					$( "#changePasswordForm" )[ 0 ].reset();
// 				}
// 			}
// 		});
// 	});
	
// 	$('.userRemoveCode').click(function(event) {
// 		var shortCode = $(this).attr('rel');
// 		$('#shortCodeToRemove').text(shortCode);
// 		$('#userRemoveCodeDialog').dialog('open');
// 	});
	
// 	$('.userCannotRemoveCode').click(function(event) {
// 		var shortCode = $(this).attr('rel');
		
// 		$('#userCannotRemoveCodeDialog').dialog('open');
// 	});
	
	
//     $("#userRemoveCodeDialog").dialog({
// 		bgiframe: true, 
// 		autoOpen: false,
// 		width:500,
// 		modal: true,
// 		resizable:false,
// 		title: 'Remove code',
		
// 		buttons: {
// 			No: function() {
// 				$('#userRemoveCodeDialog').dialog('close');			
// 			},
// 			Yes: function() {
				
// 			}
// 		}
//     });

//     $("#userCannotRemoveCodeDialog").dialog({
// 		bgiframe: true, 
// 		autoOpen: false,
// 		width:500,
// 		modal: true,
// 		resizable:false,
// 		title: 'Remove code',
		
// 		buttons: {
// 			OK: function() {
// 				$('#userCannotRemoveCodeDialog').dialog('close');			
// 			}
// 		}
//     });


// 	$('.deleteInterest').click(function(event) {
// 		var shortCode = $(this).attr('rel');
// 		$('#shortCodeToRemove').text(shortCode);
// 		$('input[name="shortCodeToRemove"]').val(shortCode);
// 		$('#userRemoveInterestCode').dialog('open');
// 	});

// 	$("#userRemoveInterestCode").dialog({
// 		bgiframe: true, 
// 		autoOpen: false,
// 		width:500,
// 		modal: true,
// 		resizable:false,
// 		title: 'Remove code',
// 		buttons: {
			
// 			Yes: function() {
				
// 				var shortCode = $('input[name="shortCodeToRemove"]').val();
				
// 				$.ajax({
// 					url: "user/deleteInterest",
// 					type: "POST",
// 					dataType: "json",
// 					data: { shortCode : shortCode },
				
// 					success: function(data) {
// 						if(data.error==false)
// 						{
// 							$('#line'+shortCode).fadeOut('slow');
// 							$('#userRemoveInterestCode').dialog('close');
// 						}
// 					}
// 				});
		
// 			},			
// 			No: function() {
// 				$('#userRemoveInterestCode').dialog('close');			
// 			}
// 		}
// 	});

// 	$('input[name="registerBtn"]').click(function(event) {
		
// 		$('#pageErrors').hide();
// 		$('#pageSuccess').hide();
		
// 		var address1 = $('input[name="address1"]').val();
// 		var address2 = $('input[name="address2"]').val();
// 		var address3 = $('input[name="address3"]').val();
// 		var city = $('input[name="city"]').val();
// 		var county = $('input[name="county"]').val();
// 		var country = $('input[name="country"]').val();
// 		var postCode = $('input[name="postCode"]').val();
// 		var op_address1 = $('input[name="op_address1"]').val();
// 		var op_address2 = $('input[name="op_address2"]').val();
// 		var op_address3 = $('input[name="op_address3"]').val();
// 		var op_city = $('input[name="op_city"]').val();
// 		var op_county = $('input[name="op_county"]').val();
// 		var op_postCode = $('input[name="op_postCode"]').val();
// 		var op_country = $('input[name="op_country"]').val();
		
// 		if(address1=='Address line 1') { address1='' };
// 		if(address2=='Address line 2') { address2='' };
// 		if(address3=='Address line 3') { address3='' };
// 		if(city=='City') { city='' };
// 		if(county=='County') { county='' };
// 		if(postCode=='Post code') { postCode='' };
// 		if(country=='Country') { country='' };
// 		if(op_address1=='Address line 1') { op_address1='' };
// 		if(op_address2=='Address line 2') { op_address2='' };
// 		if(op_address3=='Address line 3') { op_address3='' };
// 		if(op_city=='City') { op_city='' };
// 		if(op_county=='County') { op_county='' };
// 		if(op_postCode=='Post code') { op_postCode='' };
// 		if(op_country=='Country') { op_country='' };
		
// 		$.ajax({
// 			url: "register.html",
// 			type: "POST",
// 			dataType: "json",
// 			data: {
// 				companyName : $('input[name="companyName"]').val(),
// 				address1 :address1,
// 				address2 : address2,
// 				address3 : address3,
// 				city : city,
// 				county : county,
// 				postCode : postCode,
// 				country : country,
// 				companyReg : $('input[name="companyReg"]').val(),
// 				op_address1 :op_address1,
// 				op_address2 : op_address2,
// 				op_address3 : op_address3,
// 				op_city : op_city,
// 				op_county : op_county,
// 				op_postCode : op_postCode,
// 				op_country : op_country,
// 				contactName : $('input[name="contactName"]').val(),
// 				contactPhone : $('input[name="contactPhone"]').val(),
// 				contactEmail : $('input[name="contactEmail"]').val(),
// 				ppplusRegNumber : $('input[name="ppplusRegNumber"]').val()
				
// 			},
			
// 			beforeSend: function() {
// 			    //called when complete
// 			},
			
// 			success: function(data) {
// 			    if(data.error == true) {
// 					$('#pageErrors').html(data.result).fadeIn('slow');
// 				} else {
// 					$('#pageSuccess').html(data.result).fadeIn('slow');
// 					$( 'form[name="registrationForm"]' )[ 0 ].reset();
// 				}
// 			}
// 		});		
// 	});

// 	$('input[name="userManageAccountBtn"]').click(function(event) {
		
// 		$('#pageErrors').hide();
// 		$('#pageSuccess').hide();
		
// 		var address1 = $('input[name="address1"]').val();
// 		var address2 = $('input[name="address2"]').val();
// 		var address3 = $('input[name="address3"]').val();
// 		var city = $('input[name="city"]').val();
// 		var county = $('input[name="county"]').val();
// 		var country = $('input[name="country"]').val();
// 		var postCode = $('input[name="postCode"]').val();
// 		var op_address1 = $('input[name="op_address1"]').val();
// 		var op_address2 = $('input[name="op_address2"]').val();
// 		var op_address3 = $('input[name="op_address3"]').val();
// 		var op_city = $('input[name="op_city"]').val();
// 		var op_county = $('input[name="op_county"]').val();
// 		var op_postCode = $('input[name="op_postCode"]').val();
// 		var op_country = $('input[name="op_country"]').val();
		
// 		if(address1=='Address line 1') { address1='' };
// 		if(address2=='Address line 2') { address2='' };
// 		if(address3=='Address line 3') { address3='' };
// 		if(city=='City') { city='' };
// 		if(county=='County') { county='' };
// 		if(postCode=='Post code') { postCode='' };
// 		if(country=='Country') { country='' };
// 		if(op_address1=='Address line 1') { op_address1='' };
// 		if(op_address2=='Address line 2') { op_address2='' };
// 		if(op_address3=='Address line 3') { op_address3='' };
// 		if(op_city=='City') { op_city='' };
// 		if(op_county=='County') { op_county='' };
// 		if(op_postCode=='Post code') { op_postCode='' };
// 		if(op_country=='Country') { op_country='' };
		
// 		$.ajax({
// 			url: "my-account/manage-account.html",
// 			type: "POST",
// 			dataType: "json",
// 			data: {
// 				companyName : $('input[name="companyName"]').val(),
// 				address1 :address1,
// 				address2 : address2,
// 				address3 : address3,
// 				city : city,
// 				county : county,
// 				postCode : postCode,
// 				country : country,
// 				companyReg : $('input[name="companyReg"]').val(),
// 				op_address1 :op_address1,
// 				op_address2 : op_address2,
// 				op_address3 : op_address3,
// 				op_city : op_city,
// 				op_county : op_county,
// 				op_postCode : op_postCode,
// 				op_country : op_country,
// 				contactName : $('input[name="contactName"]').val(),
// 				contactPhone : $('input[name="contactPhone"]').val(),
// 				contactEmail : $('input[name="contactEmail"]').val(),
// 				ppplusRegNumber : $('input[name="ppplusRegNumber"]').val()
				
// 			},
			
// 			beforeSend: function() {
// 			    //called when complete
// 			},
			
// 			success: function(data) {
// 			    if(data.error == true) {
// 					$('#pageErrors').html(data.result).fadeIn('slow');
// 				} else {
// 					$('#pageSuccess').html(data.result).fadeIn('slow');
// 				}
// 			}
// 		});		
// 	});
	
// 	$('input[name="reserveCodeBtn1"]').click(function() {
		
// 		$('#pageErrors').hide();
// 		$('#pageSuccess').hide();
		
// 		$.ajax({
// 			url: "my-account/reserve-code.html",
// 			type: "POST",
// 			dataType: "json",
// 			data: $('form[name="reserveCodeForm"]').serialize(),

// 			success: function(data) {
// 			    if(data.error == true) {
// 					$('#pageErrors').html(data.result).fadeIn('slow');
// 				} else {
// 					document.location='my-account/reserve-code-step2.html';
// 				}
// 			}
// 		});
		
// 	});
	
// 	$('input[name="userReserveCodeBtn2"]').click(function() {
		
// 		$('#pageErrors').hide();
// 		$('#pageSuccess').hide();
		
// 		$.ajax({
// 			url: "my-account/reserve-code-step2.html",
// 			type: "POST",
// 			dataType: "json",
// 			data: $('form[name="reserveCodeForm"]').serialize(),

// 			success: function(data) {
// 			    if(data.error == true) {
// 					$('#pageErrors').html(data.result).fadeIn('slow');
// 				} else {
// 					$('#pageSuccess').html(data.result).fadeIn('slow');
// 					$( 'form[name="reserveCodeForm"]' )[ 0 ].reset();
// 					document.location='my-account.html';
// 				}
// 			}
// 		});		
// 	});
	
// 	$('input[name="interestBtn"]').click(function() {
// 		$('#pageErrors').hide();
// 		$('#pageSuccess').hide();
// 		var previousStatus = $('input[name="interestBtn"]').val();
		
// 		$.ajax({
// 			url: "my-account/interest.html",
// 			type: "POST",
// 			dataType: "json",
// 			data: $('form[name="intrestCodeForm"]').serialize(),

// 			beforeSend: function() {
// 				$('input[name="interestBtn"]').val('Please wait...');
// 				$('input[name="interestBtn"]').attr('disable',true);
// 			},

// 			success: function(data) {
// 				$('input[name="interestBtn"]').val(previousStatus);
// 				$('input[name="interestBtn"]').attr('disable',false);
				
// 			    if(data.error == true) {
// 					$('#pageErrors').html(data.result).fadeIn('slow');
// 				} else {
// 					$('#pageSuccess').html(data.result).fadeIn('slow');
// 					document.location='my-account/display-interest.html';
// 				}
// 			}
// 		});		
// 	});
		
// });

