

function openmsf() {
    window.open('/msf.htm', 'msf', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=600,height=400,left=' + ((screen.width - 600) / 2) + ',top=' + ((screen.height - 400) / 2));
}


function parseQuery(ji) {
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
}


function showWarning(text) {
    $("<p>" + text + "</p>").dialog({
        buttons: {
            "": function() { $(this).dialog("close"); }
        },
        modal: true,
        width: 463
    });
}

function OnReadyStateChangeRegisterShopGenericLog() {
}

function RegisterSessionLog() {
    var ajax;
    if (window.XMLHttpRequest)
        ajax = new XMLHttpRequest();
    else
        ajax = new ActiveXObject("Msxml2.XMLHTTP");
    ajax.onreadystatechange = OnReadyStateChangeRegisterShopGenericLog;
    var sURL;
    var sQuery;
    sURL = "/tools/register_shop_session_log.aspx";
    var d = new Date();
    var curr_msec = d.getMilliseconds()
    sQuery = "rnd=" + curr_msec;
    ajax.open("POST", sURL, false);
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send(sQuery);
    ajax = null;
}



function OnReadyStateChangeRegisterShopGenericLog() {

}

function RegisterShopGenericLog(affiliate, shop, customer, type, code, p1, p2, p3) {

    var ajax;
    if (window.XMLHttpRequest)
        ajax = new XMLHttpRequest();
    else
        ajax = new ActiveXObject("Msxml2.XMLHTTP");

    ajax.onreadystatechange = OnReadyStateChangeRegisterShopGenericLog;

    var sURL;
    var sQuery;

    sURL = "/tools/register_shop_generic_log.aspx";
    sQuery = "affiliate=" + affiliate;
    sQuery += "&shop=" + shop;
    sQuery += "&customer=" + customer;
    sQuery += "&type=" + type;
    sQuery += "&code=" + code;
    sQuery += "&p1=" + p1;
    sQuery += "&p2=" + p2;
    sQuery += "&p3=" + p3;
    var d = new Date();
    var curr_msec = d.getMilliseconds()
    sQuery += "&rnd=" + curr_msec;
    ajax.open("POST", sURL, false);
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send(sQuery);

    ajax = null;

}

function ShowPriceShipMethod(oCombo, url) {
    document.location.href = '/product.aspx' + url + '&cship=' + oCombo.options[oCombo.selectedIndex].value;
}


function SearchSearchIt() {
    if (document.getElementById('txtSpSearch').value.length > 2) {
        sDummy = new String(document.getElementById('txtSpSearch').value);
        oRegExp = new RegExp(' ', 'g');

        document.location.href = 'list.aspx?search=' + sDummy.replace(oRegExp, '+');
    }
}

function EmailCheck(sEmail) {
    var at = "@";
    var dot = ".";
    var lat = sEmail.indexOf(at);
    var lstr = sEmail.length;
    var ldot = sEmail.indexOf(dot);

    if (sEmail.indexOf(at) == -1) { return false; }
    if (sEmail.indexOf(at) == -1 || sEmail.indexOf(at) == 0 || sEmail.indexOf(at) == lstr) { return false; }
    if (sEmail.indexOf(dot) == -1 || sEmail.indexOf(dot) == 0 || sEmail.indexOf(dot) == lstr) { return false; }
    if (sEmail.indexOf(at, (lat + 1)) != -1) { return false; }
    if (sEmail.substring(lat - 1, lat) == dot || sEmail.substring(lat + 1, lat + 2) == dot) { return false; }
    if (sEmail.indexOf(dot, (lat + 2)) == -1) { return false; }
    if (sEmail.indexOf(" ") != -1) { return false; }

    return true;
}


//JFS 22-09-2008
function changelanguage(ai_ilanguage) {

    var sURL = document.location.host;
    var sPath = document.location.pathname;
    var sParams = document.location.search;

    var sMatchStr = /(\&l=.)/;
    var sMatchStr2 = /(\?l=.)/;

    sParams = sParams.replace(sMatchStr, '');
    sParams = sParams.replace(sMatchStr2, '?');

    if (sParams == '') {
        document.location.href = 'http://' + sURL + sPath + '?l=' + ai_ilanguage;
    } else {
        document.location.href = 'http://' + sURL + sPath + sParams + '&l=' + ai_ilanguage;
    }
}



function SelectCategory(ai_icategory, ai_ilevel) {
    if (ai_ilevel > 1)
        document.location.href = '/list.aspx?c=' + ai_icategory + '&md=2';
    else
        document.location.href = '/category.aspx?c=' + ai_icategory;
}


function ReadCookie(cookieName) {
    var theCookie = "" + document.cookie;
    var ind = theCookie.indexOf(cookieName);
    if (ind == -1 || cookieName == "") return "";
    var ind1 = theCookie.indexOf(';', ind);
    if (ind1 == -1) ind1 = theCookie.length;
    return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
}

function SetCookie(cookieName, cookieValue, nDays) {
    var today = new Date();
    var expire = new Date();
    if (nDays == null || nDays == 0) nDays = 1;
    expire.setTime(today.getTime() + 3600000 * 24 * nDays);
    document.cookie = cookieName + "=" + escape(cookieValue)
                 + ";expires=" + expire.toGMTString();
}

function IsThereCookies() {
    testValue = Math.floor(1000 * Math.random());
    SetCookie('AreCookiesEnabled', testValue);
    return (testValue == ReadCookie('AreCookiesEnabled'));
}


function showVariantContent(type, field, index, at) {
    window.open('/show_variant_content.aspx?type=' + type + '&field=' + field + '&index=' + index + '&at=' + at, 'suscriber_legal_notice', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=400,height=250,left=' + ((screen.width - 400) / 2) + ',top=' + ((screen.height - 250) / 2));
}

function ValidatorBefore() {
    if (document.all) {
        var i;
        for (i = 0; i < Page_Validators.length; i++) {
            ValidatorValidate(Page_Validators[i]);
        }
        ValidatorUpdateIsValid();
        Page_BlockSubmit = !Page_IsValid;
        return Page_IsValid;
    }
    else return true;
}


function showPopUp(url) {
    window.open(url, "content_pop_up", "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=755,height=550,left=" + ((screen.width - 755) / 2) + ",top=" + ((screen.height - 550) / 2));
}



/*JQUERY SCRIPTS*/

/*LIVE FOCUS & BLUR*/
(function() {

    var special = jQuery.event.special,
        uid1 = 'D' + (+new Date()),
        uid2 = 'D' + (+new Date() + 1);

    jQuery.event.special.focus = {
        setup: function() {
            var _self = this,
                handler = function(e) {
                    e = jQuery.event.fix(e);
                    e.type = 'focus';
                    if (_self === document) {
                        jQuery.event.handle.call(_self, e);
                    }
                };

            jQuery(this).data(uid1, handler);

            if (_self === document) {
                /* Must be live() */
                if (_self.addEventListener) {
                    _self.addEventListener('focus', handler, true);
                } else {
                    _self.attachEvent('onfocusin', handler);
                }
            } else {
                return false;
            }

        },
        teardown: function() {
            var handler = jQuery(this).data(uid1);
            if (this === document) {
                if (this.removeEventListener) {
                    this.removeEventListener('focus', handler, true);
                } else {
                    this.detachEvent('onfocusin', handler);
                }
            }
        }
    };

    jQuery.event.special.blur = {
        setup: function() {
            var _self = this,
                handler = function(e) {
                    e = jQuery.event.fix(e);
                    e.type = 'blur';
                    if (_self === document) {
                        jQuery.event.handle.call(_self, e);
                    }
                };

            jQuery(this).data(uid2, handler);

            if (_self === document) {
                /* Must be live() */
                if (_self.addEventListener) {
                    _self.addEventListener('blur', handler, true);
                } else {
                    _self.attachEvent('onfocusout', handler);
                }
            } else {
                return false;
            }

        },
        teardown: function() {
            var handler = jQuery(this).data(uid2);
            if (this === document) {
                if (this.removeEventListener) {
                    this.removeEventListener('blur', handler, true);
                } else {
                    this.detachEvent('onfocusout', handler);
                }
            }
        }
    };

})();

function specialsLinksAux(ruta) {
    try {
        var href = $(ruta + " #next").parent().attr("href");
        var nPage2 = parseInt($( ruta + " .paginationBarNumberSelected").html());
        nPrev = nPage2 - 1;
        nNext = nPage2 + 1;
        href = href.replace("np=&l", "np=" + nNext + "&l");
        $(ruta + " #next").parent().attr("href", href);

    }
    catch (e) {

    }

    try {
        var href = $(ruta + " #prev").parent().attr("href");
        var nPage2 = parseInt($( ruta + " .paginationBarNumberSelected").html());
        nPrev = nPage2 - 1;
        nNext = nPage2 + 1;
        href = href.replace("np=&l", "np=" + nPrev + "&l");
        $(ruta + " #prev").parent().attr("href", href);

    }
    catch (e) {

    }
}


function specialsLinksAux2(ruta) {
    try {
        var href = $(ruta + " #next").parent().attr("href");
        var nPage2 = parseInt($( ruta + " .paginationBarNumberSelected").html());
        nPrev = nPage2 - 1;
        nNext = nPage2 + 1;
        href = href.replace("np=&", "np=" + nNext + "&");
        $(ruta + " #next").parent().attr("href", href);

    }
    catch (e) {

    }

    try {
        var href = $(ruta + " #prev").parent().attr("href");
        var nPage2 = parseInt($( ruta + " .paginationBarNumberSelected").html());
        nPrev = nPage2 - 1;
        nNext = nPage2 + 1;
        href = href.replace("np=&", "np=" + nPrev + "&");
        $(ruta + " #prev").parent().attr("href", href);

    }
    catch (e) {

    }
}


function specialsLinksAux3(ruta) {
    try {
        var href = $(ruta + " #next").parent().attr("href");
        var nPage2 = parseInt($( ruta + " .paginationBarNumberSelected").html());
        nPrev = nPage2 - 1;
        nNext = nPage2 + 1;
        href = href.replace("np=&", "np=" + nNext + "&");
        $(ruta + " #next").parent().attr("href", href);

    }
    catch (e) {

    }

    try {
        var href = $(ruta + " #prev").parent().attr("href");
        var nPage2 = parseInt($( ruta + " .paginationBarNumberSelected").html());
        nPrev = nPage2 - 1;
        nNext = nPage2 + 1;
        href = href.replace("np=&", "np=" + nPrev + "&");
        $(ruta + " #prev").parent().attr("href", href);

    }
    catch (e) {

    }
    
    
     $(ruta+" a").each(function() {
        var href = $(this).attr("href");
        
        href = href.replace("ps=undefined", "ps=" + $(".page_size").val());
        
        if (href.indexOf("&ps=")<0)
			href = href+"&ps=" + $(".page_size").val();
        
        $(this).attr("href",href );
    });
    
    
}



function specialsLinks() {

    $(".info .pages a[href*=undefined]").each(function() {
        var href = $(this).attr("href");
        href = href.replace("ps=undefined", "ps=" + $(".page_size").val());
        $(this).attr("href",href );
    });

    specialsLinksAux("#search_disco .info .pages");
    specialsLinksAux("#search_mult .info .pages");
    specialsLinksAux("#search_merch .info .pages");
    specialsLinksAux("#search_news .info .pages");
    specialsLinksAux("#list_news .info .pages");
    specialsLinksAux("#campaign_holder .info .pages");

    specialsLinksAux("#art_disco .info .pages");
    specialsLinksAux("#art_merch .info .pages");
    specialsLinksAux("#art_news .info .pages");
    specialsLinksAux("#art_mult .info .pages");
    specialsLinksAux("#news_list .info .pages");
    
    //specialsLinksAux(".info .pages");
    specialsLinksAux(".info .pagination");
    specialsLinksAux("#category_list_news .info .pages");
    

    specialsLinksAux2(".pagination2");    
    specialsLinksAux3(".pagination3");  

}



function utf8_encode(string) {
    var navegador = navigator.appName
    if (navegador == "Microsoft Internet Explorer") {
        string = string.replace(/\r\n/g, "\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if ((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }
    }
    else {
        utftext = string;
    }
    return utftext;
}

function setPageSize(obj) {



    $("#pagesize").attr("code", $(".page_size").val());
    
}


	

function setPageSizeSearch(obj) {

    var tab = "0";
    switch ($(".ui-state-active a").text()) {
        case "Discografía":
            tab = "0";
            
           
		            
            
            break;
        case "Merch":
            tab = "1";
            
             
            
            
            
            break;
        case "Noticias":
            tab = "2";
            
            
			
            
            
            
            break;
        case "Multimedia":
            tab = "3";
            
             
            
            
            break;
       default :
            tab ="0";
            
           
            
            
            
            break;
    }

    
    url = "/list_search.aspx?search=" + $("#search_mult").attr("searchword") + "&ps=" + $(obj).val() + "&tab=" + tab;

	

    $("#search_page_size a").each(function() {
        $(this).attr("href", url);
    });
    
    

}

function setPageSizeArtist(obj) {

    var tab = "0";
    switch ($(".ui-state-active a").text()) {
        case "Discografía":
            tab = "0";
            break;
        case "Merch":
            tab = "1";
            break;
        case "Noticias":
            tab = "2";
            break;
        case "Multimedia":
            tab = "3";
            break;
        default:
            tab = "0";
            break;
    }

    url = "/artista.aspx?a=" + $("#art_disco").attr("code") + "&ps=" + $(obj).val() + "&tab=" + tab + "&of=" + $("#search_page_size select.order_by").val();

    $("#search_page_size a").each(function() {
        $(this).attr("href", url);
    });

}

function setPageOrderArtist(obj) {

    var tab = "0";
    switch ($(".ui-state-active a").text()) {
        case "Discografía":
            tab = "0";
            break;
        case "Merch":
            tab = "1";
            break;
        case "Noticias":
            tab = "2";
            break;
        case "Multimedia":
            tab = "3";
            break;
        default:
            tab = "0";
            break;
    }

    url = "/artista.aspx?a=" + $("#art_disco").attr("code") + "&ps=" + $(".page_size").val() + "&tab=" + tab + "&of=" + $(obj).val();

    $("#search_page_size a").each(function() {
        $(this).attr("href", url);
    });

}

function setTab(tab) {
    $($(".tabs li")[tab]).addClass("ui-tabs-selected ui-state-active");    
}

function doSearchMerch() {
    
    var psi="12";
    
	if (parseQuery("ps"))
		psi=parseQuery("ps");
	
	
    
    var url = "/merch_search.aspx?tab=1&np=1&l=&sw=" + $("#search_merch").attr("searchword")+"&search=" + $("#search_merch").attr("searchword")+"&ps="+psi;
    
    document.location.href=url;
    
    /*
    
    var url = "/search_merchandising.aspx?np=1&l=&sw=" + $("#search_merch").attr("searchword");
    
    
    $("#search_merch").load(url, function() {
        $("#search_merch .pages a").each(function() {
            this.href = "/search_merchandising.aspx?np=" + $(this).text() + "&l=&sw=" + $("#search_merch").attr("searchword");
        });

        $("#search_page_size select").each(function() {
            $(this).val($("#page_size").attr("pagesize"));
        });

        $("#search_page_link").each(function() {
            $("this").attr("href", "" + sURL + "");
        });

        renderSups();
    });
    
    */
}


function doSearchDisco() {
     
    var psi="12";
    if (parseQuery("ps"))
		psi=parseQuery("ps");
	
	
    var url = "/list_search.aspx?tab=0&np=1&l=&sw=" + $("#search_merch").attr("searchword")+"&search=" + $("#search_merch").attr("searchword")+"&ps="+psi;
    document.location.href=url;
    
    /*
    
    var url = "/search_merchandising.aspx?np=1&l=&sw=" + $("#search_merch").attr("searchword");
    
    
    $("#search_merch").load(url, function() {
        $("#search_merch .pages a").each(function() {
            this.href = "/search_merchandising.aspx?np=" + $(this).text() + "&l=&sw=" + $("#search_merch").attr("searchword");
        });

        $("#search_page_size select").each(function() {
            $(this).val($("#page_size").attr("pagesize"));
        });

        $("#search_page_link").each(function() {
            $("this").attr("href", "" + sURL + "");
        });

        renderSups();
    });
    
    */
}

function doSearchNews() {
	
	 
    var psi="12";
    if (parseQuery("ps"))
		psi=parseQuery("ps");
	
	
	var url = "/noticias_search.aspx?tab=2&np=1&l=&sw=" + $("#search_merch").attr("searchword")+"&search=" + $("#search_merch").attr("searchword")+"&ps="+psi;
    document.location.href=url;
    
    /*
    
    var url = "/search_noticias.aspx?np=1&l=&sw=" + $("#search_merch").attr("searchword");
    $("#search_news").load(url, function() {
    $("#search_news .pages a").each(function() {
    this.href = "/search_noticias.aspx?np=" + $(this).text() + "&l=&sw=" + $("#search_merch").attr("searchword");
        });

        $("#search_page_size select").each(function() {
            $(this).val($("#page_size").attr("pagesize"));
        });

        $("#search_page_link").each(function() {
            $("this").attr("href", "" + sURL + "");
        });

        renderSups();
    });
    
    */
}


function doSearchMult() {

	 
    var psi="12";
    if (parseQuery("ps"))
		psi=parseQuery("ps");
	
	
	var url = "/multimedia_search.aspx?tab=3&np=1&l=&sw=" + $("#search_merch").attr("searchword")+"&search=" + $("#search_merch").attr("searchword")+"&ps="+psi;
    document.location.href=url;
	
	/*
    var url = "/search_multimedia.aspx?np=1&l=&sw=" + $("#search_merch").attr("searchword");
    $("#search_mult").load(url, function() {
    $("#search_mult .pages a").each(function() {
    this.href = "/search_multimedia.aspx?np=" + $(this).text() + "&l=&sw=" + $("#search_merch").attr("searchword");
        });

        $("#search_mult select").each(function() {
            $(this).val($("#page_size").attr("pagesize"));
        });

        $("#search_page_link").each(function() {
            $("this").attr("href", "" + sURL + "");
        });

        renderSups();
    });
    
    */
}

$(document).ready(function() {

    //Commented:
    //setPageSize();
    $(".page_size").val($("#pagesize").attr("code"));
    $(".order_by").val($("#order").attr("code"));

    setPageSizeArtist($(".page_size"));

    /* SPOTIFY LINKS PRODUCT */
    $(".track a[href*=spotify]").each(function() {
        $(this).attr("target", "_blank");
    });
    /********************************/

    /*HEADER BANNERS BEHAVIOUR*/
    $("#header_cycle").cycle({
        timeout: 14000,
        pager: "#pager"
    });

    /*MENU NAVIGATION BEHAVIOUR*/
    $(".left .nav > .nav_item:has(ul)").find("ul > li").addClass("menu_title");
    $(".left .nav > .nav_item > ul > li:has(ul)").removeClass().addClass("head_menu_title");
    $(".left .nav .nav_item:last").css("border", "none");
    $(".left .nav > .nav_item > h2").click(function() {
        if ($(this).next("ul").is(":hidden")) {
            $(".left .nav > .nav_item > h2").removeClass("selected");
            $(this).addClass("selected");
            $(".left .nav > .nav_item > ul:not(:hidden)").animate({ "height": "toggle" }, "normal", "easeInBack");
            $(this).next("ul").animate({ "height": "toggle" }, "normal", "easeOutBack");
        }
        else {
            $(".left .nav > .nav_item > h2").removeClass("selected");
            $(this).next("ul").animate({ "height": "toggle" }, "normal", "easeInBack");
        }
    });
    $(".left .nav > .nav_item > ul > li > h2").click(function() {
        if ($(this).next("ul").is(":hidden")) {
            $(this).parent().parent().find("li > h2").removeClass("selected");
            $(this).addClass("selected");
            $(this).parent().parent().find("li ul:not(:hidden)").animate({ "height": "toggle" }, "normal", "swing");
            $(this).next("ul").animate({ "height": "toggle" }, "normal", "easeOutBack");
        }
        else {
            $(this).parent().parent().find("li > h2").removeClass("selected");
            $(this).next("ul").animate({ "height": "toggle" }, "normal", "easeInBack");
        }
    });
    $(".left .nav h2[code=" + $("#cur_category").text() + "]").addClass("current").parents("ul").show().prev("h2").addClass("selected");

    /*TOP UNIVERSAL TABS BEHAVIOUR*/
    $(".top_universal").tabs(
    
    {
    select: function(event, ui) {
    
		
        var url = $.data(ui.tab, 'load.tabs');
                        
        if( url ) {
        	
            location.href = url;
            return false;
        }
        
        return true;
    }
}
    
    );

    /*PRICES WITH SMALL DECIMALS*/
    function renderSups() {
        $(".price_with_sup").each(function() {
            $(this).html(formatDecimals($(this).text()));
        });
        function formatDecimals(txt) {
            iComma = txt.indexOf(",");
            sDec = txt.substring(iComma, iComma + 3);
            txt = txt.replace(sDec, "<sup>" + sDec + "</sup>");
            return txt;
        }
    }
    renderSups();

    
    /*PAGINATION BEHAVIOUR*/
    
    
    
    $(".pagination a").each(function() {
       var order = $("#category_list select.order_by").val();   
        this.href = "/list.aspx?np=" + $(this).text() + "&c=" + $("#cur_list_category").attr("code") + "&ps=" + $("#pagesize").attr("code")+ "&i=" + order;
    });
    
    

    $(".pagination2 a").each(function() {

	if($("#search").attr("code")!="")
	        this.href = "/list.aspx?np=" + $(this).text() + "&search=" + $("#search").attr("code") + "&ps=" + $("#pagesize").attr("code");
	else
		this.href = "/list.aspx?np=" + $(this).text() + "&advs=1" + "&ps=" + $("#pagesize").attr("code");

    });





    /*PAGINACION DE 10 EN 10*/
    
    
    
    var nPage = parseInt($(".pagination .paginationBarNumberSelected").text());
    nPrev = nPage - 1;
    nNext = nPage + 1;
if($("#category_list select.order_by").size()>0){
    var order = $("#category_list select.order_by").val();

    var url = "/list.aspx?np=" + nNext + "&c=" + $("#cur_list_category").attr("code") + "&ps=" + $("#pagesize").attr("code")+ "&i=" + order;
    $("#next").parent(".pagination a").attr("href", url);
    $("#next").css("line-height", "12px");
    $("#next").css("vertical-align", "middle");
    url = "/list.aspx?np=" + nPrev + "$c=" + $("#cur_list_category").attr("code") + "&ps=" + $("#pagesize").attr("code")+ "&i=" + order;
    $("#prev").parent(".pagination a").attr("href", url);
    $("#prev").css("line-height", "12px");
    $("#prev").css("vertical-align", "middle");
    //$("#prev").parent(".pagination a").css("float", "left");
}







    /********************************************/



 
 
    $(".order_by_button").live("click", function() {
    
    	
		
    
        var order = $("#category_list select.order_by").val();
        url = "/list.aspx?np=1&c=" + $("#cur_list_category").attr("code") + "&ps=" + $("#pagesize").attr("code") + "&i=" + order;
        document.location = url;
        
//        iPagWidth = $("#category_list .order_holder").width();
//        $("#category_list .order_holder").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        
//        $("#category_list").load(url + " .list", function() {

//            $(".page_size").val($("#pagesize").attr("code"));


//            $("#category_list select.order_by").val(order);
//            renderSups();
//            $("#category_list .pagination a").each(function() {
//                this.href = "/list.aspx?np=" + $(this).text() + "&l=&c=" + $("#cur_list_category").attr("code") + "&of=" + $("#category_list select.order_by").val() + "&ps=" + $("#pagesize").attr("code") + "&or=" + order;
//            });
//        });
    });




    /*******************************************************/
    //Commented
    
    $("#category_list_news .info .pages a").each(function() {
         //alert(this.href);
         var urlPages = this.href;
         urlPages = urlPages + "&order=" + $("#order").attr("code");
         this.href = urlPages ;
         //alert(this.href);
    });

    $("#category_list_news .order_by_button").live("click", function() {

        var order = $("#category_list_news select.order_by").val();
           
            url = "/list_new.aspx?l=" + lParamListNew + "&c=" + $("#cur_list_category").attr("code") + "&ca=" + $("#catalogue").attr("code") + "&w=" + $("#week").attr("code") + "&y=" + $("#year").attr("code") + "&order=" + order + "&ps=" + $("#pagesize").attr("code");
            document.location = url;
            
//        url = "/list_async.aspx?l=1&c=" + $("#cur_list_category").attr("code") + "&type=" + $("#type").attr("code") + "&template=" + $("#template").attr("code") + "&ca=" + $("#catalogue").attr("code") + "&w=" + $("#week").attr("code") + "&y=" + $("#year").attr("code") + "&order=" + order + "&ps=" + $("#pagesize").attr("code");

//        iPagWidth = $("#category_list_news .order_holder").width();

//        $("#category_list_news .order_holder").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);

//        $("#category_list_news").load(url + " .list", function() {

//            //IMPORTACION
//            $(".imported").css("display", "none");

//            $(".page_size").val($("#pagesize").attr("code"));

//            $("#category_list_news select.order_by").val(order);

//            renderSups();
//            $("#category_list_news .pages a").each(function() {
//                url = "/list_async.aspx?np=" + $(this).text() + "&l=1&c=" + $("#cur_list_category").attr("code") + "&type=" + $("#type").attr("code") + "&template=" + $("#template").attr("code") + "&ca=" + $("#catalogue").attr("code") + "&w=" + $("#week").attr("code") + "&y=" + $("#year").attr("code") + "&order=" + order + "&ps=" + $("#pagesize").attr("code");

//                this.href = url;
//            });
//        });
    });
    /*******************************************************/



    /*THUMBNAILS CAROUSEL*/
    $(".carousel li img[src*=no_image]").remove();
    $(".carousel li a:empty").remove();
    $(".carousel li").each(function() {
        if (!$(this).children().size()) {
            $(this).remove();
        }
    });
    if ($(".carousel ul").is(":empty")) {
        $(".carousel_left").remove();
        $(".carousel").remove();
        $(".carousel_right").remove();
    }
    else {
        $(".carousel").jCarouselLite({
            btnNext: ".carousel_right span",
            btnPrev: ".carousel_left span",
            circular: false,
            visible: 3
        });
        if ($(".carousel li").size() <= 3) $(".carousel_right span").addClass("disabled");
    }

    /*IMAGE ZOOM*/
    $(".fancybox[href*=no_image]").remove();
    if (!$(".fancybox").size()) $(".zoom_image").remove();
    $(".fancybox").fancybox({
        overlayOpacity: 0.4,
        showCloseButton: false
    });


    $(".fancyboxcupon").fancybox({
	frameWidth: 800,
	frameHeight: 500,
	autoDimensions: true,
	scrolling: 'no',
	overlayOpacity: 0.4,
	hideOnContentClick: false
		
    });


    $(".zoom_image").click(function() {
        $(".fancybox[code=" + $("#large_image").attr("code") + "]").trigger("click");
        return false;
    });

    /*IMAGE SWAP*/
    $(".swap_images").click(function() {
        if ($(this).attr("code") == $("#large_image").attr("code")) {
            return false;
        }
        src = this.href;
        code = $(this).attr("code");
        $("#large_image").fadeOut("normal", function() {
            $(this).remove();
            $image = $(document.createElement("img")).attr("src", src).attr("code", code).attr("id", "large_image");
            $(".product .image_holder").append($image);
        });
        return false;
    });

    /*PRODUCT TABS*/
    $(".product_tabs .tabs a").each(function() {
        if ($(".product_tabs #cont_" + this.id).is(":empty")) {
            $(".product_tabs #cont_" + this.id).remove();
            $(this).remove();
        }
    });
    $(".product_tabs .tabs a").click(function() {
        $(".product_tabs .tabs a").removeClass("selected");
        $(this).addClass("selected");
        $(".product_tabs .content").hide();
        $(".product_tabs #cont_" + this.id).show();
        return false;
    });
    $(".product_tabs .tabs a:first").trigger("click");

    /*QUANTITY INPUTS*/
    $(".variant_quantity, .productQuantity, .quick_quantity, .campaign_quantity").live("keypress", isNumeric);
    function isNumeric(evt, obj) {
        var charCode;
        try { charCode = (evt.which) ? evt.which : event.keyCode; }
        catch (e) { charCode = 0; }
        if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
        return true;
    }
    $(".variant_quantity, .productQuantity, .quick_quantity, .campaign_quantity").live("blur", function() {
        if ($(this).val() == "") $(this).val(0);
    });
    $(".variant_quantity, .productQuantity, .quick_quantity, .campaign_quantity").live("focus", function() {
        if ($(this).val() == 0) $(this).val("");
    });

    /*VARIANT BUY*/
    $("#buy_variant").click(function() {
        sQ = "";
        sP = "";
        $(".variant_quantity").each(function() {
            q = $(this).val();
            if (q > 0) {
                sQ += q + "|";
                sP += $(this).attr("code") + "|";
            }
        });
        document.location.href = "/action_ex.aspx?p=" + sP + "&q=" + sQ + "&referer=" + document.location.href;
        return false;
    });

    /*CAMPAIGN BUY*/
    $(".campaign_buy").click(function() {
        sP = $(this).siblings(".campaign_quantity").attr("code");
        sQ = $(this).siblings(".campaign_quantity").val();
        if (sQ > 0) {
            document.location.href = "/action_ex.aspx?p=" + sP + "&q=" + sQ + "&referer=" + document.location.href;
        }
        return false;
    });

    /*QUICK ORDER RENDER*/
    $("#quick_holder").each(function() {
        for (i = 0; i < 10; i++) {
            $line = $(document.createElement("div")).addClass("quick_line");
            $line.html($(".quick_order_line").html());
            $(this).append($line);
        }
        $(this).children(".quick_line:even").css("background", "#242424");
    });
    $(".more_button a").click(function() {
        $line = $(document.createElement("div")).addClass("quick_line").hide();
        $line.html($(".quick_order_line").html());
        $("#quick_holder").append($line);
        $("#quick_holder").children(".quick_line:even").css("background", "#242424");
        $line.slideDown();
        return false;
    });

    /*QUICK ORDER EAN SEARCH*/
    $(".ean_code").live("keypress", isNumeric);
    $(".ean_code").live("blur", function() {
        if ($(this).val() != "" && $(this).attr("ean") != $(this).val()) {
            $(this).attr("ean", $(this).val());
            $this = $(this);
            $(this).parent(".cell_code").siblings(".cell_message").load("/find_ean.aspx?ean=" + $(this).val(), function() {
                code = $this.parent(".cell_code").siblings(".cell_message").children(".code").text();
                $quant = $this.parent(".cell_code").siblings(".cell_quantity").children(".quick_quantity");
                if ($quant.val() != 0 && $quant.val() != "") $quant.val(0);
                $quant.attr("code", code);
            });
        }
    });

    /*QUICK ORDER BUY*/
    $(".quick_order").click(function() {
        sQ = "";
        sP = "";
        $(".quick_quantity").each(function() {
            if ($(this).attr("code") != 0 && $(this).attr("code") != "") {
                q = $(this).val();
                if (q > 0) {
                    sQ += q + "|";
                    sP += $(this).attr("code") + "|";
                }
            }
        });
        document.location.href = "/action_ex.aspx?p=" + sP + "&q=" + sQ + "&referer=/basket.aspx";
        return false;
    });

    /*NEWS PAGINATION LINKS*/
    $("#news_list .pages a").each(function() {
        //this.href = "/list_noticias.aspx?m=" + $("#cur_news_display").attr("month") + "&y=" + $("#cur_news_display").attr("year") + "&np=" + $(this).text() + "&l";
        //this.href = "/noticias.aspx?m=" + $("#cur_news_display").attr("month") + "&y=" + $("#cur_news_display").attr("year") + "&np=" + $(this).text() + "&l";
        this.href = "/noticias.aspx?m=" + $("#news_month").attr("code") + "&y=" + $("#news_year").attr("code") + "&np=" + $(this).text() + "&l";
    });
    
    //Commented
//    $("#news_list .pages a").live("click", function() {

//        iPagWidth = $("#news_list .pages").width();
//        $("#news_list .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);

//        $("#news_list").load(this.href, function() {
//            $("#news_list .pages a").each(function() {
//            this.href = "/list_noticias.aspx?m=" + $("#cur_news_display").attr("month") + "&y=" + $("#cur_news_display").attr("year") + "&np=" + $(this).text() + "&l";
//            });
//            renderSups();
//        });
//        return false;
//    });

    /*CAMPAIGN PAGINATION LINKS*/
    $("#campaign_holder .pages a").each(function() {
        this.href = "/campaign_list.aspx?ca=" + $("#cur_campaign_display").attr("campaign") + "&n=" + $("#cur_campaign_display").attr("pagenumber") + "&f=" + $("#cur_campaign_display").attr("orderfield") + "&np=" + $(this).text() + "&l";
    });
    /*$("#campaign_holder .pages a").live("click", function() {
        iPagWidth = $("#campaign_holder .pages").width();
        $("#campaign_holder .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#campaign_holder").load(this.href, function() {
            $("#campaign_holder .pages a").each(function() {
                this.href = "/campaign_list.aspx?ca=" + $("#cur_campaign_display").attr("campaign") + "&n=" + $("#cur_campaign_display").attr("pagenumber") + "&f=" + $("#cur_campaign_display").attr("orderfield") + "&np=" + $(this).text() + "&l";
            });
            renderSups();
        });
        return false;
    });
	*/
	
    /*ARTIST PAGINATION LINKS*/
    $("#art_disco .pages a").each(function() {
        //this.href = "/discografia.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_disco").attr("code") + "&of=" + $("#art_disco select.order_by").val();
        this.href = "/artista.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_mult").attr("code") + "&of=" + $("#art_mult select.order_by").val() + "&ps=" + $(".page_size").val() + "&tab=0" ;
    });
//    $("#art_disco .pages a").live("click", function() {
//        iPagWidth = $("#art_disco .pages").width();
//        order = $("#art_disco select.order_by").val();
//        $("#art_disco .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
//        $("#art_disco").load(this.href, function() {
//            $("#art_disco select.order_by").val(order);
//            $("#art_disco .pages a").each(function() {
//                this.href = "/discografia.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_disco").attr("code") + "&of=" + $("#art_disco select.order_by").val();
//            });
//            renderSups();
//        });
//        return false;
//    });

    $("#art_disco .order_by_button").live("click", function() {
        url = "/discografia.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_disco").attr("code") + "&of=" + $("#art_disco select.order_by").val();
        order = $("#art_disco select.order_by").val();
        iPagWidth = $("#art_disco .order_holder").width();
        $("#art_disco .order_holder").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#art_disco").load(url, function() {
            $("#art_disco select.order_by").val(order);
            $("#art_disco .pages a").each(function() {
                this.href = "/discografia.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_disco").attr("code") + "&of=" + $("#art_disco select.order_by").val();
            });
            renderSups();
        });
    });


    $("#art_merch .pages a").each(function() {
        //this.href = "/merchandising.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_merch").attr("code") + "&of=" + $("#art_merch select.order_by").val();
        this.href = "/artista.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_mult").attr("code") + "&of=" + $("#art_mult select.order_by").val() + "&ps=" + $(".page_size").val() + "&tab=1" ;
    });
//    $("#art_merch .pages a").live("click", function() {
//        iPagWidth = $("#art_merch .pages").width();
//        order = $("#art_merch select.order_by").val();
//        $("#art_merch .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
//        $("#art_merch").load(this.href, function() {
//            $("#art_merch select.order_by").val(order);
//            $("#art_merch .pages a").each(function() {
//                this.href = "/merchandising.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_merch").attr("code") + "&of=" + $("#art_merch select.order_by").val();
//            });
//            renderSups();
//        });
//        return false;
//    });
    $("#art_merch .order_by_button").live("click", function() {
        url = "/merchandising.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_merch").attr("code") + "&of=" + $("#art_merch select.order_by").val();
        order = $("#art_merch select.order_by").val();
        iPagWidth = $("#art_merch .order_holder").width();
        $("#art_merch .order_holder").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#art_merch").load(url, function() {
            $("#art_merch select.order_by").val(order);
            $("#art_merch .pages a").each(function() {
                this.href = "/merchandising.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_merch").attr("code") + "&of=" + $("#art_merch select.order_by").val();
            });
            renderSups();
        });
    });


    $("#art_news .pages a").each(function() {
        //this.href = "/art_noticias.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_news").attr("code") + "&of=" + $("#art_news select.order_by").val();
        this.href = "/artista.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_mult").attr("code") + "&of=" + $("#art_mult select.order_by").val() + "&ps=" + $(".page_size").val() + "&tab=2" ;
    });
//    $("#art_news .pages a").live("click", function() {
//        iPagWidth = $("#art_news .pages").width();
//        order = $("#art_news select.order_by").val();
//        $("#art_news .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
//        $("#art_news").load(this.href, function() {
//            $("#art_news select.order_by").val(order);
//            $("#art_news .pages a").each(function() {
//                this.href = "/art_noticias.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_news").attr("code") + "&of=" + $("#art_news select.order_by").val();
//            });
//            renderSups();
//        });
//        return false;
//    });
    $("#art_news .order_by_button").live("click", function() {
        url = "/art_noticias.aspx?np=1&a=" + $("#art_news").attr("code") + "&of=" + $("#art_news select.order_by").val();
        order = $("#art_news select.order_by").val();
        iPagWidth = $("#art_news .order_holder").width();
        $("#art_news .order_holder").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#art_news").load(url, function() {
            $("#art_news select.order_by").val(order);
            $("#art_news .pages a").each(function() {
                this.href = "/art_noticias.aspx?np=" + $(this).text() + "&a=" + $("#art_news").attr("code") + "&of=" + $("#art_news select.order_by").val();
            });
            renderSups();
        });
    });


    $("#art_mult .pages a").each(function() {
        //this.href = "/multimedia.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_mult").attr("code") + "&of=" + $("#art_mult select.order_by").val();
        this.href = "/artista.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_mult").attr("code") + "&of=" + $("#art_mult select.order_by").val() + "&ps=" + $(".page_size").val() + "&tab=3" ;
    });
//    $("#art_mult .pages a").live("click", function() {
//        iPagWidth = $("#art_mult .pages").width();
//        order = $("#art_mult select.order_by").val();
//        $("#art_mult .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
//        $("#art_mult").load(this.href, function() {
//            $("#art_mult select.order_by").val(order);
//            $("#art_mult .pages a").each(function() {
//                this.href = "/multimedia.aspx?np=" + $(this).text() + "&l=&a=" + $("#art_mult").attr("code") + "&of=" + $("#art_mult select.order_by").val();
//            });
//            renderSups();
//        });
//        return false;
//    });
    $("#art_mult .order_by_button").live("click", function() {
        url = "/multimedia.aspx?np=1&a=" + $("#art_mult").attr("code") + "&of=" + $("#art_mult select.order_by").val();
        order = $("#art_mult select.order_by").val();
        iPagWidth = $("#art_mult .order_holder").width();
        $("#art_mult .order_holder").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#art_mult").load(url, function() {
            $("#art_mult select.order_by").val(order);
            $("#art_mult .pages a").each(function() {
                this.href = "/multimedia.aspx?np=" + $(this).text() + "&a=" + $("#art_mult").attr("code") + "&of=" + $("#art_mult select.order_by").val();
            });
            renderSups();
        });
    });

    /*NOVEDADES LIST LINKS*/
    $(".novedades_holder").each(function() {


        $link = $(this).find(".link a");
        href = $link.attr("href");
        $link.attr("href", href + "&ca=" + $(".novedades_holder").attr("catalogue") + "&y=" + $(".novedades_holder").attr("year") + "&w=" + $(".novedades_holder").attr("week"));
    });

    /*ARCHIVE TABS BEHAVIOUR*/
    $(".archive").tabs();

    $(".archive").bind("tabsselect", function(event, ui) {
        $("#history_cur_year").text($(ui.tab).text());
    });

    /*ARCHIVE PAGINATION LINKS*/
    $("#archive_list .pages a").each(function() {
        this.href = "/list_new.aspx?np=" + $(this).text() + "&l=" + $("#archive_list").attr("type") + "&ca=" + $("#archive_list").attr("catalogue") + "&y=" + $("#archive_list").attr("year") + "&w=" + $("#archive_list").attr("week") + "&ps=" + $("#pagesize").attr("code") + "&order=" + $("#order").attr("code");
    });
    
    //Commented
//    $("#archive_list .pages a").live("click", function() {

//        iPagWidth = $("#archive_list .pages").width();
//        $("#archive_list .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);

//        //$("#archive_list").load(this.href + " .list", function() {
//        $("#category_list_news").load(this.href + " .list", function() {
//            $("#archive_list .pages a").each(function() {
//                this.href = "/list_new.aspx?np=" + $(this).text() + "&l=" + $("#archive_list").attr("type") + "&ca=" + $("#archive_list").attr("catalogue") + "&y=" + $("#archive_list").attr("year") + "&w=" + $("#archive_list").attr("week") + "&ps=" + $("#pagesize").attr("code");
//            });
//            renderSups();
//        });
//        return false;
//    });

     /*SEARCH PAGINATION LINKS*/
     
    
     $("#search_disco .pages a").each(function() {
        this.href = "/list_search.aspx?tab=0&np=" + $(this).text() + "&l=&sw=" + utf8_encode($("#search_disco").attr("searchword"))+"&search=" + utf8_encode($("#search_disco").attr("searchword"))+"&ps="+pagesizeact();
    });
	/*
    $("#search_disco .pages a").live("click", function() {
        iPagWidth = $("#search_disco .pages").width();
        $("#search_disco .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#search_disco").load(this.href, function() {
            $("#search_disco .pages a").each(function() {
                this.href = "/search_discografia.aspx?np=" + $(this).text() + "&l=&sw=" + utf8_encode($("#search_disco").attr("searchword"));
            });

            $("#search_page_size select").each(function() {
                $(this).val($("#page_size").attr("pagesize"));
            });

            $("#search_page_link").each(function() {
                $("this").attr("href", "" + sURL + "");
            });

            renderSups();
        });
        return false;
    });
	*/

    $("#search_merch .pages a").each(function() {
        this.href = "/merch_search.aspx?tab=1&np=" + $(this).text() + "&l=&sw=" + $("#search_merch").attr("searchword")+"&search=" + utf8_encode($("#search_merch").attr("searchword"))+"&ps="+pagesizeact();
    });
    /*
    $("#search_merch .pages a").live("click", function() {
        iPagWidth = $("#search_merch .pages").width();
        $("#search_merch .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#search_merch").load(this.href, function() {
            $("#search_merch .pages a").each(function() {
                this.href = "/search_merchandising.aspx?np=" + $(this).text() + "&l=&sw=" + $("#search_merch").attr("searchword");
            });

            $("#search_page_size select").each(function() {
                $(this).val($("#page_size").attr("pagesize"));
            });

            $("#search_page_link").each(function() {
                $("this").attr("href", "" + sURL + "");
            });

            renderSups();
        });
        return false;
    });
	*/

    $("#search_news .pages a").each(function() {
        this.href = "/noticias_search.aspx?tab=2&np=" + $(this).text() + "&l=&sw=" + $("#search_news").attr("searchword")+"&search=" + utf8_encode($("#search_news").attr("searchword"))+"&ps="+pagesizeact();
    });
	
	/*
    $("#search_news .pages a").live("click", function() {
        iPagWidth = $("#search_news .pages").width();
        $("#search_news .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#search_news").load(this.href, function() {
            $("#search_news .pages a").each(function() {
                this.href = "/search_noticias.aspx?np=" + $(this).text() + "&l=&sw=" + $("#search_news").attr("searchword");
            });

            $("#search_page_size select").each(function() {
                $(this).val($("#page_size").attr("pagesize"));
            });

            $("#search_page_link").each(function() {
                $("this").attr("href", "" + sURL + "");
            });

            renderSups();
        });
        return false;
    });
	*/

    $("#search_mult .pages a").each(function() {
        this.href = "/multimedia_search.aspx?tab=3&np=" + $(this).text() + "&l=&sw=" + $("#search_mult").attr("searchword")+"&search=" + utf8_encode($("#search_mult").attr("searchword"))+"&ps="+pagesizeact();
    });
    /*
    $("#search_mult .pages a").live("click", function() {
        iPagWidth = $("#search_mult .pages").width();
        $("#search_mult .pages").html("").css("background", "url(/images/loading.gif) no-repeat right center").height(34).width(iPagWidth);
        $("#search_mult").load(this.href, function() {
            $("#search_mult .pages a").each(function() {
                this.href = "/search_multimedia.aspx?np=" + $(this).text() + "&l=&sw=" + $("#search_mult").attr("searchword");
            });

            $("#search_page_size select").each(function() {
                $(this).val($("#page_size").attr("pagesize"));
            });

            $("#search_page_link").each(function() {
                $("this").attr("href", "" + sURL + "");
            });

            renderSups();
        });
        return false;
    });
    */
    
    

    
 
    
    /***************************/

    setInterval("specialsLinks()", 1000);


    $("#search_page_size select").each(function() {
        $(this).val($("#page_size").attr("pagesize"));
    });


	function pagesizeact(){
		if (parseQuery("ps"))
			return parseQuery("ps");
		else
			return $(".page_size").val();	
	}

	
	function pagesizeact2(){
		if ($(".page_size").size()>0)
			return $(".page_size").val();
		else
			return "12";	
	}

});           //end



function duration(ai_isec){

var sec = ai_isec;
var min = Math.floor(sec/60);
sec = sec % 60;
if(sec<10) sec = "0" + sec;
if(min<10) min = "0" + min;
return min + ":" + sec;

}


$(".order_by_button_search").live("click", function() {
    
	if ($("#search").attr("code")!="")
	        url = "/list.aspx?np=1&search=" + $("#search").attr("code") + "&ps=" + $("#pagesize").attr("code") ;
	else
	        url = "/list.aspx?np=1&advs=1" + "&ps=" + $("#pagesize").attr("code") ;
        document.location = url;
        

    });


$(".order_by_button_search3").live("click", function() {
    
	    url = "/tag_list.aspx?np=1&tag=" + parseQuery("tag") + "&ps=" + $(".page_size").val();
	    document.location = url;
        

    });

