function loadProduct(obj){
	window.location='index.php?pg=eshop&bs_id='+obj.value;
}

function loadProductColor(id,obj){
	if(obj.value==-1 || obj.value==0){return 0;}
	window.location='index.php?pg=eshop_detail&id='+id+"&crid="+obj.value;
}

function swapPhoto(img){
	document.getElementById('bimg').src=img;
}

function band_link(id,obj){
	var caid=obj.value;
	window.location='index.php?pg=eshop&bs_id='+id+"&caid="+caid;
}

function cate_link(id,obj){
	var caid=obj.value;
	window.location='index.php?pg=eshop&cid='+id+"&caid="+caid;
}


function setQty(){
	var s=document.getElementById('size');
	var v=s.value;
	if(v==0){v='onesize';}
	if(v=='ONE SIZE'){v='onesize';}
	if(!qtyonesize){qtyonesize=0;}
	eval('var k=qty'+v+';');
	var c='<select name="qty" id="qtys">';
	for(var i=1;i<=k;i++){
		c+='<option value="'+i+'">'+i+'</option>';
	}
	if(k<1){c+='<option value="0">已售完</option>';}
	c+='</select>';
	document.getElementById('qty').innerHTML=c;
}

function checkNUM(){
	if(document.getElementById('qtys').value==0){
		alert('已售完');
		return false;
	}
	return true;
}
 var WindowObjectReferenceOfRequestedPopup, WindowObjectReferenceOfIntermediaryPopup;

function OpenRequestedPopup(strUrl, strTarget)
  {
  var windowWidth, windowHeight, windowLeft, windowTop;

 
  windowWidth = 380;
  windowHeight =400;
 
 
  /* The above code is just to define reasonable sizes and initial positions to the popup to be. */

  if (WindowObjectReferenceOfRequestedPopup == null || WindowObjectReferenceOfRequestedPopup.closed)
  {
  WindowObjectReferenceOfRequestedPopup = window.open(strUrl, strTarget, "width=" + windowWidth + ",height=" + windowHeight + ",directories=no,status=no,scrollbars=yes,resize=no,menubar=no");
  }
  else
  {
  if(WindowObjectReferenceOfRequestedPopup.focus)
    {
    WindowObjectReferenceOfRequestedPopup.focus();
    };
  };


  }


