function switch_cat_choice(str) {
			switch(str) {
    			case "close":
        			document.getElementById('show-cat-ajax').style.display = 'none';
        			document.getElementById('show-cat-filter-open').style.display = 'none';
        			document.getElementById('show-cat-filter-close').style.display = 'block';
        			break;
   				case "open":
					document.getElementById('show-cat-ajax').style.display = 'block';
					document.getElementById('show-cat-filter-open').style.display = 'block';
        			document.getElementById('show-cat-filter-close').style.display = 'none';
        			break;
    			default:
    				 break;
    		}
}

function switch_order_choice($id){	switch($id){		case "order-auth":{			document.getElementById('order-auth-button-show').style.display = 'none';
        	document.getElementById('order-auth-button-hide').style.display = 'inline';

        	document.getElementById('order-reg-button-show').style.display = 'inline';
        	document.getElementById('order-reg-button-hide').style.display = 'none';

        	document.getElementById('order-reg').style.display = 'none';
        	document.getElementById('order-auth').style.display = 'block';
        	break;		}
		case "order-reg":{
			document.getElementById('order-auth-button-show').style.display = 'inline';
        	document.getElementById('order-auth-button-hide').style.display = 'none';

        	document.getElementById('order-reg-button-show').style.display = 'none';
        	document.getElementById('order-reg-button-hide').style.display = 'inline';

        	document.getElementById('order-reg').style.display = 'block';
        	document.getElementById('order-auth').style.display = 'none';
        	break;
		}	}}

function depend_param_value(pid, svalue, IDsize, One){	var csize = 0
	if (One == true) {		var name = 'dp_pd_'+pid+'_'+svalue;		if (document.getElementById(name)){
			if(svalue == svalue) document.getElementById(name).style.display = 'block';
			else document.getElementById(name).style.display = 'none';
		}
		return true;	}	while(csize<IDsize.length){		var name = 'dp_pd_'+pid+'_'+IDsize[csize];
		//alert(name);
		if (document.getElementById(name)){			if(svalue == IDsize[csize]) document.getElementById(name).style.display = 'block';
			else document.getElementById(name).style.display = 'none';		}
		csize++	}}

function shop_delete_good(str){
	document.getElementById(str).value = 1;
	return false;
}

function shop_product_plus(str){
	var productVal = Number(document.getElementById(str).value);
	productVal++;
	document.getElementById(str).value = productVal;
	return false;
}

function shop_product_minus(str){
	var productVal = Number(document.getElementById(str).value);
	productVal--;
	if (productVal <= 1 ) productVal = 1;
	document.getElementById(str).value = productVal;
	return false;
}

function anichange (objName) {
	 var distance = 10;
            var time = 10000000;
            var hideDelay = 1000000;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var trigger = $('.trigger', this);
            var info = $('.popup', this).css('opacity', 0);

  if ( $(objName).css('display') == 'none' ) {
    $(objName).animate({height: 'show'}, 400);
  } else {
    $(objName).animate({
                        top: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
  }
}

function product_hide_param(objName){
	document.getElementById(objName).style.display = 'none';
}

$(function () {
    $('.bubbleInfo').each(function () {
        var distance = 0;
        var time = 1000;
        var hideDelay = 1000;

        var hideDelayTimer = null;

        var beingShown = false;
        var shown = false;
        var trigger = $('.trigger', this);
        var info = $('.popup', this).css('opacity', 0);


        $([trigger.get(0), info.get(0)]).mouseover(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            if (beingShown || shown) {
                return;
            } else {
                beingShown = true;

                info.css({
                    top: 0,
                    right: -60,
                    display: 'block'
                }).animate({
                    top: '-=' + distance + 'px',
                    opacity: 1
                }, time, 'swing', function() {
                    beingShown = false;
                    shown = true;
                });
            }

            return false;
        }).mouseout(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            hideDelayTimer = setTimeout(function () {
                hideDelayTimer = null;
                info.animate({
                    top: '-=' + distance + 'px',
                    opacity: 0
                }, time, 'swing', function () {
                    shown = false;
                    info.css('display', 'none');
                });

            }, hideDelay);

            return false;
        });
    });
});
