function checkoptions(which,margin) {
	if( margin && margin != ''){
		ALERT_HEIGHT_MARGIN = margin;
	}
	//ALERT_HEIGHT_MARGIN = "50px";
	var message = "";
	message += "Please select the options for the following:<br>\n";
	var pass=true;
	var comma = "";
	if (document.images) {
		for (i=0;i<which.length;i++) {
			var tempobj=which.elements[i];
			
			if (tempobj.name.substring(0,12)=="reqoptionkit") {
				if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					 
					shortFieldName=tempobj.id;
					message += "<br> &raquo; " + shortFieldName.replace(/_/g," ");
					pass=false;
					comma = ", ";
         			}
     			 } else if (tempobj.name.substring(0,9)=="reqoption") {
				if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					shortFieldName=tempobj.name.substring(9,30);
					message += "<br> &raquo; " + shortFieldName.replace(/_/g," ");
					pass=false;
					comma = ", ";
         			}
     			 }
			if (tempobj.name.substring(0,13)=="requnivoption") {
				if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					shortFieldName=tempobj.name.substring(13,34);
					message += "<br> &raquo; " + shortFieldName.replace(/_/g," ");
					pass=false;
					comma = ", ";
         			}
     			 }
			if (tempobj.name.substring(0,11)=="req_option_") {
				if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					shortFieldName=tempobj.name.substring(11,32);
					message += "<br> &raquo; " + shortFieldName.replace(/_/g," ");
					pass=false;
					comma = ", ";
         			}
     			 }
   		}
	}
	if (!pass) {
		openColorboxHTML(message,500,250);
		return false;
	}
	else
		return true;
}

var whichBrowser = navigator.appName;
var whichVersion = parseFloat(navigator.appVersion);
var isOld;
if(((whichBrowser=='Microsoft Internet Explorer')&(whichVersion>=4)) | ((whichBrowser=='Netscape')&(whichVersion>=5))){
	isOld = 0;
	removeOldBrowserAlert();
} else { 
	isOld = 1;
	
}      
var alreadyWarned = 0;
function getPrice(qty){
	if(isOld){
		return;
	}

	if(!qty){
		var qty = 1;
	}
	var type = "";
	var value = "";
	var baseCost = eval(price);
	var retailCost = eval(retailPrice);
	var totalCost = "";
	for(var $i=0;$i<document.addToCart.length;$i++){
		var tmp = document.addToCart.elements[$i];
		if(tmp.type == "radio" && tmp.checked){
			if(tmp.id != '00.00'){
				value = eval(tmp.id);
				baseCost = baseCost + value;
			}
		} else if (tmp.type.toString().charAt(0)=="s" 
			&& tmp[tmp.selectedIndex].value != 0 
			&& tmp[tmp.selectedIndex].value != ''
			&& tmp.name != "ItemQuantity"){
			value = eval(tmp[tmp.selectedIndex].id);
			baseCost = baseCost + value;
		} else if (tmp.type == "checkbox" && tmp.checked){
			if(tmp.id != '00.00'){
				value = eval(tmp.id);
				baseCost = baseCost + value;
			}
		}
	}
	totalCost = baseCost * qty;
	updateDisplays(baseCost,retailCost,totalCost);
}

function updateDisplays(unitCost,retailCost,totalCost) {
   	var dollars = Math.floor(unitCost);
   	var cents = unitCost - dollars;
   	cents = Math.round(cents*100);
   	if(cents==0){
		cents = ".00";
	} else if(cents<10){
		cents = ".0"+cents;
	} else{
		cents = "."+cents;
	}	
	if(document.getElementById('unitprice')){
		document.getElementById('unitprice').innerHTML = "$"+dollars+cents; 
	}
	if(document.getElementById('unitprice2')){
		document.getElementById('unitprice2').innerHTML = "$"+dollars+cents;
	}
  
   	var dollars = Math.floor(retailCost);
   	var cents = retailCost - dollars;
   	cents = Math.round(cents*100);
   	if(cents==0){
		cents = ".00";
	} else if(cents<10){
		cents = ".0"+cents;
	} else{
		cents = "."+cents;
	}	
	if(document.getElementById('retailprice')){
		document.getElementById('retailprice').innerHTML = "$"+dollars+cents; 
	}
	if(document.getElementById('retailprice2')){
		document.getElementById('retailprice2').innerHTML = "$"+dollars+cents;
	}

	var dollars = Math.floor(totalCost);
   	var cents = totalCost - dollars;
   	cents = Math.round(cents*100);
   	if(cents==0){
		cents = ".00";
	} else if(cents<10){
		cents = ".0"+cents;
	} else{
		cents = "."+cents;
	}
	if(document.getElementById('totalprice')){
   		document.getElementById('totalprice').innerHTML = "$"+dollars+cents; 
	}
	if(document.getElementById('totalprice2')){
   		document.getElementById('totalprice2').innerHTML = "$"+dollars+cents; 
	}
}

function showOldBrowserAlert() {
	var msg = "Display of pricing changes requires Netscape 6.0+ or Internet Explorer 5.0+.\n";
	msg += "The correct price will be displayed after you select your options and add the item to your cart.\n\n";
	msg += "This does not affect your ability to purchase items from our store, \n";
	msg += "so please continue to shop and we apologize for this annoying message.\n\n";
	msg += "If you experience any problems ordering from us, please call us Toll-Free \n";
	msg += "at the number above for assistance with your purchase.  Thank You.";
   	alert(msg);
	alreadyWarned = 1;
}

function removeOldBrowserAlert(){
	if(document.getElementById('browserAlert')){
		document.getElementById('browserAlert').innerHTML = "";
	}
}
/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false


function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip;
