function trim(str){
	str = '' + str;
	var re = /^ */;
	var res = str.replace(re, '');
	re = / *$/;
	return(res.replace(re, ''));
}
(function($) {
    $.fn.collapsor = function(openClass, panelElement) {
        var trigger = this;
        var panel = panelElement;
        return this.each(function() {
            $(this).click(function() {
                if ($(this.parentNode.parentNode.parentNode).hasClass(openClass)) {
                    $(this.parentNode.parentNode.parentNode).removeClass(openClass);
                    Cufon.replace(".PartMenu .Title h3", { fontWeight: 'normal', color: '#825F0B' });
                }
                else {
                    $(this.parentNode.parentNode.parentNode).addClass(openClass);
                    Cufon.replace(".OpenPart .Title h3", { fontWeight: 'normal', color: '#F4DDDD' });
                }

                
                Cufon.now();
            });
        });
    };
})
(jQuery);
$(function()
{
    if ($('.Inner') != null)
	{
	    $('.Inner').collapsor('OpenPart', '.PartMenu');
	}
});
(function($) {
    $.fn.expandAll = function(openClass, panelElement) {
        var trigger = this;
        var panel = panelElement;
        return this.each(function() {
            $(this).click(function() {

                if ($(panelElement).hasClass(openClass)) {
                    $(panelElement).removeClass(openClass);
                    Cufon.replace(".PartMenu .Title h3", { fontWeight: 'normal', color: '#825F0B' });

                }
                else {
                    $(panelElement).addClass(openClass);
                    Cufon.replace(".OpenPart .Title h3", { fontWeight: 'normal', color: '#F4DDDD' });
                }
                Cufon.now();
            });
        });
    };
})
(jQuery);

$(function()
{
    if ($('.RightLink-Expand') != null)
	{
	    $('.RightLink-Expand').expandAll('OpenPart', '.PartMenu');
	}
});

  
function initLoadingHint() {
//DO NOTHING
}

function ChangeHideInputValue(b, a) { 
//Do NOTHING
}

function showHideElement(elementID, elementHelperID, showClassName, hideClassName) {
    element = document.getElementById(elementID);
    elementHelper = document.getElementById(elementHelperID);
    if (!element || !elementHelper) {
        return;
    }

    if (element.style.display == 'none') {
        element.style.display = '';
        elementHelper.className = showClassName;
    }
    else {
        element.style.display = 'none';
        elementHelper.className = hideClassName;
    }
    Cufon.replace("h1", { fontWeight: 'bold', color: '#C31424' });   
    Cufon.now();
}

function expandCollapseRegion(expandedModeID, collapsedModeID) {
    expandedMode = document.getElementById(expandedModeID);
    collapsedMode = document.getElementById(collapsedModeID);

    if (!expandedMode || !collapsedMode) {
        return;
    }

    if (expandedMode.style.display == 'none') {
        expandedMode.style.display = '';
        collapsedMode.style.display = 'none';
    }
    else {
        expandedMode.style.display = 'none';
        collapsedMode.style.display = '';
    }
}

function $$(id) {
    return document.getElementById(id);
}

function autoMove(length, maxlength, controlID) {
    if (length == maxlength) {
        controlID.focus();
    }
}

/***********Menu*************/
(function($) {
    $.fn.InitMenu = function() {
        return this.each(function() {
            var input = $(this).parent().find(':hidden').eq(0);
            this.selectedIndex = input[0].value == '' ? 0 : parseInt(input[0].value);
            $(this).change(function() {
                $(this).parent().find(':hidden').attr('value', this.value);
            });
        });
    };
})
(jQuery);
$(function() {
    if ($('.PartMenu .PartItemList .PartItem .OrderItem .priceRow .orderSlice select') != null) {
        $('.PartMenu .PartItemList .PartItem .OrderItem .priceRow .orderSlice select').InitMenu();
    }
});
/***********End Menu*********/