function doClear(theText) 
{
     if (theText.value == theText.defaultValue)
 {
         theText.value = ""
     }
 }

function viewCart(command){

var scriptName = "quikstore.cgi";
var linkURL = "http://www.dakotaarms.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,13) == 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 PAGE = myLocation[myLocation.length - 1];
          linkURL += "&page=" + PAGE + "&store_type=html";
     }

document.location = linkURL;
}
