/*$(function() {
    $('[@rel*=row]').click(function () {                
        $(this).parent().highlightFade({color:'#fc9600',speed:1500,iterator:'sinusodial'});
    }) 
});*/

$(function() {
    $.listen('click', '#CartCountrySelectorLink', function() {
        $('#CartCountrySelector').toggle('fast');    
    });
});

$(function() {
    $.listen('click', '#fotoservice_delivery_address_link', function() {
        $('#fotoservice_delivery_address').toggle('fast');
        if($('#fotoservice_delivery_address_link').hasClass('collapsed')) {
            $('#fotoservice_delivery_address_link').removeClass('collapsed').addClass('expanded');
        }
        else {
            $('#fotoservice_delivery_address_link').removeClass('expanded').addClass('collapsed');
        }        
    });
});

function makePreview(img_id, user_id, type_key, theme, product_group) {
    //alert(type_key);
    $(function () {
      var img = new Image();
      $('#preview_img_'+ product_group).fadeOut();
      $('#preview_img_'+ product_group).remove();
      $(img)
        .load(function () { 
          $(this).hide();
          
          $('#previewLoader_'+ product_group)
            .removeClass('loading')
            .append(this);
          $(this).fadeIn();
          
        })
        .error(function () {
          //alert('Fehler');
        })                    
        .attr('src', '/lib/functions/preview_image_'+product_group+'.php?imgId='+img_id+'&item_user='+user_id+'&type_key='+type_key+'&theme='+theme+'&productGroup='+product_group)
        .attr('id', 'preview_img_'+ product_group);
    });                
}

function makeUploadPreview(row_id, img_id, app_id, type_key, theme, product_group) {
    highlightRow(row_id);
    $(function () {
      var img = new Image();
      $('#uploadPreview_img_'+ product_group).fadeOut();
      $('#uploadPreview_img_'+ product_group).remove();
      $(img)
        .load(function () { 
          $(this).hide();
          
          $('#uploadPreviewLoader_'+ product_group)
            .removeClass('loading')
            .append(this);
          $(this).fadeIn();
          
        })
        .error(function () {
          //alert('Fehler');
        })                    
        .attr('src', '/lib/functions/preview_upload_image_'+product_group+'.php?imgId='+img_id+'&appId='+app_id+'&type_key='+type_key+'&theme='+theme+'&productGroup='+product_group)
        .attr('id', 'uploadPreview_img_'+ product_group);
    });                
}

// Hint text in order message textarea
$(function() {
    $('#order_message').hint(); 
});
