function init( ){
    initInputButtons( );
}

function initInputButtons( ){
    if(document.getElementsByTagName){
        var inputs = document.getElementsByTagName("INPUT");
        for(var i = 0; i < inputs.length; i++){
            if((inputs[i].type == "submit" || inputs[i].type == "reset") && inputs[i].className == "button"){
                inputs[i].onmouseover = inputOver;
                inputs[i].onmouseout = inputOut;
            }
        }
    }
}

function inputOver(e){
    this.className = "buttonOver";
}

function inputOut(e){
    this.className = "button";
}

function imageSelectPopUp(pwinvar){
    imgSelectPopUp = window.open("./imageselect.php?mode=1&fieldID=" + pwinvar, "ImageSelector", "width=780,height=480, scrollbars=0, status=no,toolbar=no,resizable=no");
    imgSelectPopUp.focus( );
}

function openUploader( ){
    var imgSelectPopUp = window.open("./imageselect.php", "ImageSelector", "width=780,height=480, scrollbars=0, status=no,toolbar=no,resizable=no");
    imgSelectPopUp.focus( );

    if(document.all){
        window.event.cancelBubble = true;
    }
    else{
        e.stopPropagation( );
        e.preventDefault( );
    }
    return false;
}

//drop down menus ##################################################
var CurMenu = null;
var isDropped = false;
var isHideCheck = false;

function pageON(index){
    if(document.getElementById){
        var cInd = "top_" + index;
        var cCell = document.getElementById(cInd);
        var mInd = "tdiv_" + index;
        show(cCell, mInd);
    }
}

function pageOFF(index){
    if(document.getElementById){
        var cInd = "top_" + index;
        var cCell = document.getElementById(cInd);
        var mInd = "tdiv_" + index;
        if(!isHideCheck){
            hideMenu( );
        }
    }
}

function subPageON(index){
    var cInd = "top_" + index;
    var cCell = document.getElementById(cInd);
    var mInd = "tdiv_" + index;
    isDropped = true;
}

function subPageOFF(index){
    var cInd = "top_" + index;
    var cCell = document.getElementById(cInd);
    var mInd = "tdiv_" + index;
    if(!isHideCheck){
        hideMenu( );
    }
}

function show(pMenu, menuID) {
    if(CurMenu) CurMenu.style.visibility = "hidden";

    var menuTable = document.getElementById("menuTable");
    var temp = 0;

    if(!document.getElementById(menuID)) return;
    pMenu.menu = document.getElementById(menuID);
    pMenu.menu.style.visibility = "visible";

    isDropped = true;
    CurMenu = pMenu.menu;
}

function setIsDropped( ){
    isDropped = true;
}

function hideMenu( ) {
   if(CurMenu){
     isDropped = false;
     isHideCheck = true;
     setTimeout('checkDropped( );', 500);
     isHideCheck = false;
   }
}

function checkDropped( ) {
    if(!isDropped){
        CurMenu.style.visibility = "hidden";
    }
}

function checkShippingInfo() {
	var check_box = document.form.sSameAsBilling;
	if (check_box.checked) {
		document.form.sStreet1.disabled = true;
		document.form.sStreet2.disabled = true;
		document.form.sCity.disabled = true;
		document.form.sState.disabled = true;
		document.form.sZIP.disabled = true;
		document.form.sStreet1.style.backgroundColor = "#FAFAFA";
		document.form.sStreet2.style.backgroundColor = "#FAFAFA";
		document.form.sCity.style.backgroundColor = "#FAFAFA";
		document.form.sState.style.backgroundColor = "#FAFAFA";
		document.form.sZIP.style.backgroundColor = "#FAFAFA";
	}
	else {
		document.form.sStreet1.disabled = false;
		document.form.sStreet2.disabled = false;
		document.form.sCity.disabled = false;
		document.form.sState.disabled = false;
		document.form.sZIP.disabled = false;
		document.form.sStreet1.style.backgroundColor = "";
		document.form.sStreet2.style.backgroundColor = "";
		document.form.sCity.style.backgroundColor = "";
		document.form.sState.style.backgroundColor = "";
		document.form.sZIP.style.backgroundColor = "";
    }
}

function disableBoxes(form, check){
    for(var i = 0; i < form.elements.length; i++){
        if(form.elements[i].type == 'checkbox' && form.elements[i].id != 'acheck'){
            form.elements[i].disabled = check;
            form.elements[i].checked = check;
        }
    }
}

//############################################################