function redirectUrl(artist_id, category_id, color_id, page, per_page)
{
  window.location = '/choose_store_results/'+artist_id+'/'+category_id+'/'+color_id+'/'+page+'/'+per_page;
}
function changeAvailbleProduct(product_id,product_type_id)
{
  jQuery.ajax({
  type:'POST',
  dataType:'html',

 success:function(data, textStatus){
    jQuery('#availbleProduct').html(data);
 },

 beforeSend:function(XMLHttpRequest){},
 complete:function(XMLHttpRequest, textStatus){},
 url:'/backend.php/update_availble_products/'+product_id+'/'+product_type_id
 });
}

function showHideProductDivs(value)
{
  if(value == true)
  {
    $('one_off_box').show();
    $('availbleProduct').hide();
  }
  else
  {
    $('one_off_box').hide()
    $('availbleProduct').show()
  }
}

function changeAddForm(product_id, selected_product_type_finish_id, size_text)
{
  new Ajax.Updater('add_form', '/change_add_form/'+product_id+'/'+selected_product_type_finish_id+'?size_text='+size_text, {asynchronous:true, evalScripts:true});
  changePrice(0,selected_product_type_finish_id, product_id);
}

function changePrice(product_type_cost_id, product_type_finish_id, product_id)
{
  new Ajax.Updater('price', '/update_price/'+product_type_cost_id+'/'+product_type_finish_id+'/'+product_id, {asynchronous:true, evalScripts:false}); 
  return false;
}

function changeSizeSelector(product_id, selected_product_type_finish_id, key)
{
  //new Ajax.Updater('td_size_'+key, '/change_size_selector/'+product_id+'/'+selected_product_type_finish_id+'/'+key, {asynchronous:true, evalScripts:true, onComplete:function(request, json){Element.hide('indicator')}, onLoading:function(request, json){Element.show('indicator')}});;
  new Ajax.Updater('td_size_'+key, '/change_size_selector/'+product_id+'/'+selected_product_type_finish_id+'/'+key, {asynchronous:true, evalScripts:true});
  
  //update hidden field
  $('input_'+key+'_finish').setValue(selected_product_type_finish_id);
  
  //update price
  new Ajax.Updater('price_'+key, '/update_price/0/'+selected_product_type_finish_id+'/'+product_id, {asynchronous:true, evalScripts:false}); 
}

function changeSize(product_type_cost_id, product_type_finish_id, product_id, key)
{
  //changePrice(product_type_cost_id, product_type_finish_id, product_id);
  //update hidden field
  $('input_'+key+'_size').setValue(product_type_cost_id);
  
  //update price
  new Ajax.Updater('price_'+key, '/update_price/'+product_type_cost_id+'/'+product_type_finish_id+'/'+product_id, {asynchronous:true, evalScripts:false}); 
}

function showForm(id)
{
  if(document.getElementById(id).style.display == 'none')
  {
    document.getElementById(id).style.display = 'block';
    document.location.href = "#emailForm";
  }
  else
  {
    document.getElementById(id).style.display = 'none';
  }
}

function upForm(id)
{
  if(document.getElementById(id).style.display == 'none')
  {
    document.getElementById(id).style.display = 'block';
  }
}

function downForm(id)
{
  if(document.getElementById(id).style.display == 'block')
  {
    document.getElementById(id).style.display = 'none';
  }
}
