// javascript library


function montre(id) {
var d = document.getElementById(id);
		for (var i = 1; i<=10; i++) {
				if (document.getElementById('smenu'+i))
				{document.getElementById('smenu'+i).style.display='none';}
				}
if (d) {d.style.display='block';}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function alertsave(id) {
    document.getElementById("alerttext").innerHTML="<font color=red>Please remember to save before exit.</font>";

    document.getElementById("_ticketid").value = document.getElementById("_ticketid").value + "," + id;

}



function displayFullWin(url) {
    var Win = window.open(url,"fullWindow",'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes' );
}




function goPage(whichPage) {

window.location = whichPage;


}

function changeStatus(page) {
    var status =  document.getElementById("showstatus").value;

    if (status >= 0) {
        goPage(page+'?showstatus='+status);
    }
    else {
        goPage(page);
    }


}

function showProduct(theProduct) {

// alert("showproduct");
    elem = document.getElementById("showproduct");

    var tempText = '<center><a href="javascript:closeProduct();">Close</a><br><img src="' + theProduct + '"></center>';

    elem.innerHTML = tempText;

    elem.style.visibility = 'visible';

    window.scrollTo(0,0);
}

function closeProduct() {
    elem = document.getElementById("showproduct");
    elem.style.visibility = 'hidden';
    elem.innerHTML = '';

}

function disableSubmitButton(whichone) {
    if (whichone.disabled != true) {
        whichone.disabled = true;
    }
}

function checkDelete() {

	if (window.confirm("DELETE?")) {
		return true;
	}
	return false;
}

function SameAsAbove(){

	currForm = document.account;
	if (currForm.elements['sameasabove'].checked){
            theBillFields = "billingaddress1,billingaddress2,billingcity,billingstate,billingzip";
            theShipFields = "storeaddress1,storeaddress2,storecity,storestate,storezip";

            var shipfields = theShipFields.split(",");
            var billfields = theBillFields.split(",");
            for (x=0;x<billfields.length;x++) {
                  if (currForm.elements[billfields[x]].value.length) {
			            currForm.elements[shipfields[x]].value = currForm.elements[billfields[x]].value;
                  }
            }
      	    // theState = currForm.elements['billstate'].selectedIndex;
            // currForm.elements['shipstate'].selectedIndex = theState;
	}
}

function uncheckothers(whichone) {

      var f = document.addItemForm;


      if ((f.option1 != null) && (f.option1.name != whichone) ) {
          f.option1.checked = false;
      }

      if ((f.option2 != null)  && (f.option2.name != whichone) ) {
          f.option2.checked = false;
      }

      if ((f.option3 != null)  && (f.option3.name != whichone) ) {
          f.option3.checked = false;
      }

      if ((f.option4 != null)  && (f.option4.name != whichone) ) {
          f.option4.checked = false;
      }

      if ((f.option5 != null)  && (f.option5.name != whichone) ) {
          f.option5.checked = false;
      }




}


function adjustAddItem() {

        var f = document.addItemForm;

        var option1 = "";
        var option2 = "";
        var option3 = "";
        var option4 = "";
        var option5 = "";
        var optionstring = " Options: ";

        if ((f.option1 != null) && (f.option1.checked) ) {
            optionstring = optionstring + f.option1.value;
        }
        if ((f.option2 != null) && (f.option2.checked) ) {
            optionstring = optionstring + f.option2.value;
        }
        if ((f.option3 != null) && (f.option3.checked) ) {
            optionstring = optionstring + f.option3.value;
        }
        if ((f.option4 != null) && (f.option4.checked) ) {
            optionstring = optionstring + f.option4.value;
        }
        if ((f.option5 != null) && (f.option5.checked) ) {
            optionstring = optionstring + f.option5.value;
        }


        if ( optionstring.length > 10) {
            f.AddItem.value = "mylittlepretty|" + f.itemtitle.value + optionstring + "|" + f.itemprice.value + "|1|||prompt|1||||||";
        }
        else {
            f.AddItem.value = "mylittlepretty|" + f.itemtitle.value + "|" + f.itemprice.value + "|1|||prompt|1||||||";
        }



	    return true;


}




