// JavaScript Document
// JavaScript Document
//Create Microsoft.XMLHTTP Object
function makeObject(){
var request = false;
if (window.XMLHttpRequest) {
    if (typeof XMLHttpRequest != 'undefined')
        try {
            request = new XMLHttpRequest();
            } catch(e) {
                request = false;
            }
        } else if (window.ActiveXObject) {
            try {
                request = new ActiveXObject('Msxml2.XMLHTTP');
                } catch(e) {
                    try {
                        request = new ActiveXObject('Microsoft.XMLHTTP');
                    } catch(e) {
                            request = false;
                    }
                }
            }
        return request;
}
 
//call the function makeObject()
var request = makeObject();
var requestb = makeObject();
var thed;       
var starttime;
var endtime;
var timetime;
var fadein;
var thetype;
var therequest;
var loadingid;

/*function loadlist(i,u){
	alert("loadlist");
loadingid = i;
therequest = u;
alert(i);
alert(u);
starttime = new Date().getTime();
document.getElementById(loadingid).innerHTML="<img src='/images/ajax-loading-bar.gif' />&nbsp;&nbsp;Searching...";
fadein = false;
//alert(u);
if (u.indexOf("&searching") != -1){
	//alert('search');
	var se = getCookie('search'); //document.showboxes.perpage.value;
	//alert(se);
	writetofile('searchpage',"[" + se + "]");
	//alert("ok search");
}
nd();
//opacity('boxes', 100, 0, 3);
changeOpac(0, 'boxes', 'out');
//alert(u);
//var c = document.getElementById('perpage').value;
//alert(c);
var c = document.showboxes.perpage.value;
var index = document.showboxes.perpage.selectedIndex;
//alert(index);
    var c = document.showboxes.perpage.options[index].value;
//    alert(c); // Alerts 'foo'

//alert(c);
if (c.length == 0)
{
	alert('manual value');
	//var selectBoxp = document.showboxes.perpage; //getElementById('perpage');
	//c = selectBoxp.options[selectBoxp.selectedIndex].text;
	//c = document.showboxes.perpage.options[document.showboxes.perpage.selectedIndex].value;
	//var selectBoxs = document.getElementById('perpage');
	//alert('sortindex=' + selectBoxs.selectedIndex);
	//c = selectBoxs.options[selectBoxs.selectedIndex].text;
	var c = document.getElementById('perpage').options[document.getElementById('perpage').selectedIndex].text;

}

if (c == 0)
{
	c=12;
}
//alert("perpage=" + c);
setCookie('perpage',c,'21');
if (u.indexOf("&num") == -1)
{
	u = u + '&num=' + c;
}

var s = document.getElementById('sortby').value;
if (s.length == 0)
{
	var selectBoxs = document.getElementById('sortby');
	//alert('sortindex=' + selectBoxs.selectedIndex);
	s = selectBoxs.options[selectBoxs.selectedIndex].text;
	if (s == 'Default')
	{
		s = '0';
	}
	if (s == 'Price: Low to High')
		{
		s = '6';
	}
	if (s == 'Price: High to Low')
	{
		s = 'r6';
	}
	if (s == 'GPM: Low to High')
	{
		s = '24';
	}
	if (s == 'GPM: High to Low')
	{
		s = 'r24';
	}
	if (s == 'Pressure: Low to High')
	{
		s = '23';
	}
	if (s == 'Pressure: High to Low')
	{
		s = 'r23';
	}
}
if (s.length == 0)
{
	s='0';
}
setCookie('sortby',s,'21');
if (u.indexOf("&sortby") == -1)
{
	u = u + '&sortby=' + s;

}
//document.getElementById('boxes').innerHTML = "<div align='center'><img src='/images/ajax_loading.gif' alt='' /></div>";
/*if (u == "")
{
	u = 'num=' + c + '&sortby=' + s;
}
else
{
	u = u + '&num=' + c + '&sortby=' + s;
}*/
//alert("sending " + u);
//alert('show_boxes.php?' + u + '&screenwidth=' + screen.width);
/*request.open('get', 'show_boxes.php?' + u + '&screenwidth=' + screen.width );
request.onreadystatechange = parselist; 
request.send('');
alertTimerId = setTimeout ( "longwait()", 5000 )
}
*/

function loadajax(element,thesearch,perpage,sortby,page){
	loadingid = element;
	therequest = thesearch;
	
	//alert(thesearch);
	//alert(page);
	
	starttime = new Date().getTime();
	document.getElementById('timer').innerHTML="";
	document.getElementById('boxes').innerHTML="<img src='/images/ajax-loading-bar.gif' />&nbsp;<img src='/images/loading-short.gif' />&nbsp;Searching...";
	fadein = false;
	//alert(u);
	if (thesearch.indexOf("&searching") != -1){
		//alert('search');
		//var se = getCookie('search'); //document.showboxes.perpage.value;
		var se = thesearch;
		se = se.replace("searcher=","");
		se = se.replace("&searching=true","");
		//alert(se);	
		if (thesearch.indexOf("&doitemsearch=false") != -1)
			writetofile('searchpage',"B[" + se + "]");
		else
			writetofile('searchpage',"F[" + se + "]");
		//alert("ok search");
	}
	nd();
	//opacity('boxes', 100, 0, 3);
	//changeOpac(0, 'boxes', 'out');

	if (perpage == "")
	{
		perpage = getCookie('perpage');
	}
	else
	{
		setCookie('perpage',perpage,'1');
	}
	thesearch = thesearch + '&num=' + perpage;
		
	if (sortby == "")
	{
		sortby = getCookie('sortby');
	}
	else
	{
		setCookie('sortby',sortby,'1');
	}
	thesearch = thesearch + '&sortby=' + sortby;
	if (page == "")
	{
		page = getCookie('currentpagen');
	}
	else
	{
		setCookie('currentpagen',page,'1');
	}
	thesearch = thesearch + '&page=' + page;
	
	//alert("sending " + thesearch);
	//alert('show_boxes.php?' + u + '&screenwidth=' + screen.width);
	//request.open('get', 'show_boxes.php?' + thesearch + '&screenwidth=' + screen.width );
	//request.onreadystatechange = parselist; 
	//request.send('');
	
	request.open('POST', 'show_boxes.php');
	request.onreadystatechange = parselist; 
	//Send the proper header information along with the request
	var params = thesearch + '&screenwidth=' + screen.width;
	params = params.replace("%","");
	request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	request.setRequestHeader("Content-length", params.length);
	request.setRequestHeader("Connection", "close");

	request.send(params);
	alertTimerId = setTimeout ( "shortwait()", 2000 )
}

function loaditem(i){
starttime = new Date().getTime();
requestb.open('get', 'show_detail.php?item=' + i);
requestb.onreadystatechange = parselist; 
requestb.send('');
}

function parselist(){
if(request.readyState == 4){ 
//hidediv('loading');
var answer = request.responseText;
//document.getElementById(loadingid).innerHTML="";
//changeOpac(0, 'boxes', 'out');
document.getElementById('boxes').innerHTML = answer;
clearTimeout ( alertTimerId );
endtime = new Date().getTime();
timetime = (endtime - starttime) * 0.001;
document.getElementById('timer').innerHTML = '<span style="font-size:x-small">Execution time: ' + timetime.toFixed(3) + ' seconds</span>';
writetofile('ajaxtime',timetime.toFixed(3) + " seconds for " + escape(therequest));
//writetofile('searchpage',"[" + se + "]");
//if (document.getElementById("loader")) {
//  document.getElementById("loader").innerHTML = "";
//}
fadein = true;
//opacity('boxes', 1, 100, 3000);
document.getElementById('searchideas').focus();
document.getElementById('sitesearch').focus();
window.scroll(0,0);
}
}

function shortwait(){
	document.getElementById('boxes').innerHTML = "<img src='/images/ajax-loading-bar.gif' />&nbsp;<img src='/images/loading-medium.gif' />&nbsp;Searching, Just a moment longer...";
	alertTimerId = setTimeout ( "longwait()", 3000 )
}
function longwait(){
	document.getElementById('boxes').innerHTML = "<img src='/images/ajax-loading-bar.gif' />&nbsp;<img src='/images/loading-long.gif' />&nbsp;Searching, Just a moment longer...<br><br>Well, this is embarassing.<br><br>We apologize, this search is taking longer than normal.<br>You should have had a response by now!<br><br>I am still trying, but this should not happen every time!";
}

var browserType;
if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
   browserType= "gecko"
}

function hidediv(d) {
  counttime=0;
  if (browserType == "gecko" )
     document.poppedLayer =
         eval('document.getElementById(d)');
  else if (browserType == "ie")
     document.poppedLayer =
        eval('document.getElementById(d)');
  else
     document.poppedLayer =  
        eval('document.layers[d]');
  document.poppedLayer.style.visibility = "hidden";
}

function showdiv(d) {
  counttime=0;
  if (browserType == "gecko" )
     document.poppedLayer =
         eval('document.getElementById(d)');
  else if (browserType == "ie")
     document.poppedLayer =
        eval('document.getElementById(d)');
  else
     document.poppedLayer =
         eval('document.layers[d]');
  document.poppedLayer.style.visibility = "visible";
}

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i=i-5) {
			setTimeout("changeOpac(" + i + ",'" + id + "','out')",(timer * (speed * 2)));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i=i+5)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "','in')",(timer * (speed * 2)));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id, d) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}

function gototop(){
	//alert('going top');
	window.location = "#thetop";
}

function gotopagedrop(chosen){
	window.location=chosen;
}
function getmedia(m){
	//alert(m);
	if(m == "Choose Here"){
		document.getElementById('mediatext').innerHTML = "Choose your presentation above";
		document.getElementById('mediadiv').innerHTML = '';
	}
	if(m == "ironman1"){
		document.getElementById('mediatext').innerHTML = "This manufacturers video shows the strength of the Ironman series of paint sprayers.<br>(Please don't try this at home)";
		document.getElementById('mediadiv').innerHTML = '<object width="660" height="405"><param name="movie" value="http://www.youtube-nocookie.com/v/qPUjmRnKCJg&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/qPUjmRnKCJg&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object>';
	}
	if(m == "linedriver2"){
		document.getElementById('mediatext').innerHTML = "This manufacturers video shows the Graco LineDriver HD Ride-On Striping Machine";
		document.getElementById('mediadiv').innerHTML = '<object width="500" height="405"><param name="movie" value="http://www.youtube-nocookie.com/v/IsTdWDQ93pk&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/IsTdWDQ93pk&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="405"></embed></object>';
	}
	if(m == "magnum"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/mfHJDsGNZ7A&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mfHJDsGNZ7A&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "gracoinstr"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/Pdc7e-Sb8z8&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Pdc7e-Sb8z8&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "gracocleanup"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/5wnHchngO8Q&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/5wnHchngO8Q&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "gracoaccess"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/bNEsJETJaxU&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/bNEsJETJaxU&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "gracohowtospray"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/TuqZJbo6Q-w&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/TuqZJbo6Q-w&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "695misc"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="580" height="360"><param name="movie" value="http://www.youtube.com/v/6EdD8uEe_BQ&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6EdD8uEe_BQ&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"></embed></object>';
	}
	if(m == "695misc2"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="580" height="360"><param name="movie" value="http://www.youtube.com/v/foD86cb801c&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/foD86cb801c&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"></embed></object>';
	}
	if(m == "695instr"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="580" height="360"><param name="movie" value="http://www.youtube.com/v/TEUJvgQnGkY&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/TEUJvgQnGkY&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"></embed></object>';
	}
	if(m == "convenital"){
		document.getElementById('mediatext').innerHTML = "";
		document.getElementById('mediadiv').innerHTML = '<object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/91ieuwSsv9M&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/91ieuwSsv9M&hl=en&fs=1" type="application/x-shockwave-flash" width="480" height="295" allowscriptaccess="always" allowfullscreen="true"></embed></object>';
	}
	if(m == "whisperwash"){
		document.getElementById('mediatext').innerHTML = "WhisperWash's initial commitment to quality is displayed in the superior engineering of the Whisper Wash® Classic. Additionally they offer you the added benefits of cleaning large flat surface areas with The Big Guy, Ground Force Flip-N-Fold, and the Aqua Pro, or the flexibility in design choices provided by the Lil' Guy or our Ultra Clean line. Whisper Wash® pressure washing systems provide proven economical benefits to industrial pressure cleaning users throughout the world.";
		document.getElementById('mediadiv').innerHTML = '<object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows® Media Player components..." type="application/x-oleobject" width="280" height="256"><param name="fileName" value="media/whisperwash.avi"><param name="animationatStart" value="true"><param name="transparentatStart" value="true"><param name="autoStart" value="true"><param name="showControls" value="true"><param name="Volume" value="-450"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="media/whisperwash.avi" name="MediaPlayer1" width=280 height=256 autostart=1 showcontrols=1 volume=-450></object>';
	}
}

function writetofile(p,t){
//alert('writefile.php?page=' + p + '&txt=' + t);
requestb.open('get', 'writefile.php?page=' + p + '&txt=' + t);
requestb.onreadystatechange = writeresult; 
requestb.send('');
}

function writeresult(){
if(requestb.readyState == 4){ 
//hidediv('loading');
	var answer = requestb.responseText;
	//alert(answer);
	}
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

var IE = document.all?true:false;
//if (!IE) document.captureEvents(Event.MOUSEMOVE)
//document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY() {
  alert("setting scroll " + window.scrollY);
  setCookie('scroll',window.scrollY,'1');
}
function getScrollXY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  //alert("setting scroll " + scrOfY);
  setCookie('scroll',scrOfY,'1');
}
function setScrollXY(scrOfY) {
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    window.pageYOffset = scrOfY;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    document.body.scrollTop = scrOfY;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    document.documentElement.scrollTop = scrOfY;
  }
}
function googlecartAfterAdd(item, index){
	writetofile('addtocart','Add ' + item.getQuantity() + ' ' + item.getTitle() + '=$' + googlecart.getSubtotal());
}
function googlecartAfterRemove(item, index){
	writetofile('addtocart','Remove ' + item.getQuantity() + ' ' + item.getTitle() + '=$' + googlecart.getSubtotal());	
}
function googlecartOnCheckoutClick(items, form) {
	writetofile('addtocart','CHECKOUT ' + googlecart.getTotalQuantity() + ' items and ' + googlecart.getItems().length + ' unique =$' + googlecart.getSubtotal());	
	return true;
}
function googlecartBeforeAdd(item, index, newQuantity, opt_node){
	if (item.getTitle() == undefined){
		writetofile('addtocart','ERROR ' + item.getQuantity() + ' ' + item.getTitle() + '=$' + googlecart.getSubtotal());
		alert('Sorry, an error occured and this item can not be added to the shopping cart.\nPlease try a different web-browser.');
		return false;
	}
	else
	{
		return true;
	}
}
//Called before a new product is added or quantity of a product is increased. Can be triggered by add-to-cart button, adding a product programmatically, increasing quantity in the cart itself.
//The item is added to the shopping cart only if this function returns true.
//@param {ShoppingCartItem} item - object representing the item to be added to the shopping cart. If you need to modify the item - do this on this object.
//You can modify the price on this item, it will be applied to the identical products already in the cart.
//@param {number} index - index of the existing product in the cart that will be affected or null if the product is new and not yet in the cart
//@param {number} newQuantity - quantity that will be in the cart if adding is successful.
//@param {Node} opt_node - HTML DOM node, optional, when available represents the product to be added.
//@return {boolean} - when true the item is added to the cart.
 
 