
	var iBBRACMod = 0;
	var iCurrentPage = 0;
	var strAction;
	//pricing control center variables
	var thePCC;
	var PCCtop;
	var PCCstop;
	var IsNetscape = (navigator.appName.indexOf("Netscape") != -1);
	var px = document.layers ? "" : "px";
	var PccLocation = 0;
	
	  function makeWin(url) {
	
	      agent = navigator.userAgent;
	      windowName = "Sitelet";
	      params  = "";
	      params += "toolbar=0,";
	      params += "location=0,";
	      params += "directories=0,";
	      params += "status=0,";
	      params += "menubar=0,";
	      params += "scrollbars=1,";
	      params += "resizable=1,";
	      params += "width=500,";
	      params += "height=350";
	   
		  // close the window to vary the window size
	   	  if (typeof(win) == "object" && !win.closed){
            win.close();
	      }
	   
	      win = window.open(url, windowName , params);
	
	      if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {
	          win = window.open(url, windowName , params);
	      }
	
	      if (!win.opener) {
	          win.opener = window;
	      }
	
  		  // bring the window to the front
		  win.focus();
	  }
	  
	  function makeWin2(url, p_Width, p_Height) {
	
	      agent = navigator.userAgent;
	      windowName = "Sitelet";
	      params  = "";
	      params += "toolbar=0,";
	      params += "location=0,";
	      params += "directories=0,";
	      params += "status=0,";
	      params += "menubar=0,";
	      params += "scrollbars=1,";
	      params += "resizable=1,";
	      params += "top=92,";
	      params += "left=0,";
	      if (p_Width == "null") {
			params += "width=500,";
	        params += "height=350";
	      }
		  else {
			params += "width=" + p_Width+ ",";
	        params += "height=" + p_Height;
	      }

		  // close the window to vary the window size
	   	  if (typeof(win) == "object" && !win.closed){
            win.close();
	      }
	   
	      win = window.open(url, windowName , params);

	      if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {
	          win = window.open(url, windowName , params);
	      }
	
	      if (!win.opener) {
	          win.opener = window;
	      }
	
		  // bring the window to the front
		  win.focus();	
	  }
	  


	function OpenDetailsPop(sName, sOrderCode, bNoCaching){
	      agent = navigator.userAgent;
	      windowName = "Sitelet";
	
	      params  = "";
	      params += "toolbar=0,";
	      params += "location=0,";
	      params += "directories=0,";
	      params += "status=0,";
	      params += "menubar=0,";
	      params += "scrollbars=1,";
	      params += "resizable=1,";
	      params += "width=560,";
	      params += "height=350";
	   
		  // close the window to vary the window size
	      if (typeof(win) == "object" && !win.closed){
            		win.close();
	      }
    		if (bNoCaching == true)
			win = window.open('details_popup.aspx?name=' + sName + '&oc=' + sOrderCode + '&nc=true', windowName , params);

      		else
			win = window.open('details_popup.aspx?name=' + sName + '&oc=' + sOrderCode , windowName , params);

  	      if (agent.indexOf('Mozilla/2') != -1 && agent.indexOf('Win') == -1) 
	      {
				if (bNoCaching == true)
					win = window.open('details_popup.aspx?name=' + sName + '&oc=' + sOrderCode + '&nc=true', windowName , params);
				else
					win = window.open('details_popup.aspx?name=' + sName + '&oc=' + sOrderCode, windowName , params);
	      }

	
	      if (!win.opener) {
	          win.opener = window;
	      }
	
  		  // bring the window to the front
		  win.focus();
	  
	  }


	  //use for posting to the lead time shipping date details page
	  function OpenPostedDetailsPop(url, p_Width, p_Height, bNoCaching){
	      agent = navigator.userAgent;
	      windowName = "ShipDateDetails";
	
	      params  = "";
	      params += "toolbar=0,";
	      params += "location=0,";
	      params += "directories=0,";
	      params += "status=0,";
	      params += "menubar=0,";
	      params += "scrollbars=1,";
	      params += "resizable=1,";
	      params += "top=92,";
	      params += "left=0,";
	      if (p_Width == "null") {
			params += "width=500,";
	        params += "height=350";
	      }
		  else {
			params += "width=" + p_Width+ ",";
	        params += "height=" + p_Height;
	      }
	   
		  // close the window to vary the window size
	   	  if (typeof(win) == "object" && !win.closed){
            win.close();
	      }
		  
		 // document.CONFIG_FORM.topoll.value = 'shipdate_details_popup.aspx';
		  
		  document.CONFIG_FORM.target = windowName;		  
		  
		  if (bNoCaching == true)
			win = window.open(url + '&nc=true', windowName , params);
		  else
			win = window.open(url, windowName , params);

	      if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {

		  if (bNoCaching == true)
			win = window.open(url + '&nc=true', windowName , params);
		  else
			win = window.open(url, windowName , params);
	      }
	
	      if (!win.opener) {
	          win.opener = window;
	      }
			  
		  //previous action url
//		  PrevURL = document.CONFIG_FORM.action;

		  document.CONFIG_FORM.action = url;
		  document.CONFIG_FORM.submit();

//		  document.CONFIG_FORM.action = PrevURL;


  		  // bring the window to the front
		  win.focus();
	  }	  

	  function update_price(iCurrPage, sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'update_price_top';
		document.CONFIG_FORM.pageseq.value = iCurrPage;
		document.CONFIG_FORM.y_offset.value = document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		document.CONFIG_FORM.expand_list.value = getExpandedModules();
		document.CONFIG_FORM.submit();	
				
	  }

	  function upgrade_selection_update_price(iCurrPage, sQuerystring, mod, opt)
	  {
		getAnElement(mod).value = opt;
		var elUpsell = document.createElement('input');
		elUpsell.name = 'upsell_item';
		elUpsell.value = mod + '@' + opt;
		elUpsell.type = "hidden";
		document.CONFIG_FORM.appendChild(elUpsell);
		var upsoldList = getAnElement("upsold_list");
		if (upsoldList.value.length > 0)
			upsoldList.value += "," + mod.substr(2);
		else
			upsoldList.value = mod.substr(2);
		update_price(iCurrPage, sQuerystring);
      }
      
	  function add_selection_update_price(iCurrPage, sQuerystring, mod, opt)
	  {
		var elMod = document.createElement('input');
		elMod.name = mod;
		elMod.value = opt;
		elMod.type = "hidden";
		document.CONFIG_FORM.appendChild(elMod);
		var elUpsell = document.createElement('input');
		elUpsell.name = 'upsell_item';
		elUpsell.value = mod + '@' + opt;
		elUpsell.type = "hidden";
		document.CONFIG_FORM.appendChild(elUpsell);
		var upsoldList = getAnElement("upsold_list");
		if (upsoldList.value.length > 0)
			upsoldList.value += "," + mod.substr(2);
		else
			upsoldList.value = mod.substr(2);
		update_price(iCurrPage, sQuerystring);
      }
      
	function go_collapse(display, childName)
	{
		child = document.getElementById(display+childName);
		if (document.all)
			child.style.display = 'none';
			
		child.style.visibility = 'hidden';
		child.style.position = 'absolute';
	}

	  function update_composite_config(iCurrPage, sQuerystring, parent, parentName, childName)
	  {
		var child1, child2;
		var img, img_out;
		var sel;
		var show_selections, hide_selections;
		var href_obj;

		//content under the opt (first Show Selections)
		child1 = document.getElementById("display1_"+childName);
		//content after the first Show Selections
		child2 = document.getElementById("display2_"+childName);
		//image next to the Hide Selections text
		img = document.getElementsByName("img_"+childName)[0];
		//image next to the radio button/checkboxes
		img_out = document.getElementsByName("img_out_"+childName)[0];
		//Show Selections/Hide Selections text
		sel = document.getElementById("sel_"+childName);
		href_obj = document.getElementById("href_"+childName);

		//show selections text
		show_selections = document.CONFIG_FORM.show_selections.value;
		//hide selections text
		hide_selections = document.CONFIG_FORM.hide_selections.value

		//post the form only when the submods are selected for the first time
		if (parent.checked)
		{
			//open up the already rendered data	
			if (child1 != null && child2 != null)
			{
				//close out other single select options first
				if (parent.type=="radio")
					close_composite_config(parentName);
					
				img.src = img.src.replace("selected_closed.gif","selected_open.gif");
				img_out.src = img.src.replace("unselected.gif","selected_open.gif");
				
				sel.innerHTML = sel.innerHTML.replace(show_selections, hide_selections);
				
				href_obj.onmouseover = function(){return false;};
				href_obj.style.cursor = "hand";
				
				if (document.all)
				{
					child1.style.display = 'block';
					child2.style.display = 'block';
				}

				child1.style.position = 'relative';
				child2.style.position = 'relative';	
				child1.style.visibility = 'visible';
				child2.style.visibility = 'visible';				

			}
			else
			{
				//only do this if it's IE4+ or NS6+
				if (document.all || document.getElementById)
				{
					var parentpos = GetAbsPosition(parent);

					//document.CONFIG_FORM.x_offset.value = parentpos.x;
					document.CONFIG_FORM.y_offset.value = parentpos.y-200;
				}
				else
				{
					document.CONFIG_FORM.current_action.value = childName;
				}
				
				document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
				document.CONFIG_FORM.target = window.name;
				document.CONFIG_FORM.pageseq.value = iCurrPage;
				var modoptshow = document.getElementById("modoptshow_" + parent.id.substr(2));
				if (modoptshow)
					modoptshow.value="1";
				document.CONFIG_FORM.expand_list.value = getExpandedModules();
				document.CONFIG_FORM.submit();
			}
		}
		//close up the already rendered data
		else
		{
			img_out.src = img_out.src.replace("selected_open.gif","unselected.gif");
			img_out.src = img_out.src.replace("selected_closed.gif","unselected.gif");
			
			href_obj.onmouseover = function(){window.status='';return true;};
			href_obj.style.cursor = "default";
			
			if (document.all)
			{
				child1.style.display = 'none';
				child2.style.display = 'none';
			}

			child1.style.visibility = 'hidden';
			child2.style.visibility = 'hidden';
			child1.style.position = 'absolute';
			child2.style.position = 'absolute';
		}
	  }
	  
	  function GetAbsPosition(object) {
			var position = new Object;
			position.x = 0;
			position.y = 0;

			if( object ) 
			{
				position.x = object.offsetLeft;
				position.y = object.offsetTop;

				if( object.offsetParent ) 
				{
					var parentpos = GetAbsPosition(object.offsetParent);
					position.x += parentpos.x;
					position.y += parentpos.y;
				}
			}

			return position;
	  }
	  
	  function close_composite_config(sModName)
	  {
			var theElement;
			var childName;
			var iIndex;
			var parentName;
			var option

			theElement = document.getElementsByName("list_" + sModName)[0];
			list = theElement.value.split(",");
			
			for (var i = 0; i < list.length; i++) 
			{
				sOptName = list[i];

				sName = sModName +  "@" + sOptName;
				option = document.getElementsByName(sName)[0];
				if (option != null && !option.checked)
				{
					child1 = document.getElementById("display1_"+sName);
					//content after the first Show Selections
					child2 = document.getElementById("display2_"+sName);
					//image next to the radio button/checkboxes
					img_out = document.getElementsByName("img_out_"+sName)[0];
					href_obj = document.getElementById("href_"+sName);

					if (child1 != null && child2 != null)
					{
						img_out.src = img_out.src.replace("selected_open.gif","unselected.gif");
						img_out.src = img_out.src.replace("selected_closed.gif","unselected.gif");
						
						href_obj.onmouseover = function(){window.status='';return true;};
						href_obj.style.cursor = "default";				

						if (document.all)
						{
							child1.style.display = 'none';
							child2.style.display = 'none';
						}

						child1.style.visibility = 'hidden';
						child2.style.visibility = 'hidden';
						child1.style.position = 'absolute';
						child2.style.position = 'absolute';
					}
				}
			}
	  }
	  

	function show_hide(parentName, childValue, childName, isDisabled, isBottom) 
	{
		var child;
		var img;
		var img_out;
		var sel;
		var elements;
		var show_selections;
		var hide_selections;


		//content after the first Show Selections
		child = document.getElementById("display2_"+childName);
		//image next to the Hide Selections text
		img = document.getElementsByName("img_"+childName)[0];
		//image next to the radio button/checkboxes
		img_out = document.getElementsByName("img_out_"+childName)[0];
		//Show Selections/Hide Selections text
		sel = document.getElementById("sel_"+childName);
		//all elements for the particular module
		if (isDisabled == "True")
			elements = document.getElementsByName("DisOpt_"+ parentName);
		else
			elements = document.getElementsByName(parentName);
							
		//show selections text
		show_selections = document.CONFIG_FORM.show_selections.value;
		//hide selections text
		hide_selections = document.CONFIG_FORM.hide_selections.value

		if (isDisabled == "True")
		{
			if (child != null)
			{
				if ((document.all && child.style.display == "none") || (!document.all && child.style.visibility == "hidden"))
				{
					document.getElementsByName("expanded_"+childName)[0].value = "yes";
					img.src = img.src.replace("selected_closed.gif","selected_open.gif");
					img_out.src = img_out.src.replace("selected_closed.gif","selected_open.gif");
					sel.innerHTML = sel.innerHTML.replace(show_selections, hide_selections);
					
					if (document.all)
						child.style.display = "block";

					child.style.visibility = "visible";
					child.style.position = 'relative';
				}
				else
				{
					document.getElementsByName("expanded_"+childName)[0].value = "no";
					img.src = img.src.replace("selected_open.gif","selected_closed.gif");
					img_out.src = img_out.src.replace("selected_open.gif","selected_closed.gif");
					sel.innerHTML = sel.innerHTML.replace(hide_selections, show_selections);
					if (document.all)
						child.style.display = "none";

					child.style.visibility = "hidden";
					child.style.position = 'absolute';

					if (isBottom == "true")
					{
						//only do this if it's IE4+ or NS6+
						if (document.all || document.getElementById)
						{
							var parentpos = GetAbsPosition(child);										
							//go_to(parentpos.x, parentpos.y-200);
							go_to(parentpos.y-200);
						}
						else
						{
							window.location.hash = childName;
						}
					}
				}
			}
		}
		else
		{
			for (var i = 0; i < elements.length; i++) 
			{
				theElement = elements[i];
				
				if (theElement.value == childValue)
				{
					//don't do anything unless the option is selected
					if(theElement.checked)
					{
						if (child != null)
						{
							if ((document.all && child.style.display == "none") || (!document.all && child.style.visibility == "hidden"))
							{
								document.getElementsByName("expanded_"+childName)[0].value = "yes";
								img.src = img.src.replace("selected_closed.gif","selected_open.gif");
								img_out.src = img_out.src.replace("selected_closed.gif","selected_open.gif");
								sel.innerHTML = sel.innerHTML.replace(show_selections, hide_selections);
								
								if (document.all)
									child.style.display = "block";

								child.style.visibility = "visible";
								child.style.position = 'relative';
							}
							else
							{
								document.getElementsByName("expanded_"+childName)[0].value = "no";

								img.src = img.src.replace("selected_open.gif","selected_closed.gif");
								img_out.src = img_out.src.replace("selected_open.gif","selected_closed.gif");
								sel.innerHTML = sel.innerHTML.replace(hide_selections, show_selections);
								if (document.all)
									child.style.display = "none";

								child.style.visibility = "hidden";
								child.style.position = 'absolute';
								
								if (isBottom == "true")
								{
									//only do this if it's IE4+ or NS6+
									if (document.all || document.getElementById)
									{
										var parentpos = GetAbsPosition(child);
										//go_to(parentpos.x, parentpos.y-200);
										go_to(parentpos.y-200);
									}
									else
									{
										window.location.hash = childName;
									}
								}
							}
						}	
					}
				}
			}
		}
	}

	  function scroll_to(location)
	  {
		document.CONFIG_FORM.target = window.name;

		window.location.hash = location;
	  }
	  
	  function go_to(y_pos)
	  {
		document.CONFIG_FORM.target = window.name;

		window.scrollTo(0, y_pos)		
	  }


	  function cart_add(sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'cart_add';
		document.CONFIG_FORM.submit();				
	  }


	  function cart_add_override(sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action_params.value = 'overrideCart';
		document.CONFIG_FORM.current_action.value = 'cart_add';
		document.CONFIG_FORM.submit();					
	  }


	  function wishlist_add(sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'wishlist_add';
		document.CONFIG_FORM.submit();				
	  }
	  
	  function wishlist_add_override(sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action_params.value = 'overrideWishList';
		document.CONFIG_FORM.current_action.value = 'wishlist_add';
		document.CONFIG_FORM.submit();					
	  }



	  function print_view(iCurrPage, sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'print_view';
		document.CONFIG_FORM.prev_pageseq.value = iCurrPage;
		//printfax value
		document.CONFIG_FORM.pageseq.value = 100;
		document.CONFIG_FORM.submit();		
	  }

	  function next_page(iCurrPage, sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'next';
		document.CONFIG_FORM.pageseq.value = parseInt(iCurrPage) + 1;
		document.CONFIG_FORM.expand_list.value = getExpandedModules();
		document.CONFIG_FORM.submit();		
	  }
	  
	  //going from non-print-summary pages to the previous page
 	  function prev_page(iCurrPage, sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'prev';
		document.CONFIG_FORM.pageseq.value = parseInt(iCurrPage) - 1;
		document.CONFIG_FORM.expand_list.value = getExpandedModules();
		document.CONFIG_FORM.submit();
	  }	 


	  //going from print summary to the previous page 
 	  function back_page(iPrevPage, sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'back_page';
		document.CONFIG_FORM.pageseq.value = iPrevPage;
		document.CONFIG_FORM.expand_list.value = getExpandedModules();
		document.CONFIG_FORM.submit();
	  }	 
	  
	  //going from pages that don't have compatibility issues to the first page with compatibility issues 
 	  function compat_page(iMinConfigLogicPage, sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring + "#logicerror";
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.pageseq.value = iMinConfigLogicPage;
		document.CONFIG_FORM.expand_list.value = getExpandedModules();
		document.CONFIG_FORM.submit();
	  }

	  //going from any page to the any page
 	  function to_page(iToPage, sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'next';
		document.CONFIG_FORM.pageseq.value = iToPage;
		document.CONFIG_FORM.expand_list.value = getExpandedModules();
		document.CONFIG_FORM.submit();
	  }	
	  
	  //going from review page to any page, and scroll to a particular mod
 	  function to_page_mod(iToPage, iToMod, sQuerystring)
	  {
		document.CONFIG_FORM.action = "config.aspx?" + sQuerystring;
		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'review';
		document.CONFIG_FORM.scroll_to_mod.value = iToMod;
		document.CONFIG_FORM.pageseq.value = iToPage;
		document.CONFIG_FORM.expand_list.value = getExpandedModules();
		document.CONFIG_FORM.submit();
	  }	

	  //Content functions
	  function goPopUp(sUrl){
		agent = navigator.userAgent;
		windowName = "LearnAbt";
 
		params  = "";
		params += "toolbar=0,";
		params += "location=0,";
		params += "directories=0,";
		params += "status=0,";
		params += "menubar=0,";
		params += "scrollbars=1,";
		params += "resizable=1,";
		params += "width=600,";
		params += "height=500";
		 
		 
		win = window.open(sUrl, windowName , params);
 
		if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {
		    win = window.open(sUrl, windowName , params);
		}
 
		  // bring the window to the front
		win.focus();
	}
  
	function winopen(url,stuff,morestuff) {
		window.open(url,stuff,morestuff).focus();
	} 

	function OpenBBRACPopup(url, segment, buid, customer_set_id, mod_id, alert_blurb, numeric_blurb, zip_blurb, current_page, submit_action)
	{
		if (!BBRACValidateField(document.CONFIG_FORM.BBRACPhoneAreaCode, alert_blurb))
			return;			
		if (!BBRACValidateField(document.CONFIG_FORM.BBRACPhonePrefix, alert_blurb))
			return;
		if (!BBRACValidateField(document.CONFIG_FORM.BBRACPhoneNumber, alert_blurb))
			return;
		if (!BBRACValidateField(document.CONFIG_FORM.BBRACStreet, alert_blurb))
			return;
		if (!BBRACValidateField(document.CONFIG_FORM.BBRACZip, alert_blurb))
			return;
		   
		if (!ValidateNumber(document.CONFIG_FORM.BBRACPhoneAreaCode, 3, numeric_blurb))
			return;
		if (!ValidateNumber(document.CONFIG_FORM.BBRACPhonePrefix, 3, numeric_blurb))
			return;
		if (!ValidateNumber(document.CONFIG_FORM.BBRACPhoneNumber, 4, numeric_blurb))
			return;

		if (!ValidateZip(zip_blurb))
			return;

		fullurl = url + "?phoneAreaCode="+document.CONFIG_FORM.BBRACPhoneAreaCode.value;
		fullurl +="&phonePrefix=" + document.CONFIG_FORM.BBRACPhonePrefix.value;
		fullurl +="&phoneNumber=" + document.CONFIG_FORM.BBRACPhoneNumber.value;
		fullurl +="&street="+escape(document.CONFIG_FORM.BBRACStreet.value);
		fullurl +="&zip="+document.CONFIG_FORM.BBRACZip.value;
		fullurl +="&accesstype="+document.CONFIG_FORM.BBRACAccessType.value;
		fullurl +="&segment="+segment+"&buid="+buid+"&cs="+customer_set_id;

		iBBRACMod = mod_id;
		iCurrentPage = current_page;
		strAction = submit_action;
		document.domain = "shiplaser.com";
		makeWin2(fullurl , 800, 500);

	}
	function OpenBBRACChangeLocation(url, mod_id, current_page, submit_action)
	{

		iBBRACMod = mod_id;
		iCurrentPage = current_page;
		strAction = submit_action;
		document.domain = "shiplaser.com";
		makeWin2(url , 800, 500);

	}
	function BBRACValidateField(field, alert_blurb)
	{
		if (field.value.length == 0)
			{
				alert(alert_blurb);
				field.focus();
				return false;
			}
		else
			return true;
	}

	function ValidateZip(alert_blurb)
	{
		theZipField = document.CONFIG_FORM.BBRACZip;
		theZip = theZipField.value;
		if (theZip.length < 5)
			{
				alert(alert_blurb);
				theZipField.focus();
				return false;
			}
		else if (theZip.length == 5)
			{
				if (!ValidateNumber(theZipField, 5, alert_blurb))
					return false;
			}
		else if (theZip.length != 10)
			{
				alert(alert_blurb);
				theZipField.focus();
				return false;
			}
		else
			{
				if (!ValidateNumber2(theZip, 0, 5) || !ValidateNumber2(theZip, 6, 4) || theZip.charAt(5) != "-")
				{
					alert(alert_blurb);
					theZipField.focus();
					return false;
				}
			}
		return true;
	}

	function ValidateNumber(field, minLength, alert_blurb)
	{	
		theNumber = field.value;
		if (theNumber.length < minLength)
			{
				alert(alert_blurb);
				field.focus();
				return false;
			}
		else
			for (i = 0; i < theNumber.length; i++)
			{
				if (!isDigit(theNumber.charAt(i)))
				{
					alert(alert_blurb);
					field.focus();
					return false;
				}
			}
			
		return true;
	}

	function ValidateNumber2(value, beginLoc, endLoc)
	{	
		for (i = beginLoc; i < endLoc; i++)
		{
			if (!isDigit(value.charAt(i)))
			{
				return false;
			}
		}
			
		return true;
	}

	// Returns true if character is a digit 
	// (0 .. 9).
	function isDigit(character)
	{
		return ((character >= "0") && (character <= "9"))
	}

	function BBRACSelected(phoneAreaCode, phonePrefix, phoneNumber, street, city, state, zip, zipid, skuVendor, skuService, skuCarrier, selectionDescription, 
				trackingGuid, planId, servicesData, wireCenterId, accessType, serviceTag)
	{
		document.CONFIG_FORM.BBRACPhoneAreaCode.value = phoneAreaCode;
		document.CONFIG_FORM.BBRACPhonePrefix.value = phonePrefix;
		document.CONFIG_FORM.BBRACPhoneNumber.value = phoneNumber;
		document.CONFIG_FORM.BBRACStreet.value = street;
		document.CONFIG_FORM.BBRACCity.value = city;
		document.CONFIG_FORM.BBRACState.value = state;
		document.CONFIG_FORM.BBRACZip.value = zip;
		document.CONFIG_FORM.BBRACZipId.value = zipid;
		document.CONFIG_FORM.BBRACAccessType.value = accessType;
		document.CONFIG_FORM.BBRACSkuVendor.value = skuVendor;
		document.CONFIG_FORM.BBRACSkuService.value = skuService;
		document.CONFIG_FORM.BBRACSkuCarrier.value = skuCarrier;
		document.CONFIG_FORM.BBRACSelectionDescription.value = selectionDescription;
		document.CONFIG_FORM.BBRACTrackingGuid.value = trackingGuid;
		document.CONFIG_FORM.BBRACPlanId.value = planId;
		document.CONFIG_FORM.BBRACServicesData.value = servicesData;
		document.CONFIG_FORM.BBRACWireCenterId.value = wireCenterId;

		document.CONFIG_FORM.target = window.name;
		document.CONFIG_FORM.current_action.value = 'update_price_bbrac';
		document.CONFIG_FORM.scroll_to_mod.value = iBBRACMod;
		document.CONFIG_FORM["bb_" + iBBRACMod].value = "Selected";
		update_price(iCurrentPage, strAction);	

	}

	function BBRACCheckFieldFull(currField, nextField)
	{
		if (currField.value.length == currField.maxLength)
			nextField.focus();
	}
	
	function checkSelect(module, table, select)
	{
		var aDiv = getAnElement("module_options_" + module);
		if (select)
		{
			getAnElement("mod_selector_left_" + module).src = "graphics/bevel_selected.gif";
			getAnElement("mod_selector_middle_" + module).className = "Mod_Selector_cell_middle_selected";
			if (aDiv.className == "option_display_visible") //currently expanded
			{
				getAnElement("mod_selector_right_" + module).src = "graphics/collapse_selected.gif";
			}
			else
			{
				getAnElement("mod_selector_right_" + module).src = "graphics/expand_selected.gif";
			}
		}
		else
		{
			getAnElement("mod_selector_left_" + module).src = "graphics/bevel_notselected.gif";
			getAnElement("mod_selector_middle_" + module).className = "Mod_Selector_cell_middle_notselected";
			if (aDiv.className == "option_display_visible") //currently expanded
			{
				getAnElement("mod_selector_right_" + module).src = "graphics/collapse_notselected.gif";
			}
			else
			{
				getAnElement("mod_selector_right_" + module).src = "graphics/expand_notselected.gif";
			}
		}
		
	}
	
	function toggleOptionDisplay(module, table){
		var aDiv = getAnElement("module_options_" + module);
		var expandImage = getAnElement("expand_module_image_" + module);

		if(aDiv.className == "option_display_visible"){
			aDiv.className="option_display_none";
			getAnElement("modoptshow_" + module).value="0";
			setOptionDisplay(table, module, false);
		}
		else
		{
			aDiv.className="option_display_visible";
			getAnElement("modoptshow_" + module).value="1";
			setOptionDisplay(table, module, true);
		}
	}
	function setOptionDisplay(table, module, isopen)
	{
		//table.className="Mod_Selector_table_selected";
		getAnElement("mod_selector_left_" + module).src = "graphics/bevel_selected.gif";
		getAnElement("mod_selector_middle_" + module).className = "Mod_Selector_cell_middle_selected";
		if (isopen)
			getAnElement("mod_selector_right_" + module).src = "graphics/collapse_selected.gif";
		else
			getAnElement("mod_selector_right_" + module).src = "graphics/expand_selected.gif";
}
	
	function setPCCStart(startY)
	{
		var startX = 750;
		
		thePCC=getAnElement("divPCC");
		PCCtop=getAnElement("topBar");
		VMessages = getAnElement("val-error-window");
		if (VMessages)
			InitializeVMessageHeight();
		PCCstop = getAnElement("bottomBar").offsetTop - thePCC.offsetHeight - 30;

		if(document.layers)thePCC.style=thePCC;
		thePCC.style.left = startX + px;
		thePCC.x = startX; thePCC.y = startY;

		setPCC();
	}
	function setPCC()
	{
		var pY = (IsNetscape ? window.pageYOffset : (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop) + 15;
		if (PccLocation == pY)
		{
			if(thePCC.y > PCCstop)thePCC.y = PCCstop;
			else
			{
				var dY = (pY > PCCtop.offsetTop) ? pY : PCCtop.offsetTop;
				thePCC.y += (dY - thePCC.y);
				thePCC.style.top=thePCC.y + px;
				if (VMessages)
				{
					if (VMessages.y)
						VMessages.style.top = thePCC.y + VMessages.y +  px;				
					else 
						VMessages.style.top = thePCC.y + px;
				}
			}
		}
		
		PccLocation = pY;
		
		setTimeout("setPCC()", 250);
	}
	
	
	function InitializeVMessageHeight()
	{
		var valText = getAnElement('val-text');
		var tHeight = parseInt(valText.offsetHeight);
		if (tHeight > 192)
		{
			valText.style.height='192px';
			tHeight = 202;
		}
		VMessages.startHeight = (tHeight + 20) 
		VMessages.style.height= VMessages.startHeight + 'px';
		if (document.CONFIG_FORM.val_module.value != '')
		{
			if (document.CONFIG_FORM.val_module.value.substr(0,4) == 'c_m_')
				
				valmodlink_comp(document.CONFIG_FORM.val_module.value,0);
			else
				valmodlink(document.CONFIG_FORM.val_module.value,0);
			document.CONFIG_FORM.val_module.value = '';
		}				
	}
	
		function CloseValErrors()
		{
			var lTarget = thePCC.offsetLeft;
			var left = parseInt(VMessages.style.left);
			var width = parseInt(VMessages.style.width);
			if (! (VMessages.y))
				VMessages.y=0;
			if (left < lTarget || VMessages.y < thePCC.offsetHeight )
			{
				if (left < lTarget)
				{
					var ldiff = lTarget - left;
					if (ldiff > 100)
						VMessages.style.left = (left + 25) + px;
					else if (ldiff > 80)
						VMessages.style.left = (left + 6) + px;

					else if (ldiff > 20)
						VMessages.style.left = (left + 4) + px;				
					else 
						VMessages.style.left = (left + 1) + px;				
				}
				if (VMessages.y < thePCC.offsetHeight)
					if (VMessages.y < thePCC.offsetHeight - 100)
						VMessages.y += 20;
					else if (VMessages.y < thePCC.offsetHeight - 80)
						VMessages.y += 10;
					else if (VMessages.y < thePCC.offsetHeight - 60)
						VMessages.y += 6;
					else 
						VMessages.y += 2;
				VMessages.style.top = thePCC.y + VMessages.y +  px;				

			}
			else 
			{
				VMessages.docked = true;
				VMessages.docking = false;
				clearInterval(VMessages.interval);
			}
			
		}
		function valmodlink_comp(sLink,pageSeq)
		{
			var ModRow = getAnElement(sLink);			
			if (ModRow)
			{

				var location = GetAbsPosition(ModRow);
				if (location)
				{
					window.scrollTo(0,location.y - VMessages.startHeight - 40 );
				}
			}
			else if(pageSeq != 0 && pageSeq != document.CONFIG_FORM.pageseq.value)
			{
				document.CONFIG_FORM.val_module.value = sLink;
				to_page(pageSeq, document.CONFIG_FORM.current_qs.value);				
			}

		}
		
		
		 
		function valmodlink(modId,pageSeq)
		{
			var ModRow = getAnElement('mh_' + modId);			
			if (ModRow)
			{
				var location = GetAbsPosition(ModRow);
				if (location)
				{
					window.scrollTo(0,location.y - VMessages.startHeight - 40 );
				}
			}
			else if(pageSeq != 0 && pageSeq != document.CONFIG_FORM.pageseq.value)
			{
				document.CONFIG_FORM.val_module.value = modId;
				to_page(pageSeq, document.CONFIG_FORM.current_qs.value);				
			}
		}
		
		function ShowHidValErrors()
		{
			if (VMessages.docking)
				return;
			if (VMessages.docked)
				ShowValErrors();
			else
				HideValErrors();
		}

		function HideValErrors()
		{
			VMessages.docking = true;
			var closebox = getAnElement('val-closebox');
			var textbox = getAnElement('val-text');
			var	img = getAnElement('val-hid-close-img');
			//here we are
			img.src = img.src.replace('CloseWarning','OpenWarning');
			// closebox.style.visibility = 'hidden';
			textbox.style.visibility = 'hidden';
			// shrink it down to a button
			textbox.style.width = '0px';
			VMessages.style.left = '30px';
			VMessages.style.width = (thePCC.offsetWidth - 6) + 'px';
			closebox.style.left = (thePCC.offsetWidth - 30) + 'px';
			VMessages.style.height='15px';
			// start moving it to the right and down while shrinking
			VMessages.interval = setInterval('CloseValErrors()',20);
		}
		
		function ShowValErrors(ShowValErrors)
		{
			if (VMessages.docked)
			{
				var	img = getAnElement('val-hid-close-img');
				img.src = img.src.replace('OpenWarning','CloseWarning');
				VMessages.y=0;
				VMessages.docked = false;
				var closebox = getAnElement('val-closebox');
				var textbox = getAnElement('val-text');
				VMessages.style.textAlign = 'left';
				VMessages.style.textAlign = 'left';
				VMessages.style.width = '710px';
				VMessages.style.height= VMessages.startHeight + 'px';
				VMessages.style.left='20px';
				VMessages.style.top = thePCC.y + px;
				VMessages.style.visibility = 'visible';
				closebox.style.left='684px';
				closebox.style.visibility = 'visible';
				textbox.style.width = '690px';
				textbox.style.visibility = 'visible';
			}
		}
		

	function getAnElement(id)
	{
		return document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
	}

function getExpandedModules()
{
	var div;
	var id;
	var list ;
	var els = document.CONFIG_FORM.elements;
	for(var x=0;x<els.length;x++)
	{
		if (els[x].id.substr(0,11) == "modoptshow_")
		{
			id = els[x].id.substr(11);
			//alert("checking " + id + "value = " + els[x].value);
			if (els[x].value=="1")
			{
			div = getAnElement("module_options_" + id)
			if (div && (div.style.display=="inline" || div.className == "option_display_visible"))
				if (list)
					list += "," + id;
				else
					list = id;
					}
		}
	}
	if (list)
		return list;
	else
		return "";
}

