// JavaScript Document

// checks the values of the one or two dropdown and submits the order
function checkorder()
{
	var base;
	var handsets;
	var offers = "";
	var quantities = "";

	// this should always exist but just in case
	if (document.order.telephone != null )
	{
		base = document.order.telephone.value;
		offers = productID;
		quantities = base;

		// checks if there is an additional product
		// it doesn't append the information because that is done later
		if (document.order.handsets != null )
		{
			offers = offers + ",";
			quantities = quantities + ",";
		}
	}
	else
		base = 0;

	// this won't always exist
	if (document.order.handsets != null )
	{
		handsets = document.order.handsets.value;
		offers = offers + additionalID;
		quantities = quantities + handsets;
	}
	else
		handsets = 0;


	// if nothing is selected in the quantities' dropdowns
	if (quantities == "0,0" || quantities == "0") {
		alert("Please select the quantity you would like to order.");
		return false;

	} else {
		// creates the ordering URL
//		var stURL = "http://cpdev03.uswc.uswest.com:8003/iot/LocalServices.do?offerId="+offers+"&quantity="+quantities;
		var stURL = "https://iot.qwest.com/iot/LocalServices.do?offerId="+offers+"&quantity="+quantities;
		document.location = stURL;
	}
}

// leave these three functions in, they update the left navigation
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function jbe_page_location(objName) {
	MM_changeProp(objName,'','style.color','#B44800','A');
	MM_changeProp(objName,'','style.fontWeight','bold','A');
	MM_changeProp(objName+'A','','style.visibility','visible','DIV');
}
