// JavaScript Document



//window.addEvent('load', Site.start);

//頁面AJAX傳遞
function page(url,id){
	new Ajax(url, {
		method: 'get',
		evalScripts: 'true',
		update: $(id)
	}).request();
}

//表單AJAX傳送
function sendform(form, id){
$(form).send({
evalScripts: 'true',
update: $(id)
});
}

//增加數量
function Pamount(amount){
$(amount).value = parseFloat($(amount).value) + 1 ;
}

function Namount(amount){
if($(amount).value>1){
$(amount).value = parseFloat($(amount).value) - 1 ;
}
}

//存入購物車
function search_exhibition(){
if($('sdate').value==''){
	alert('開始區間未填寫');
	return false;
}
if($('edate').value==''){
	alert('結束區間未填寫');
	return false;
}
$('search_exhibition').submit();
}



//存入購物車
function buycar(form, id){
$(form).send({
evalScripts: 'true',
update: $(id),
onComplete: function() {
				alert('已加入購物車');
		}
});
}

//立即購買
function shoping(form, url, id){
$(form).send({
evalScripts: 'true',
update: $(id),
onComplete: function() {
				page(url, id);
		}
});
}

//POST傳值
function post(url, val, id){
	new Ajax(url, {
		method: 'post',
		postBody:val,
		evalScripts: 'true',
		update: $(id)
	}).request();
}


//同付款人
function copydata(){
$('sname').value = $('name').value;
$('stel').value = $('tel').value;
$('smobile').value = $('mobile').value;
$('spost').value = $('post').value;
$('saddress').value = $('address').value;
}

function copyname(){
if($('cp').checked==true){	
$('pname').value = $('name').value;
}
}

function copycads(){
if($('cpads').checked==true){	
$('pads').value = $('cads').value;
}
}
