profiles = new Array(
	"Design Your Own Mobile Phone|design your own mobile phone. A six-step design process|http://www.my40acres.com/coolmo/pub/html/designpho.html",
	"Cool Available Mobile Service Plans|four service plans Coolest Beamer White Hot Economy|http://www.my40acres.com/coolmo/pub/html/availplans.html",
	"See Handset Models|Motorola Sony Ericsson Nokia|http://www.my40acres.com/coolmo/pub/html/handset.html",
	"See Available Designs|Colleges Politics Yale Harvard Princeton Cornell Georgetown|http://www.my40acres.com/coolmo/pub/html/availdes.html",
	"About Our Company|largest niche-wireless carrier communications services|http://www.my40acres.com/coolmo/pub/html/about.html",
	"Contact Us|We welcome your inquiries|http://www.my40acres.com/coolmo/pub/html/contact.html",
	"Site Map|Blah blah blah|http://www.my40acres.com/coolmo/pub/html/sitemap.html"
	);



// Define global variables
var SEARCHANY     = 1;
var SEARCHALL     = 2;
var SEARCHURL     = 4;
var searchType  = '';
var showMatches   = 10;
var currentMatch  = 0;
var copyArray   = new Array();
var docObj      = parent.main.document;

// Determine the type of search, and make
// sure the user has entered something
function validate(entry) {
  if (entry.charAt(0) == "+") {
    entry = entry.substring(1,entry.length);
    searchType = SEARCHALL;
    }
  else if (entry.substring(0,4) == "url:") {
    entry = entry.substring(5,entry.length);
    searchType = SEARCHURL;
    }
  else { searchType = SEARCHANY; }
  while (entry.charAt(0) == ' ') {
    entry = entry.substring(1,entry.length);
    document.search2.query.value = entry;
    }
  while (entry.charAt(entry.length - 1) == ' ') {
    entry = entry.substring(0,entry.length - 1);
    document.search2.query.value = entry;
    }
  if (entry.length < 3) {
    alert("You cannot search strings that small. Elaborate a little.");
    document.search2.query.focus();
    return;
    }
  convertString(entry);
  }

// Put the search terms in an array and
// and call appropriate search algorithm
function convertString(reentry) {
  var searchArray = reentry.split(" ");
  if (searchType == (SEARCHANY | SEARCHALL)) { requireAll(searchArray); }
  else { allowAny(searchArray); }
  }

// Define a function to perform a search that requires
// a match of any of the terms the user provided
function allowAny(t) {
  var findings = new Array(0);
  for (i = 0; i < profiles.length; i++) {
    var compareElement  = profiles[i].toUpperCase();
    if(searchType == SEARCHANY) { var refineElement  = compareElement.substring(0,compareElement.indexOf('.HTML')); }
    else { var refineElement = compareElement.substring(compareElement.indexOf('.HTML'), compareElement.length); }
    for (j = 0; j < t.length; j++) {
      var compareString = t[j].toUpperCase();
      if (refineElement.indexOf(compareString) != -1) {
        findings[findings.length] = profiles[i];
        break;
        }
      }
    }
  verifyManage(findings);
  }

// Define a function to perform a search that requires
// a match of all terms the user provided
function requireAll(t) {
  var findings = new Array();
  for (i = 0; i < profiles.length; i++) {
    var allConfirmation = true;
    var allString       = profiles[i].toUpperCase();
    var refineAllString = allString.substring(0,allString.indexOf('.HTML'));
    for (j = 0; j < t.length; j++) {
      var allElement = t[j].toUpperCase();
      if (refineAllString.indexOf(allElement) == -1) {
        allConfirmation = false;
        continue;
        }
      }
    if (allConfirmation) {
      findings[findings.length] = profiles[i];
      }
    }
  verifyManage(findings);
  }

// Determine whether the search was successful
// If so print the results; if not, indicate that, too
function verifyManage(resultSet) {
  if (resultSet.length == 0) { noMatch(); }
  else {
    copyArray = resultSet.sort();
    formatResults(copyArray, currentMatch, showMatches);
    }
  }

// Define a function that indicates that the returned no results
function noMatch() {
  docObj.open();
  docObj.writeln('<HTML><HEAD><TITLE>Search Results</TITLE></HEAD>' +
    '<BODY BGCOLOR=WHITE TEXT=BLACK>' +
    '<TABLE cellpadding=6 WIDTH=456 BORDER=0 ALIGN=left><TR><TD VALIGN=TOP><FONT FACE=Arial><B><DL>' +
    '<HR NOSHADE WIDTH=456>"' + document.search2.query.value +
    '" returned no results.<HR NOSHADE WIDTH=460></TD></TR></TABLE></BODY></HTML>');
  docObj.close();
  document.search2.query.select();
  }

// Define a function to print the results of a successful search
function formatResults(results, reference, offset) {
  var currentRecord = (results.length < reference + offset ? results.length : reference + offset);
  docObj.open();
  docObj.writeln('<HTML>\n<HEAD>\n<TITLE>Search Results</TITLE>\n</HEAD>' +
    '<BODY BGCOLOR=WHITE TEXT=BLACK>' +
    '<TABLE WIDTH=456 BORDER=0 ALIGN=left CELLPADDING=6 cellspacing=0><TR><TD>' +
    '<HR NOSHADE WIDTH=456></TD></TR><TR><TD VALIGN=TOP><FONT FACE=Arial><B>' +
    'Search Query: <I>' + parent.search1.document.search2.query.value + '</I><BR>\n' +
    'Search Results: <I>' + (reference + 1) + ' - ' +
    currentRecord + ' of ' + results.length + '</I><BR><BR></FONT>' +
    '<FONT FACE=Arial SIZE=-1><B>' + '\n\n<!-- Begin result set //-->\n\n\t<DL>');
  if (searchType == SEARCHURL) {
    for (var i = reference; i < currentRecord; i++) {
      var divide = results[i].split("|");
      docObj.writeln('\t<DT>' + '<A HREF="' + divide[2] + '">' + divide[2] + '</A>' +
        '\t<DD>' + '<I>' + divide[1] + '</I><P>\n\n');
      }
    }
  else {
    for (var i = reference; i < currentRecord; i++) {
      var divide = results[i].split('|');
      docObj.writeln('\n\n\t<DT>' + '<A HREF="' + divide[2] + '">' + divide[0] + '</A>' +
        '\t<DD>' + '<I>' + divide[1] + '</I><P>');
      }
    }
  docObj.writeln('\n\t</DL>\n\n<!-- End result set //-->\n\n');
  prevNextResults(results.length, reference, offset);
  docObj.writeln('<HR NOSHADE WIDTH=456>' +
    '</TD>\n</TR>\n</TABLE>\n</BODY>\n</HTML>');
  docObj.close();
  document.search2.query.select();
  }

// Define a function to dynamically display Prev and Next buttons
function prevNextResults(ceiling, reference, offset) {
  docObj.writeln('<CENTER><FORM>');
  if(reference > 0) {
    docObj.writeln('<INPUT TYPE=BUTTON VALUE="Prev ' + offset + ' Results" ' +
      'onClick="parent.search1.formatResults(parent.search1.copyArray, ' +
      (reference - offset) + ', ' + offset + ')">');
    }
  if(reference >= 0 && reference + offset < ceiling) {
    var trueTop = ((ceiling - (offset + reference) < offset) ? ceiling - (reference + offset) : offset);
    var howMany = (trueTop > 1 ? "s" : "");
    docObj.writeln('<INPUT TYPE=BUTTON VALUE="Next ' + trueTop + ' Result' + howMany + '" ' +
      'onClick="parent.search1.formatResults(parent.search1.copyArray, ' +
      (reference + offset) + ', ' + offset + ')">');
    }
  docObj.writeln('</CENTER>');
  }




function addDesign(category,designName,itemQty) {
   this.category=category;
   this.designName=designName;
   this.itemQty=itemQty
}

function addHandset(category,handsetName,itemQty) {
   this.category=category;
   this.handsetName=handsetName;
   this.itemQty=itemQty
}


function addRing(category,ringName,itemQty) {
   this.category=category;
   this.ringName=ringName;
   this.itemQty=itemQty
}

function addPlan(category,planName,itemQty) {
   this.category=category;
   this.planName=planName;
   this.itemQty=itemQty
}

function whatsndaBag(){
alert("there are " + shoppingBag.things.length + " items in the bag.");
	for(i=0; i < shoppingBag.things.length; i++){
		alert("item "  + i + " " + shoppingBag.things[i].itemQty);
		alert("item "  + i + " " + shoppingBag.things[i].designName);
		alert("item "  + i + " " + shoppingBag.things[i].handsetName);
		alert("item "  + i + " " + shoppingBag.things[i].ringName);
	}
}




// validates that the field value string has one or more characters in it
function isNotEmpty(elem) {
	var str = elem.value;
    var re = /.+/;
    if(!str.match(re)) {
        alert("Please fill in the required field.");
        setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    } else {
        return true;
    }
}
//validates that the entry is a positive or negative number
function isNumber(elem) {
	var str = elem.value;
    var re = /^[-]?\d*\.?\d*$/;
    str = str.toString();
    if (!str.match(re)) {
        alert("Enter only numbers into the field.");
        setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    }
    return true;
}
// validates that the entry is 16 characters long
function isLen16(elem) {
	var str = elem.value;
    var re = /\b.{16}\b/;
    if (!str.match(re)) {
        alert("Entry does not contain the required 16 characters.");
        setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    } else {
        return true;
    }
}
// validates that the entry is formatted as an e-mail address
function isEMailAddr(elem) {
	var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        alert("Verify the e-mail address format.");
        setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    } else {
        return true;
    }
}
// validate that the user made a selection other than default
function isChosen(select) {
    if (select.selectedIndex == 0) {
        alert("Please make a choice from the list.");
        return false;
    } else {
        return true;
    }
}

// validate that the user has checked one of the radio buttons
function isValidRadio(radio) {
    var valid = false;
    for (var i = 0; i < radio.length; i++) {
        if (radio[i].checked) {
            return true;
        }
    }
    alert("Make a choice from the radio buttons.");
    return false;
}

function focusElement(formName, elemName) {
    var elem = document.forms[formName].elements[elemName];
    elem.focus();
    elem.select();
}

var myquery ="";
var myname="";

// batch validation router
function validateForm(form) {
        if (isNotEmpty(form.myname)) {
			if (isNotEmpty(form.mycrednum)) {
				if (isNotEmpty(form.mycollege)) {
					if (isNotEmpty(form.myaddress)) {
						if (isNotEmpty(form.mycity)) {
							if (isNotEmpty(form.mystate)) {
								if (isNotEmpty(form.myzip)) {
									if (isNotEmpty(form.myphone)) {
            							if (isNotEmpty(form.myemail)) {
							parent.menu.document.hideme.myname.value = parent.main.document.checkout.myname.value;
							parent.menu.document.hideme.mycrednum.value = parent.main.document.checkout.mycrednum.value;
							parent.menu.document.hideme.mycollege.value = parent.main.document.checkout.mycollege.value;
							parent.menu.document.hideme.myaddress.value = parent.main.document.checkout.myaddress.value;
							parent.menu.document.hideme.mycity.value = parent.main.document.checkout.mycity.value;
							parent.menu.document.hideme.mystate.value = parent.main.document.checkout.mystate.value;
							parent.menu.document.hideme.myzip.value = parent.main.document.checkout.myzip.value;
							parent.menu.document.hideme.myphone.value = parent.main.document.checkout.myphone.value;
							parent.menu.document.hideme.myemail.value = parent.main.document.checkout.myemail.value;
							myname = parent.main.document.checkout.myname.value;
							if(parent.menu.document.hideme.progresstotal.value != 100) {
								alert("Please complete selecting features for purchase.");
								return false;
							}
							openWin();
							//alert("parent.menu.document.hideme.myquery.value =" +parent.menu.document.hideme.myquery.value);
                             return true;
                        }
                    }
                }
            }       
		}
    }
	}
	}
	}
    return false;
}

// open window with everything 

function openWin() {
//var thefeatures = "scrollbars,menubar,toolbar,location,status,resizable,width=200,height=300";
var thefeatures = "width=480,height=400";
childWindow_d=open('reply.html',"thewin",thefeatures);
	if (childWindow_d != null){
		//setTimeout("writeToWindow()", 50);
		//writeToWindow();
		childWindow_d.focus();
	}
}


function popUP(evt,currElem){
	if((isNS4 && currElem != 0) || (isIE4 && currElem != 0)){
		dom = eval(docObj + '.' + currElem + styleObj);
		state= dom.visibility;
		if(state == "visible" || state == "show")
			{dom.visibility = "hidden";}
		else {
			if(isNS4){
				topVal = eval(evt.pageY + 2);
				leftVal = eval(evt.pageX - 125);
			}
			
			if(isIE4){
				topVal = eval(event.y + 2);
				leftVal = eval(event.x - 125);
			}
			
			if(leftVal < 2)
				{leftVal = 2;}
			dom.top = topVal;
			dom.visibility = "visible";
		}
	}
}






function Phone(handset,design,plan,ring){
this.handset = handset;
this.design = design;
this.plan = plan;
this.ring = ring;
}

var myphones = new Array();

function showPhone(){	
	for(i=0; i < myphones.length; i++){
		alert("handset "  + eval(i+1) + " " + myphones[i].handset);
		alert("design "  + eval(i+1) + " " + myphones[i].design);
		alert("ring "  + eval(i+1) + " " + myphones[i].ring);
		alert("plan "  + eval(i+1) + " " + myphones[i].plan);
	}
}


function gimmeDesign(){
	for (var i = 0; i < parent.main.document.design1.designs.length; i++) {
		if (parent.main.document.design1.designs[i].checked){
		
			if((!parent.menu.document.hideme.design.value) || (!parent.menu.document.hideme.phone1.value == complete)){
				parent.menu.document.hideme.design.value = parent.main.document.design1.designs[i].value;
				//progBar();
				page2();
				alert("You placed the " + parent.menu.document.hideme.design.value + " design in your bag.");
			}
			else if((!parent.menu.document.hideme.design2.value) || (!parent.menu.document.hideme.phone2.value == complete)){
				parent.menu.document.hideme.design2.value = parent.main.document.design1.designs[i].value;
				page2();
				alert("The second design placed in your bag is " + parent.menu.document.hideme.design2.value);
			}
			else if((!parent.menu.document.hideme.design3.value) || (!parent.menu.document.hideme.phone3.value == complete)){
				parent.menu.document.hideme.design3.value = parent.main.document.design1.designs[i].value;
				page2();
				alert("The third design placed in your bag is " + parent.menu.document.hideme.design3.value);
			}
			else if((!parent.menu.document.hideme.design4.value) || (!parent.menu.document.hideme.phone4.value == complete)){
				parent.menu.document.hideme.design4.value = parent.main.document.design1.designs[i].value;
				page2();
				alert("The fourth design placed in your bag is " + parent.menu.document.hideme.design4.value);
			}
			
			// **********************************************************************************************
			else if(parent.menu.document.hideme.phone5_saved.value){
				alert("You can only purchase 5 phones at a time come back to the site later to purchase more phones.  \nThank you.");
				return;
			}			
			// ***********************************************************************************************
			
			else if((!parent.menu.document.hideme.design5.value) || (!parent.menu.document.hideme.phone5.value == complete)){
				parent.menu.document.hideme.design5.value = parent.main.document.design1.designs[i].value;
				page2();
				alert("The fifth design placed in your bag is " + parent.menu.document.hideme.design5.value);
			}			
		}
	}
}



var complete = true;

function gimmeHandset(){
var curtotal = 0;
	for (var i = 0; i < parent.main.document.handsetdesigns.handsets.length; i++) {
		if (parent.main.document.handsetdesigns.handsets[i].checked){
		
			if((!parent.menu.document.hideme.handset.value) || (!parent.menu.document.hideme.phone1.value == complete)){
				parent.menu.document.hideme.handset.value = parent.main.document.handsetdesigns.handsets[i].value;
				parent.menu.document.hideme.phone1_cost.value = eval(handsetCost());
				//progBar();
				page1();
				alert("You placed the " + parent.menu.document.hideme.handset.value + " handset in your bag.");
				
			}
			else if((!parent.menu.document.hideme.handset2.value) || (!parent.menu.document.hideme.phone2.value == complete)){
				parent.menu.document.hideme.handset2.value = parent.main.document.handsetdesigns.handsets[i].value;
				parent.menu.document.hideme.phone2_cost.value = eval(handsetCost() + 0);
				//progBar();
				alert("The second handest placed in your bag is " + parent.menu.document.hideme.handset2.value);
			}
			else if((!parent.menu.document.hideme.handset3.value) || (!parent.menu.document.hideme.phone3.value == complete)){
				parent.menu.document.hideme.handset3.value = parent.main.document.handsetdesigns.handsets[i].value;
				parent.menu.document.hideme.phone3_cost.value = eval(handsetCost() + 0);
				page1();
				alert("The third handest placed in your bag is " + parent.menu.document.hideme.handset3.value);
			}
			else if((!parent.menu.document.hideme.handset4.value) || (!parent.menu.document.hideme.phone4.value == complete)){
				parent.menu.document.hideme.handset4.value = parent.main.document.handsetdesigns.handsets[i].value;
				parent.menu.document.hideme.phone4_cost.value = eval(handsetCost() + 0);
				page1();
				alert("The fourth handest placed in your bag is " + parent.menu.document.hideme.handset4.value);
			}
			
			
			// **********************************************************************************************
			else if(parent.menu.document.hideme.phone5_saved.value){
				alert("You can only purchase 5 phones at a time come back to the site later to purchase more phones.  \nThank you.");
				return;
			}			
			// ***********************************************************************************************

			
			
			else if((!parent.menu.document.hideme.handset5.value) || (!parent.menu.document.hideme.phone5.value == complete)){
				parent.menu.document.hideme.handset5.value = parent.main.document.handsetdesigns.handsets[i].value;
				parent.menu.document.hideme.phone5_cost.value = eval(handsetCost() + 0);
				page1();
				alert("The fifth handest placed in your bag is " + parent.menu.document.hideme.handset5.value);
			}
		}
	}
}



function gimmeRing(x) {
	var responce= x;
	if((!parent.menu.document.hideme.ring.value) || (!parent.menu.document.hideme.phone1.value == complete)){
		parent.menu.document.hideme.ring.value = responce;
		page3();
		alert("You placed the " + parent.menu.document.hideme.ring.value + " tone in your bag.");
	}
	else if((!parent.menu.document.hideme.ring2.value) || (!parent.menu.document.hideme.phone2.value == complete)){
		parent.menu.document.hideme.ring2.value = responce;
		page3();
		alert("The second tone placed in your bag is " + parent.menu.document.hideme.ring2.value);
	}
	else if((!parent.menu.document.hideme.ring3.value) || (!parent.menu.document.hideme.phone3.value == complete)){
		parent.menu.document.hideme.ring3.value = responce;
		page3();
		alert("The third tone placed in your bag is " + parent.menu.document.hideme.ring3.value);
	}	
	else if((!parent.menu.document.hideme.ring4.value) || (!parent.menu.document.hideme.phone4.value == complete)){
		parent.menu.document.hideme.ring4.value = responce;
		page3();
		alert("The fourth tone placed in your bag is " + parent.menu.document.hideme.ring4.value);
	}
	
	
			// **********************************************************************************************
			else if(parent.menu.document.hideme.phone5_saved.value){
				alert("You can only purchase 5 phones at a time come back to the site later to purchase more phones.  \nThank you.");
				return;
			}			
			// ***********************************************************************************************
	
	
	
	
	else if((!parent.menu.document.hideme.ring5.value) || (!parent.menu.document.hideme.phone5.value == complete)){
		parent.menu.document.hideme.ring5.value = responce;
		page3();
		alert("The fifth tone placed in your bag is " + parent.menu.document.hideme.ring5.value);
	}		
}


function gimmePlan() {
	for (var i = 0; i < parent.main.document.cellplan.plans.length; i++) {
		if (parent.main.document.cellplan.plans[i].checked){
		
			if((!parent.menu.document.hideme.plan.value) || (!parent.menu.document.hideme.phone1.value == complete)){
				parent.menu.document.hideme.plan.value = parent.main.document.cellplan.plans[i].value;
				
				parent.menu.document.hideme.plan1_cost.value = planCost(i);
				page4();

				alert("You placed the " + parent.menu.document.hideme.plan.value + " plan in your bag.");	
			}
			else if((!parent.menu.document.hideme.plan2.value) || (!parent.menu.document.hideme.phone2.value == complete)){
				parent.menu.document.hideme.plan2.value = parent.main.document.cellplan.plans[i].value;
				parent.menu.document.hideme.plan2_cost.value = planCost(i);
				page4();
				alert("The second plan placed in your bag is " + parent.menu.document.hideme.plan2.value);
			}
			else if((!parent.menu.document.hideme.plan3.value) || (!parent.menu.document.hideme.phone3.value == complete)){
				parent.menu.document.hideme.plan3.value = parent.main.document.cellplan.plans[i].value;
				parent.menu.document.hideme.plan3_cost.value = planCost(i);
				page4();
				alert("The third plan placed in your bag is " + parent.menu.document.hideme.plan3.value);
			}
			else if((!parent.menu.document.hideme.plan4.value) || (!parent.menu.document.hideme.phone4.value == complete)){
				parent.menu.document.hideme.plan4.value = parent.main.document.cellplan.plans[i].value;
				parent.menu.document.hideme.plan4_cost.value = planCost(i);
				page4();
				alert("The fourth plan placed in your bag is " + parent.menu.document.hideme.plan4.value);
			}
			
			
			// **********************************************************************************************
			else if(parent.menu.document.hideme.phone5_saved.value){
				alert("You can only purchase 5 phones at a time come back to the site later to purchase more phones.  \nThank you.");
				return;
			}			
			// ***********************************************************************************************

			
			
			else if((!parent.menu.document.hideme.plan5.value) || (!parent.menu.document.hideme.phone5.value == complete)){
				parent.menu.document.hideme.plan5.value = parent.main.document.cellplan.plans[i].value;
				parent.menu.document.hideme.plan5_cost.value = planCost(i);
				page4();
				alert("The fifth plan placed in your bag is " + parent.menu.document.hideme.plan5.value);
			}
		}
	}
}




function storePhone(){
	if(parent.menu.document.hideme.handset.value && parent.menu.document.hideme.design.value && parent.menu.document.hideme.plan.value /* && parent.menu.document.hideme.ring.value */){
		myphones[myphones.length] = new Phone(parent.menu.document.hideme.handset.value,parent.menu.document.hideme.design.value,parent.menu.document.hideme.plan.value,parent.menu.document.hideme.ring.value);
		parent.menu.document.hideme.phone1.value = complete;
		totalCost();
		showBalance();
		page5();
		parent.menu.document.hideme.phone1_saved.value = true;
	}
	//else
		//{alert("You must complete selecting features to save this phone.")}
	if(parent.menu.document.hideme.handset2.value && parent.menu.document.hideme.design2.value && parent.menu.document.hideme.plan2.value /* && parent.menu.document.hideme.ring2.value */){
		myphones[myphones.length] = new Phone(parent.menu.document.hideme.handset2.value,parent.menu.document.hideme.design2.value,parent.menu.document.hideme.plan2.value,parent.menu.document.hideme.ring2.value);
		parent.menu.document.hideme.phone2.value = complete;
		totalCost();
		page5();
		parent.menu.document.hideme.phone2_saved.value = true;
	}
	//else
		//{alert("You must complete selecting features for the second phone before you can save it.")}

	if(parent.menu.document.hideme.handset3.value && parent.menu.document.hideme.design3.value && parent.menu.document.hideme.plan3.value /*&& parent.menu.document.hideme.ring3.value */){
		myphones[myphones.length] = new Phone(parent.menu.document.hideme.handset3.value,parent.menu.document.hideme.design3.value,parent.menu.document.hideme.plan3.value,parent.menu.document.hideme.ring3.value);
		parent.menu.document.hideme.phone3.value = complete;
		page5();
		parent.menu.document.hideme.phone3_saved.value = true;
	}
	//else
		//{alert("You must complete selecting features for the third phone before you can save it.")}

	if(parent.menu.document.hideme.handset4.value && parent.menu.document.hideme.design4.value && parent.menu.document.hideme.plan4.value /* && parent.menu.document.hideme.ring4.value */){
		myphones[myphones.length] = new Phone(parent.menu.document.hideme.handset4.value,parent.menu.document.hideme.design4.value,parent.menu.document.hideme.plan4.value,parent.menu.document.hideme.ring4.value);
		parent.menu.document.hideme.phone4.value = complete;
		page5();
		parent.menu.document.hideme.phone4_saved.value = true;
	}
	//else
		//{alert("You must complete selecting features for the fourth phone before you can save it.")}

	if(parent.menu.document.hideme.handset5.value && parent.menu.document.hideme.design5.value && parent.menu.document.hideme.plan5.value /* && parent.menu.document.hideme.ring5.value */){
		myphones[myphones.length] = new Phone(parent.menu.document.hideme.handset5.value,parent.menu.document.hideme.design5.value,parent.menu.document.hideme.plan5.value,parent.menu.document.hideme.ring5.value);
		parent.menu.document.hideme.phone5.value = complete;
		page5();
		parent.menu.document.hideme.phone5_saved.value = true;
	}
	//else
		//{alert("You must complete selecting features for the fifth phone before you can save it.")}

}


function Bag(handset,design,plan,ring){
this.handset = handset;
this.design = design;
this.plan = plan;
this.ring = ring;
}

var shoppingBag = new Array();

function bagIt(){
	for (var i = 0; i < myphones.length; i++){
		shoppingBag[shoppingBag.length] = myphones[i];
	}
	showBag();
}

function handsetCost(){
var phonecost = 0;
	for (var i = 0; i < parent.main.document.handsetdesigns.handsets.length; i++) {
		if (parent.main.document.handsetdesigns.handsets[i].checked){

			if(parent.main.document.handsetdesigns.handsets[i].value == "motov70")
				{phonecost = eval(100 + eval(parent.menu.document.hideme.shpchg.value))}
			if(parent.main.document.handsetdesigns.handsets[i].value == "motov60")
				{phonecost = eval(145 + eval(parent.menu.document.hideme.shpchg.value))}
			if(parent.main.document.handsetdesigns.handsets[i].value == "motov60i")
				{phonecost = eval(100 + eval(parent.menu.document.hideme.shpchg.value))}
			if(parent.main.document.handsetdesigns.handsets[i].value == "motov60p")
				{phonecost = eval(400 + eval(parent.menu.document.hideme.shpchg.value))}
			if(parent.main.document.handsetdesigns.handsets[i].value == "motot720")
				{phonecost = eval(250 + eval(parent.menu.document.hideme.shpchg.value))}
			if(parent.main.document.handsetdesigns.handsets[i].value == "motoa388")
				{phonecost = eval(50 + eval(parent.menu.document.hideme.shpchg.value))}
			if(parent.main.document.handsetdesigns.handsets[i].value == "motot720i")
				{phonecost = eval(100 + eval(parent.menu.document.hideme.shpchg.value))}
			if(parent.main.document.handsetdesigns.handsets[i].value == "motot721")
				{phonecost = eval(350 + eval(parent.menu.document.hideme.shpchg.value))}
			if(parent.main.document.handsetdesigns.handsets[i].value == "motot730")
				{phonecost = eval(100 + eval(parent.menu.document.hideme.shpchg.value))}
		}
	}
//alert("HELP: phone cost is " + phonecost);
return phonecost;
}	

function planCost(x){
var index = x;
var plncost = 0;
	if (parent.main.document.cellplan.plans[index].value == "coolest")
		{plncost = parent.menu.document.hideme.plan_cool.value;}
	else if (parent.main.document.cellplan.plans[index].value == "beamer")
		{plncost = parent.menu.document.hideme.plan_beamer.value;}
	else if (parent.main.document.cellplan.plans[index].value == "whitehot")
		{plncost = parent.menu.document.hideme.plan_whthot.value;}
	else if (parent.main.document.cellplan.plans[index].value == "economy")
		{plncost = parent.menu.document.hideme.plan_econ.value;}
return plncost;
}

function totalCost(){
	if (parent.menu.document.hideme.phone1_cost.value && parent.menu.document.hideme.plan1_cost.value){
		parent.menu.document.hideme.totalcost.value = eval(eval(parent.menu.document.hideme.phone1_cost.value) + eval(parent.menu.document.hideme.plan1_cost.value));
		parent.main.document.totalcost.total.value = parent.menu.document.hideme.totalcost.value;
	}
	if (parent.menu.document.hideme.phone2_cost.value && parent.menu.document.hideme.plan2_cost.value){
		parent.menu.document.hideme.totalcost.value = eval(eval(parent.menu.document.hideme.phone2_cost.value) + eval(parent.menu.document.hideme.plan2_cost.value) + eval(parent.menu.document.hideme.totalcost.value));
		parent.main.document.totalcost.total.value = parent.menu.document.hideme.totalcost.value;
	}
	if (parent.menu.document.hideme.phone3_cost.value && parent.menu.document.hideme.plan3_cost.value){
		parent.menu.document.hideme.totalcost.value = eval(eval(parent.menu.document.hideme.phone3_cost.value) + eval(parent.menu.document.hideme.plan3_cost.value) + eval(parent.menu.document.hideme.totalcost.value));
		parent.main.document.totalcost.total.value = parent.menu.document.hideme.totalcost.value;
	}
	if (parent.menu.document.hideme.phone4_cost.value && parent.menu.document.hideme.plan4_cost.value){
		parent.menu.document.hideme.totalcost.value = eval(eval(parent.menu.document.hideme.phone4_cost.value) + eval(parent.menu.document.hideme.plan4_cost.value) + eval(parent.menu.document.hideme.totalcost.value));
		parent.main.document.totalcost.total.value = parent.menu.document.hideme.totalcost.value;
	}
	if (parent.menu.document.hideme.phone5_cost.value && parent.menu.document.hideme.plan5_cost.value){
		parent.menu.document.hideme.totalcost.value = eval(eval(parent.menu.document.hideme.phone5_cost.value) + eval(parent.menu.document.hideme.plan5_cost.value) + eval(parent.menu.document.hideme.totalcost.value));
		parent.main.document.totalcost.total.value = parent.menu.document.hideme.totalcost.value;
	}
}


function showBalance(){
parent.main.document.totalcost.balance.value = parent.menu.document.hideme.totalcost.value;
}


function page1(){
var makenumber = 20;
var done = true;
		if(parent.menu.document.hideme.progressbar1.value == 0 && !parent.menu.document.hideme.page1.value){
			parent.menu.document.hideme.progressbar1.value = makenumber;
			parent.menu.document.hideme.page1.value = done;
//			alert("progress1 bar: " + parent.menu.document.hideme.progressbar1.value);
			parent.menu.document.hideme.progresstotal.value = eval(parent.menu.document.hideme.progressbar1.value) + eval(parent.menu.document.hideme.progresstotal.value);
		}
}


function page2(){
var makenumber = 20;
var done = true;
		if(parent.menu.document.hideme.progressbar2.value == 0 && !parent.menu.document.hideme.page2.value){
			parent.menu.document.hideme.progressbar2.value = makenumber;
			parent.menu.document.hideme.page2.value = done;
//			alert("progress2 bar: " + parent.menu.document.hideme.progressbar2.value);
			parent.menu.document.hideme.progresstotal.value = eval(parent.menu.document.hideme.progressbar2.value) + eval(parent.menu.document.hideme.progresstotal.value);
		}
}


function page3(){
var makenumber = 20;
var done = true;
		if(parent.menu.document.hideme.progressbar3.value == 0 && !parent.menu.document.hideme.page3.value){
			parent.menu.document.hideme.progressbar3.value = makenumber;
			parent.menu.document.hideme.page3.value = done;
//			alert("progress3 bar: " + parent.menu.document.hideme.progressbar3.value);
			parent.menu.document.hideme.progresstotal.value = eval(parent.menu.document.hideme.progressbar3.value) + eval(parent.menu.document.hideme.progresstotal.value);
		}
}


function page4(){
var makenumber = 20;
var done = true;
		if(parent.menu.document.hideme.progressbar4.value == 0 && !parent.menu.document.hideme.page4.value){
			parent.menu.document.hideme.progressbar4.value = makenumber;
			parent.menu.document.hideme.page4.value = done;
//			alert("progress4 bar: " + parent.menu.document.hideme.progressbar4.value);
			parent.menu.document.hideme.progresstotal.value = eval(parent.menu.document.hideme.progressbar4.value) + eval(parent.menu.document.hideme.progresstotal.value);
		}
}


function page5(){
var makenumber = 20;
var done = true;
		if(parent.menu.document.hideme.progressbar5.value == 0 && !parent.menu.document.hideme.page5.value){
			parent.menu.document.hideme.progressbar5.value = makenumber;
			parent.menu.document.hideme.page5.value = done;
//			alert("progress5 bar: " + parent.menu.document.hideme.progressbar5.value);
			parent.menu.document.hideme.progresstotal.value = eval(parent.menu.document.hideme.progressbar5.value) + eval(parent.menu.document.hideme.progresstotal.value);
		}
}


function progStarter(){
	if(parent.menu.document.hideme.progresstotal.value == 0){
		parent.menu.document.hideme.progresstotal.value = 20;
	}
}		

function showBag(){
	for (var i = 0; i < shoppingBag.length;i++){
		alert("handset " + eval(i+1) + " is " + shoppingBag[i].handset);
		alert("designs " + eval(i+1) + " is " + shoppingBag[i].design);
		alert("ring " + eval(i+1) + " is " + shoppingBag[i].ring);
		alert("plan " + eval(i+1) + " is " + shoppingBag[i].plan);
	}
} 


