$.noConflict();
jQuery(document).ready(function() {
  jQuery('#container').find('a.window_link').click(function() {
  	window.open(this.href);
  	return false;
  });

  jQuery('#container').find('a.confirm_link').click(function() {
  	return confirm('Are you sure you wish to proceed?');
  });
  
  jQuery("input.remove_default").bind('click', function(e) {
  	jQuery(this).val('');
  });
  
  /*$("#product_list").accordion();*/

	var current_price = jQuery('#main-price').text();
	var current_price_nosign = current_price.replace(/[^0-9.]/g, '');
	var newPrice;
	
	if (current_price != '') {
	  jQuery('select.validate-selection').bind('change', function(e) {
	  	var field_ref = jQuery('select.validate-selection :selected').text();
	  	newPrice = field_ref.replace(/\s/g, "");
	  	remove_brack = newPrice.indexOf('(');
	  	if (remove_brack >= 0) {
	  		if (remove_brack == 0) remove_brack++;
	  		newPrice = newPrice.substr(remove_brack, 50);
	  		newPrice = newPrice.replace(/[^0-9.]/g, '');
	  	} else {
	  		newPrice = 0.00;
	  	}
	 		
	 		var reg = new RegExp('^[0-9]+[\.]?[0-9]+$');
	 		if (reg.test(newPrice)) {
	 			newPrice = parseFloat(newPrice);
	 			current_price_nosign = parseFloat(current_price_nosign);
	 			jQuery('#main-price').empty();
	 			var main_amount = (newPrice+current_price_nosign);
	 			jQuery('#main-price').html('&pound;'+main_amount.toFixed(2));
	 		} else {
	 			jQuery('#main-price').empty();
	 			jQuery('#main-price').html('&pound;'+current_price_nosign.toFixed(2));
	 		}
	  });
	}
});
