function setSize(name, id, size, price){
 document.forms['cart'].code.value=id;
 document.forms['cart'].size.value=size;
 document.forms['cart'].price.value=price;
 document.getElementById('price').innerHTML='<span class="prodPrice">$'+price+' <span style="color:gray">| size '+size+'</span></span>';
}

function shop_click(){
 if(menu_open==0){
  new Effect.BlindDown('inner_menu')
  menu_open=1;
 }else{
  new Effect.BlindUp('inner_menu')
  menu_open=0;
 }
}

function setArrows(){
 if(pPanel>0){
   document.getElementById('lt_arrow').innerHTML='<a href="javascript:void(null)" onclick="click_arrow(\'lt\')" class="counter"><<</a>';
 }else{
  document.getElementById('lt_arrow').innerHTML='';
 }
 if(nPanel<=mPanel){
  document.getElementById('rt_arrow').innerHTML='<a href="javascript:void(null)" onclick="click_arrow(\'rt\')" class="counter">>></a>';
 }else{
  document.getElementById('rt_arrow').innerHTML='';
 }
}

function setPage(){
 var p='';
 for (var x = 1; x <= mPanel; x++){
  if(x==cPanel){ p=p + '<b>'; }
  p=p + '<a href="javascript:void(null)" onclick="jump(' + x + ')" class="counter">' + x + '</a> ';
  if(x==cPanel){ p=p + '</b>'; }
 }
 if(mPanel>1){
  document.getElementById('page_counter').innerHTML=p;
 }
}

function click_arrow(dir){
 if(dir=='rt'){
  pPanel=pPanel+1;
  cPanel=cPanel+1;
  nPanel=nPanel+1;
  new Effect.MoveBy(scr_wn, 0, scr_amt_bk , {duration: 0.4,  transition: Effect.Transitions.sinoidal});
 }else{
  pPanel=pPanel-1;
  cPanel=cPanel-1;
  nPanel=nPanel-1;
  new Effect.MoveBy(scr_wn, 0, scr_amt_fwd , {duration: 0.4,  transition: Effect.Transitions.sinoidal});
 }
 setArrows();
 setPage();
}

function jump(tgt){
 j=cPanel-tgt;
 m=j*scr_amt_fwd;
 new Effect.MoveBy(scr_wn, 0, m , {duration: 0.4,  transition: Effect.Transitions.sinoidal});
 cPanel=tgt;
 pPanel=tgt-1;
 nPanel=tgt+1;
 setArrows();
 setPage();
}

function replaceImg(id){
 if(imgToggle=='m'){
  imgFile='/assets/images/products/'+id+'/large/'+id+'-d.jpg';
  imgToggle='d';
  imgLabel='ORIGINAL';
 }else{
  imgFile='/assets/images/products/'+id+'/large/'+id+'-1.jpg';
  imgToggle='m';
  imgLabel='CLOSEUP';
 }
 crossfade(document.getElementById('prod'), imgFile, '1');
 document.getElementById('zoom').innerHTML='<a href="javascript:void(null)" style="text-decoration:none">'+ imgLabel +'</a>';
}
