/*************************************************
**		ajax function
**		jquery1.3.2 ---  alei 2009/6/28
**************************************************/

$.post('/ajax.php',{admin:'web_log'},null,'script');

function jumpurl(url,page){
	if(page == 1){
		window.location='/' + url + '.html';
	}else{
		window.location='/' + url + '-' + page + '.html';
	}
}
function Cart_info(){
	$.ajax({
		type	: 'POST',
		url		: '/ajax.php',
		data	: 'admin=cartinfo',
		dataType: 'script'
	});
}
function Addcart(pid, type){
	var num;
	if(type==1){
		num = $('#pnum_' + pid).val();
	}else{
		num = $('#fnum_' + pid).val();
	}
	//alert(type);
	$.ajax({
		type	: 'POST',
		url		: '/ajax.php',
		data	: 'admin=addcart&pid=' + pid + '&type=' + type + '&num=' + num,
		success	: function(data){
					if(data == 'no stock'){
						alert('Sorry, No Stock!');	
					}else{
						if(data == 'succ'){
							$("#img_" + pid).attr('src', '/images/add_not_.gif');
							$("#img_" + pid).removeAttr('onclick');
						}else{
							$("#img" + pid).attr('src', '/images/add_not.gif');
							$("#img" + pid).removeAttr('onclick');
						}
						Cart_info();
					}
				}
	});
}
function Addwish(pid){
	$.ajax({
		type	: 'POST',
		url		: '/ajax.php',
		data	: 'admin=addwish&pid=' + pid,
		dataType: 'script'
	})
}
function showc(id){
	$('#' + id).attr("src",function(){if($('#' + id).attr("src")=='/images/index_71.jpg'){return '/images/index_72.jpg';}else{return '/images/index_71.jpg';}});
	$('#' + id).parent().next().toggle();
}
