//----------------------------------------------------------------------
//  make a hash table of the products
//----------------------------------------------------------------------
function hashTable(){
    this.a = new Array();
    this.b = new Array();
    this.size = 0;
    this.put = put;
    this.get = get;
    this.keys = this.a;
    this.values = this.b;
    this.remove = remove;
    this.removeAll = removeAll;	
}

//----------------------------------------------------------------------
//  remove all from hashtable
//----------------------------------------------------------------------
function removeAll(){
    with(this){
        a = new Array();
	  b = new Array();
	  size = this.a.length
	  keys = this.a
	  values = this.b
    }	
}

//----------------------------------------------------------------------
//  remove an element from hashtable
//----------------------------------------------------------------------
function remove(x){
    n = this.size;
    for(i=0;i<n;i++){
	 if(x == this.a[i])break;
    }
    if(i == n) return;
    tKeys = new Array();
    tValues = new Array();
    count = 0
    for(j=0;j<n;j++){		
        if(j!= i){
	      tKeys[count] = this.a[j]
		tValues[count] = this.b[j]
		count++;
	  }
    }	
    this.a = tKeys
    this.b = tValues
    this.size = this.a.length
}

//----------------------------------------------------------------------
//  get the value from the hashtable using the key
//----------------------------------------------------------------------
function get(x){
    n = this.size;
    for(i=0;i<n;i++){
       if(x == this.a[i]) return this.b[i];
    }
    return null;
}

//----------------------------------------------------------------------
//  add a key pair value to the hashtable
//----------------------------------------------------------------------
function put(x,y){
    n = this.size;
    for(i=0;i<n;i++){
	  if(x == this.a[i]){
            this.b[i] = y;
		return;
	  }
    }
    this.a[this.a.length] = x
    this.b[this.b.length] = y
    this.size = this.a.length;
}




//--------------------------------------------------------------------
//  the actual queryString Parser
//--------------------------------------------------------------------

function getArgs() {
    var args = new Object();
    var query = window.location.search.substring(1);
    var pairs = query.split("&");
    
	for (var i=0;i<pairs.length;i++) {
        var pos = pairs[i].indexOf('=');
        if (pos >= 0) {
            var argname = pairs[i].substring(0,pos);
            var value = pairs[i].substring(pos+1);
            args[argname] = unescape(value);
        }
    }
    return args;
}

//--------------------------------------------------------------------
// view the payPal shopping cart.
//--------------------------------------------------------------------
function viewCart(){
    document.write("<form name='_xclick' target='paypal' action='https://www.paypal.com/cgi-in/webscr' method='post'>");
    document.write('<input type="hidden" name="cmd" value="_cart">');
    document.write('<input type="hidden" name="business" value="libyrne@attbi.com">');
    document.write('<input type="hidden" name="image_url" value="http://www.kbrdesigns.com/images/popup_header.jpg">');
    document.write('<input type="image" src="https://www.paypal.com/images/view_cart_02.gif" border="0" name="submit" alt="Make payments">');
    document.write('<input type="hidden" name="display" value="1">');
    document.write('</form>');
}


//-----------------------------------------------------------------------------
// user clicked on an image.  pop up the browser window and display
// large image
//-----------------------------------------------------------------------------
function MM_openBrWindow(theURL, winName, features, Id) { 
    theURL = theURL + '?itemId=' + Id;
    window.open(theURL, winName, features);
}


//-----------------------------------------------------------------------------
//reloads the window if Nav4 resized
//-----------------------------------------------------------------------------
function MM_reloadPage(init) {  
    if (init==true) with (navigator) {
        if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
            document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }
        }
        else {
            if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
        }
}



