function writeText (form) {
	var fields = [ "address1" , "address2" , "town" , "county" , "postcode" , "country" ];
	for(var i = 0 ; i<fields.length ; i++){
		$('#delivery_'+fields[i]+"_form").val($('#card_'+fields[i]+'_form').val());
	}
}

function clearText (form) {
	var fields = [ "address1" , "address2" , "town" , "county" , "postcode" , "country" ];
	for(var i = 0 ; i<fields.length ; i++){
		$('#delivery_'+fields[i]+"_form").val("");
	}
}
function copyInvoiceAddress (form,id) {
	form = $('#form'+id);
//alert('form'+form);
	var dAone = 'customer_model-'+id+'-delivery_address1';
	var cAone = 'customer_model-'+id+'-card_address1';
        form.dAone.value = form.cAone.value;
//        form.delivery_address2.value = form.card_address2.value;
//        form.delivery_town.value = form.card_town.value;
//        form.delivery_county.value = form.card_county.value;
//        form.delivery_postcode.value = form.card_postcode.value;
//        form.delivery_country.value = form.card_country.value;
}

function showPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('placeholder').src = whichpic.title;
  if (whichpic.title) {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
  } else {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
  }
  return false;
 } else {
  return true;
 }
}
$(function(){
	$('.accordion-toggle').addClass('havehover');
	$('.accordion-leaf').addClass('havehover');
	$('.accordion-item').addClass('havehover');
	$('.havehover').hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')});
});
