// JavaScript Document


//cartItems = <?php if (isset($cartItems) ) { echo $cartItems; } else { echo "0"; } ?>;
function submitForm(id)  {
// This function will submit a form with JavaScript
// USE:  <a href="#" onClick="submitForm();">add to samples form</a>
// Execute action of form - in this case with get string elements

//remove this line if submitting with standand form submit button or you will get a double submit in IE
    document.forms[0].submit();
	//updateBook();   //alert('updated');
	//swapText(id, 'sample added')
return true;
}
  	

 

 function updateBook()
 {
 var c;
 if ( typeof( window[ 'cartItems' ] ) != "undefined" ) {
   cartItems = cartItems + 1;
   	 //alert('update book cartItems inc');
	//c = cartItems.toString(); 
	//c = "(".cartItems.")";
	
	var s = new String(eval (cartItems));
// use it like this
s=s.trim();

	 	//document.getElementById('numItems').innerHTML = eval (cartItems);
		document.getElementById('numItems').innerHTML = s;


   } else {
     cartItems = 1;
	//c = cartItems.toString(); 
	//c = "(".cartItems.")";
	
		var s = new String(eval (cartItems));
// use it like this
s=s.trim();

	 	//document.getElementById('numItems').innerHTML = eval (cartItems);
	 	document.getElementById('numItems').innerHTML = s;
	 //alert('update book cartItems = 1');
	 }
 }

String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}



function printBook()
{
 

if ( typeof( window[ 'cartItems' ] ) != "undefined" ) {
   //document.write('(');
  // document.write(cartItems)
  // document.write(')')

var s = new String(eval (cartItems));
// use it like this
s=s.trim();
 

	 	//document.getElementById('numItems').innerHTML = eval (cartItems);
	 	document.getElementById('numItems').innerHTML = s;

   	// alert('print book');

   } else {
     cartItems = 0;
var s = new String(eval (cartItems));
// use it like this
s=s.trim();
	 	//document.getElementById('numItems').innerHTML = eval (cartItems);
	 	document.getElementById('numItems').innerHTML = s;
	 }


 }
 

