﻿    function RemovePhoneFormatting(txtPhone) {
	    var txt = document.getElementById(txtPhone).value;
    	txt = txt.replace("(","").replace(")","").replace(" ","").replace("-","");
	    document.getElementById(txtPhone).value = txt;
	    document.getElementById(txtPhone).select();
    }

    function ResetPhoneFormatting(txtPhone) {
    	var txt = document.getElementById(txtPhone).value;
	    txt = txt.replace("(","").replace(")","").replace(" ","").replace("-","");
	    var strValidChars = "0123456789"; 
	    var strChar;
	    var txtNew = "";
	    
	    for (i = 0; i < txt.length; i++) 
	    { 
		    strChar = txt.charAt(i); 
		    if (strValidChars.indexOf(strChar) !== -1) 
		    { 
			    txtNew = txtNew + strChar;
		    }
        }
        txt = txtNew;
	    if (txt.length >= 10) 
	    {
		    txt = txt.substring(0,10);
		    txt = "(" + txt.substring(0, 3) + ") " + txt.substring(3, 6) + "-" + txt.substring(6);
	    }
        document.getElementById(txtPhone).value = txt;
    }

    // toggle datalist panel for multi-level sites like Unique Creations and Children's Furniture
    function ToggleMultiLevelDL(rptr) {
        var rptrstyle = document.getElementById(rptr).style;
        if (rptrstyle.display == "none")
        {
            rptrstyle.display = "block";
        }
        else
        {
            rptrstyle.display = "none";
        }
        return false;
    }

    // Pour coffee
	var div;
	var lnk;
	var img;

	function coffee() {
		div = get_PourCoffee();
		img = get_imgPourCoffee();
		lnk = get_lnkPourCoffee();

		if (div.style.display == "none")
	    {
			img.src = img.src.replace("CoffeeSmile","CoffeePour");
			div.style.display = "block";
			lnk.innerHTML = "MMMMmmmmmmm!";
			alert("Click here to drink that delicious home-brewed coffee!!");
			smilecoffee();
		}
		return false;		
    }
		
	function smilecoffee() {
        img.src = img.src.replace("CoffeePour","CoffeeSmile");
	    img.style.width = "20%";
	    lnk.innerHTML = "Enjoy!!!";
	    alert("Click here to prepare for another cup!");
    }


