
function viewCart(command){

var scriptName = "quikstore.cgi";
var linkURL = "http://www.clagrills.com/cgi-bin/quikstore.cgi";

var task = "?view_cart=yes"
if(command == "checkout"){
     task = "?checkout=yes"
}
linkURL += task;

	var myLocation = unescape(document.location);
	myLocation = myLocation.substring(1).split('/');

     if(myLocation[myLocation.length - 1].substring(0,scriptName.length) == scriptName){

          // GET Requests
		var qsQuery = unescape(document.location.search.replace(/\+/g,' '));
        qsQuery = qsQuery.replace('?','&');
        qsQuery = qsQuery.replace("checkout=yes&",'');
        qsQuery = qsQuery.replace("view_cart=yes&",'');

          if(qsQuery.length > 1){
     		linkURL += qsQuery;
          }
          else{
               for(i = 0; i < document.forms[0].elements.length; i++){
                    var inType = document.forms[0].elements[i].type;
                    if(inType == "hidden"){
                         var fieldName = document.forms[0].elements[i].name;
                         var fieldValue = document.forms[0].elements[i].value;
                         if(fieldName == "view_cart"){
                            continue;
                         }
                         if(fieldName == "checkout"){
                            continue;
                         }
                         if(fieldValue != "shipping.html"){
                              qsQuery += "&" + fieldName + "=" + fieldValue;
                         }
                    }
               }
               linkURL += qsQuery;
          }
     }
     else{
          var pageURL = "";
          for(j = 3;j < myLocation.length; j++){
                if(pageURL == ""){
                    pageURL = myLocation[j];
                }
                else{
                    pageURL = pageURL + "/" + myLocation[j];
                }
          }
          linkURL += "&page=" + pageURL + "&store_type=html";
     }

document.location = linkURL;
}
// -->








