if (top.frames.length!=0) {
    if (window.location.href.replace)
        top.location.replace(self.location.href);
    else
        top.location.href=self.document.href;
}

function ConfirmChoice(url,msg) { 
	answer = confirm(msg)
	
	if (answer !=0) { 
		location = url 
	} 
}


function checkChange() {
	if(document.getElementById('ActionButtonChange')) {

	} else {
		document.form.submit()
	}
}

function movein(which,html){
	document.getElementById(which).innerHTML=html
}
	
function moveout(which,html){
	document.getElementById(which).innerHTML=html
}

function imgin(which,value){
	document.getElementById(which).src=value
}

function init () {
	$('submit').onclick = function () {
		sendData();
	}
}
function sendData () {
	var url = '../store/process.php';
	var pars = Form.serialize('frm');
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse} );
}
function showLoad () {
	$('load').innerHTML = 'Checking...';
}
function showResponse (originalRequest) {
	var newData = originalRequest.responseText;
	$('load').innerHTML = '&nbsp;';
	$('status').innerHTML = newData + '&nbsp;';
}

/**********************************************************/
function checkAccessory(acc) {
	if ($('#' + acc).attr('checked') == false) {
		$('#' + acc).attr('checked', 'checked');
	} else {
		$('#' + acc).attr('checked', '');
	}
}

function findBillAddress() {
	var postcode = $('.b_postcode').val();

	$.get(
		'/postcode.php',
		{pc: postcode},
		function (data) {
			if (data !== '0') {
				var d = jQuery.parseJSON(data);
				
				$('.b_address1').val(d.StreetAddress);
				$('.b_county').val(d.Place);
				
			}
		}
	);
}

function findShipAddress() {
	var postcode = $('.s_postcode').val();

	$.get(
		'/postcode.php',
		{pc: postcode},
		function (data) {
			if (data !== '0') {
				var d = jQuery.parseJSON(data);
				
				$('.s_address1').val(d.StreetAddress);
				$('.s_county').val(d.Place);
			}
		}
	);
}













