
// GENERATE POPOVER FOR THUMBNAIL ( DESCRIPTION, IMAGE )
function GPop(d,i) { var t='';;
 t+='<table cellspacing=0><tr><td align="center">';
 t+='<a href="'+i+'.htm"><img src="img/__'+i+'.jpg" title="'+d+'">';
 t+='Click to View Image';
 t+='</a></td></tr></table>';
 DomP(DomL('GalleryT'),t); } 


// INPUT HIDDEN ( NAME, VALUE )
function ih(n,v){return '<input type="hidden" name="'+n+'" value="'+v+'">';}

// GALLERY SPACE FRAME
function gsf(){return '<td width=12 style="padding:0;cursor:default;">&nbsp;</td>';}

// GALLERY EMPTY FRAME 
function gef(){return '<td width=128 style="cursor:default;">&nbsp;</td>';}

// GALLERY FILL OUT REST OF TABLE ( NUMBER OF COLUMNS )
function gft(n){var w='';if(gr==n)return w;while(1){w+=gef();gr++;if(gr==n)return w;w+=gsf();}}

// GALLERY ROW
var gr=0;

// GENERATE SHOPPING CART
function GCart() { var w="";

// w='Your Order Contains '+CartQ()+' Item(s) Totaling $'+CartT()+' - Click on an Image to Continue Browsing';
// DomP(DomL('orderd'),w);

 w="<h1>Lightbox</h1>";

 if(!cart.length) {
  w+='<h2>How to Use the Lightbox</h2>';

  w+='Choosing a selection of photographs is easy using our online tool. ';
  w+='In a gallery, roll over a thumbnail and click on the small preview popup image.<br><br>';

  w+='<img src="img/Lightbox1.jpg"><br>';

  w+='This will bring you to a larger view of the image. ';
  w+='Roll over the Purchase Photograph label and click on an option from the drop down menu.<br><br>';

  w+='<img src="img/Lightbox2.jpg"><br>';

  w+='This will add that image to your lightbox. ';  
  w+='You can add as many images as you would like to your lightbox. ';
  w+='Clicking on an image in your lightbox will return you to the larger view of that image.<br><br>';

  w+='<img src="img/Lightbox3.jpg"><br>';

  w+='When finished click the Click to Complete Order button to checkout.<br><br>';

 }

 if(cart.length) {
  w+='<form name="cform" action="https://www.paypal.com/cgi-bin/webscr" method="post">'+
  ih('cmd','_cart')+
  ih('upload','1')+
  ih('business','paypal@mail.farrarfocus.com');

  //ih('cancel_return','http://farrarfocus.com/index.htm')+
  //ih('return','http://farrarfocus.com/index.htm?return');

  // [quanity, item, return url, option, price]

  w+=cart.M(function(t,a,i){
   return ih('item_name_'+(i+1),t[1]+'-'+t[3])+ih('amount_'+(i+1),t[4]); }).join('');

  w+=ih('handling_cart','15');

  //w+=ih('item_name_'+(kk.length+1),'Shipping and Handling')+ih('amount_'+(kk.length+1),'15');

  w+='<div id="Checkout">';
  w+='<a href="javascript:document.cform.target=\'_blank\';document.dform.submit();">Click to Complete Order</a></div>'; // change to cform to fix
  w+='</form>';
  w+='<center>Lightbox contains '+CartQ()+' item(s) totaling $'+CartT()+'</center><br>';

  gr=0;

  w+='<table id="Carts" width=300 cellspacing=0>';
  w+=cart.M(function(e,a,i){
   var w="";
   if(gr==0) w+='<tr>';
   w+='<td width=128 valign="bottom" align="center" ';
   w+='onMouseOver="ClassA(this,\'over\');" ';
   w+='onMouseOut="ClassR(this,\'over\');"><a href="'+e[2]+'"><img id="ci'+i+'" ';
   w+='src="img/_'+e[1]+'.jpg" title="Continue Browsing"></a>';
   w+=e[1]+'<br><span>'+e[3]+'<br>$'+e[4]+'</span><br>';
   w+='<a href="javascript:CartR('+i+');Go(\'order.htm\');" class="remove">remove</a></td>';
   if(gr==1){w+='</tr>';gr=-1;}else w+=gsf();gr++;
   return w; }).join('');

  w+=gft(2);
  w+='</tr></table><br>'; }
 else { w+=''; }
 DomP(DomL('orderc'),w); }
