
	//function to copy shipping to billing fields
	function copyToShipping(){
		var flag = document.cartform.f_bill_sameasshipping.checked;
		var form = document.cartform;
		var i = 0;
		while(i < copyToShipping.arguments.length) {
		  if(flag){
			if(copyToShipping.arguments[i] == "state")
			  eval("document.cartform.f_bill_"+copyToShipping.arguments[i]+".selectedIndex = document.forms[0].f_ship_"+copyToShipping.arguments[i]+".selectedIndex");
			else
			  eval("document.cartform.f_bill_"+copyToShipping.arguments[i]+".value = document.forms[0].f_ship_"+copyToShipping.arguments[i]+".value");
			
		  }else{
			if(copyToShipping.arguments[i] == "state")
				eval("document.cartform.f_bill_"+copyToShipping.arguments[i]+".selectedIndex = 0");
			else
				eval("document.cartform.f_bill_"+copyToShipping.arguments[i]+".value = ''");
		  }
		  i++;
		}
	}
	
	//navigate through shopping cart process
	function stepto(step){
		document.forms['cartform'].action = "checkout.asp"
		document.forms['cartform'].step.value = step;
		document.forms['cartform'].submit();
		return false;
	}
	
	//function to submit the final process
	var theForm;
	var requestSubmitted = false; 

	function disableButton(btn,form,url) {
		if (!requestSubmitted){
			var submitMessage = "  PLEASE WAIT...  ";
			btn.value = submitMessage;
			theForm = form;
			theForm.action = url
			btn.disabled = true;
			requestSubmitted = true;
			setTimeout("submitIt()", 250);
		} else {
			return false;
		}
	}
	
	//submit the form
	function submitIt() {
		theForm.submit();
		return false;
	}

	function session_win(url) {
		window.open(url,"info_shopping_cart","height=460,width=430,toolbar=no,statusbar=no,scrollbars=yes").focus();
		return false;
	}

	function cvv_win(url) {
		var thewin = window.open(url,"cvv","height=400,width=500,toolbar=no,statusbar=no,scrollbars=yes");
		thewin.focus();
		return false;
	}

	function terms_win(url) {
		var w = 500;
		var h = 500;
		var posLeft = Math.floor( (screen.width - w) / 2);
		var posTop = Math.floor( (screen.height - h) / 2);
		var thewin = window.open(url,"TermsAndConditions","height="+h+",width="+w+",toolbar=no,statusbar=no,scrollbars=yes,left="+posLeft+",top="+posTop);
		thewin.focus();
		return false;
	}


document.getElementsByClassName = function(className) {
  var children = document.getElementsByTagName('*') || document.all;
  var elements = new Array();
  
  for (var i = 0; i < children.length; i++) {
    var child = children[i];
    var classNames = child.className.split(' ');
    for (var j = 0; j < classNames.length; j++) {
      if (classNames[j] == className) {
        elements.push(child);
        break;
      }
    }
  }
  return elements;
}

//popup window for Inogen One Details
function InogenOneDetailsWindow(pageTitle,pageLoc,pageWidth,pageHeight) {
	var loc = self.location;
	window.open(pageLoc+"?url="+ escape(loc) +"&pagetitle="+escape(pageTitle), "infoWindow", "width="+pageWidth+",height="+pageHeight);
}
