function checkAll( n, fldName ) {
  if (!fldName) {
     fldName = 'olo';
  }
	var f = document.adminForm;
	var c = f.toggle.checked;
	var n2 = 0;
	for (i=1; i <= n; i++) {
		cb = eval( 'f.' + fldName + '' + i );
		if (cb) {
			cb.checked = c;
			n2++;
		}
	}
	if (c) {
		document.adminForm.boxchecked.value = n2;
	} else {
		document.adminForm.boxchecked.value = 0;
	}
}

function isChecked(isitchecked){
	if (isitchecked == true){
		document.adminForm.boxchecked.value++;
	}
	else {
		document.adminForm.boxchecked.value--;
	}
}

function submitform(pressbutton){
	document.adminForm.action.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	if (pressbutton == 'del') {
	  if (confirm("Are you sure you want to delete?")) {	
		document.adminForm.submit();
	  }
	}
	else {
		document.adminForm.submit();
	}
}

function writeConsole(imgUrl) {
	url = new Image();
	
	if (!imgUrl) {
		url.src = document.images.bigPicture.src;
		url.src = url.src.replace(/thumbs\/thb_/, "");
	}
	else {
		url.src = imgUrl;
    }
     top.consoleRef=window.open('','Console','width=400,height=400,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1')
     top.consoleRef.document.writeln('<html><head><title>PopWin</title></head><body bgcolor=white onLoad="self.focus()">'
     +'<div align="center"><img src="' + url.src + '"></div></body></html>')
     top.consoleRef.document.close()
}

function updatesum() {
 var total;
 var shiprate;
 var idx;
 
 for (i = 0; i < shipForm.shipmethod.length; i++)
{
		if (shipForm.shipmethod[i].checked) {
		idx = shipForm.shipmethod[i].value; 
 		}
}
 if (idx) {
 	shiprate = idx.split(':');
 	total = Math.round((parseFloat(document.shipForm.totalsum.value) + parseFloat(shiprate[1]))*100)/100;
 	document.shipForm.total.value = '$' + total.toFixed(2);
	return true;
 }
  else {
  	alert("You must select a shipping!");
	return false;
   }
 }
