function cook(e,m){
        if(!document.getElementsByTagName) return;
	if(typeof(m)=='undefined') m='All';
        var c=document.cookie.split(';');
	var ok=false;
        for(var i=c.length-1; i>=0; i--){
                while(c[i].charAt(0)==' ') c[i]=c[i].substring(1,c[i].length);
                if(c[i].substr(0,31)=='SuperSecretProtechLoginCookie=1') ok=true;
        }
	if(!ok) return;

	var a=document.getElementsByTagName('A');
	var img=document.createElement('IMG');
	img.src="/shop/images/edit.gif";
	img.width=24;
	img.height=24;
	img.alt="Edit";
	img.border=0;
	var img2=document.createElement('IMG');
	img2.src="/shop/images/copy.gif";
	img2.width=24;
	img2.height=24;
	img2.alt="Copy";
	img2.border=0;
	var img3=document.createElement('IMG');
	img3.src="/shop/images/trash.gif";
	img3.width=18;
	img3.height=24;
	img3.alt="Delete";
	img3.border=0;
	var img4u=document.createElement('IMG');
	img4u.src="/shop/images/arr-b-up9.png";
	img4u.width=9;
	img4u.height=9;
	img4u.alt="Move up";
	img4u.border=0;
	var img4d=document.createElement('IMG');
	img4d.src="/shop/images/arr-b-down9.png";
	img4d.width=9;
	img4d.height=9;
	img4d.alt="Move down";
	img4d.border=0;
	for(var i=a.length-1; i>=0; i--){
		if(!a[i].name) continue;
		if(a[i].name.substr(0,5)=='cook_'){
			a[i].href='/shop/admin_new/?page=edit&what='+e+escape(a[i].name.substr(5))+'&car_model='+escape(m);
			a[i].target='edit';
			a[i].appendChild(img.cloneNode(true));
		}
		if(a[i].name.substr(0,12)=='sortbuttons_'){
			var t=document.createElement('TABLE');
			t.style.display='inline';
			a[i].target='edit';
			var aa=a[i].cloneNode(true);
			a[i].style.position='relative';
			a[i].style.top='-10px';
			a[i].style.width='9px';
			a[i].style.marginRight='-9px';
			a[i].style.zIndex='10000';
			a[i].href='/shop/admin_new/?page=sortpt&what=U'+escape(a[i].name.substr(12));
			a[i].appendChild(img4u.cloneNode(true));
			aa.href='/shop/admin_new/?page=sortpt&what=D'+escape(a[i].name.substr(12));
			aa.appendChild(img4d.cloneNode(true));
			a[i].parentNode.insertBefore(aa, a[i].nextSibling);
		}
		if(a[i].name.substr(0,10)=='yearthing_'){
			var x=document.createElement('DIV');
			x.style.fontSize='8pt';
			x.style.whiteSpace='nowrap';
			x.appendChild(document.createTextNode('Yr: '));
			a[i].parentNode.insertBefore(x, a[i].nextSibling);
			a[i].target='edit';
			a[i].style.fontSize='8pt';
			var aa=a[i].cloneNode(true);
			aa.href='#';
			aa.onclick=function(){
				var w=window.open("/shop/admin_new/checkyear.php?act=no&tid="+escape(this.name.substr(10)), "checkyear", "width=200,height=300,menubar=yes,resizable=yes,scrollbars=yes");
				if(w.focus) w.focus();
				return false;
			};
			aa.appendChild(document.createTextNode('check'));
			x.appendChild(aa);
			x.appendChild(document.createTextNode(' / '));
			aa=a[i].cloneNode(true);
			aa.href='/shop/admin_new/?page=doyear&what=S'+escape(a[i].name.substr(10));
			aa.appendChild(document.createTextNode('start'));
			x.appendChild(aa);
			x.appendChild(document.createTextNode(' / '));
			aa=a[i].cloneNode(true);
			aa.href='/shop/admin_new/?page=doyear&what=E'+escape(a[i].name.substr(10));
			aa.appendChild(document.createTextNode('end'));
			x.appendChild(aa);
			x.appendChild(document.createTextNode(' / '));
			aa=a[i];
			aa.href='/shop/admin_new/?page=doyear&what=B'+escape(a[i].name.substr(10));
			aa.appendChild(document.createTextNode('both'));
			x.appendChild(aa);
		}
		if(a[i].name.substr(0,11)=='deletepart_'){
			a[i].href='/shop/admin_new/?page=deletepart&what='+escape(a[i].name.substr(11));
			a[i].target='edit';
			a[i].appendChild(img3.cloneNode(true));
		}
		if(window.CopyToClipboard){
			if(a[i].name.substr(0,9)=='copylink_'){
				a[i].onclick=cookCopyLink(a[i].name.substr(9));
				a[i].style.cursor='pointer';
				a[i].appendChild(img2.cloneNode(true));
			}
			if(a[i].name.substr(0,9)=='copytext_'){
				a[i].onclick=cookCopyText(a[i].name.substr(9));
				a[i].style.cursor='pointer';
				a[i].appendChild(img2.cloneNode(true));
			}
		}
		if(a[i].name.substr(0,11)=='pricecheck_'){
			var j=a[i].name.indexOf('_',11);
			if(j>0){
				a[i].style.fontSize='8pt';
				a[i].href='/shop/admin_new/pricecheck.php?id='+a[i].name.substr(j+1)+"&price="+a[i].name.substring(11,j);
				a[i].target='price';
				a[i].appendChild(document.createElement('BR'));
				a[i].appendChild(document.createTextNode("(check)"));
			}
		}
		if(a[i].name.substr(0,10)=='modellink_'){
			a[i].href=a[i].getAttribute('xhref');
			a[i].appendChild(document.createTextNode('['+a[i].name.substr(10)+']'));
			a[i].parentNode.insertBefore(document.createTextNode('\xa0 \xa0'), a[i].nextSibling);
		}
	}
}

function cookCopyLink(txt){
	return function(){
		location.hash=txt;
		window.CopyToClipboard(location.href);
		return false;
	};
}

function cookCopyText(txt){
	return function(){
		window.CopyToClipboard(txt);
		return false;
	};
}
