function confirmLogout(vendor) {
    var vendor = (vendor == null) ? false : true;
    if(confirm("Are you sure you want to logout?\n\nOk to continue, Cancel to abort.")) {
        if (vendor)
            window.location='/vendor/logout/';
        else
            window.location='/logout/';
    }
}

jQuery(document).ready(function(){
  jQuery('.giveFeedback').bind('click', function() {
    var product_id = jQuery(this).parent().attr('id').replace('feedbackLink-','');
    var cart_id = jQuery(this).parent().parent().parent().attr('id').replace('cart_id-','');
    if(cart_id==''){
        var cart_id = jQuery(this).parent().parent().attr('id').replace('cart_id-','');
    }	
    jQuery('#product_id').val(product_id);
    jQuery('#cart_id').val(cart_id);
  });
  jQuery('#closeThickbox').bind('click', function() {
    tb_remove();
    return false;
  });
  jQuery('#feedbackForm').bind('submit', function() {
    jQuery('.loading-graphic').show();
    product_id = jQuery('#product_id').val();
    jQuery.post(
      '/account/feedback/',
      {
        feedbackText: jQuery('#feedbackText').val(),
        product_id: product_id,
        cart_id: jQuery('#cart_id').val()
      },
      function(data){
        jQuery('.loading-graphic').hide();
        tb_remove();
        jQuery('#feedbackLink-' + product_id).addClass('feedbackSuccess');
        jQuery('#feedbackLink-' + product_id).html('<br />Thank you! Your feedback is appreciated.');
      }
    );
    return false;
  });
  jQuery('.print').bind('click', function() {
    window.print();
    return false;
  });
  jQuery('.stripe li:even').addClass('alt');

  jQuery('#findagift-keyword-search-field').bind('focus', function() {
    if(jQuery(this).val() == 'Product Keyword Search')
      jQuery(this).val('');
  });
  jQuery('#findagift-keyword-search-field').bind('blur', function() {
    if(jQuery(this).val() == '')
      jQuery(this).val('Product Keyword Search');
  });
});

function termsPrint() {
	var termsPrint = window.open('/terms/print/', 'termsPrint', 'width=600,height=500,status=1,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1');
}

