var arrangebyac = "mostrecent";



String.prototype.startsWith = function (str) {
    return (this.match("^" + str) == str)
}



String.prototype.endsWith = function (str) {
    return (this.match(str + "$") == str)
}









function getStyleFootherCat()

{

    try {

        document.getElementById("footer").className = "footercat";

    } catch (exe)

    {

        setTimeout("getStyleFootherCat()", 800);

    }

}





function obtainParam(name)



{



    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");



    var regexS = "[\\?&]" + name + "=([^&#]*)";



    var regex = new RegExp(regexS);



    var results = regex.exec(window.location.href);



    if (results == null)



    return "";



    else



    return results[1];



}











function _sortby(sortby, srchome)



{



    var redirect;

    var typer = 0;



    catjs = catjs.toLowerCase();







    if (catjs == "the lab")



    {



        if (sortby == "PRINT")



        {



            redirect = srchome + "/category/all/thelab/tl_print"



        } else if (sortby == "INTERACTIVE")



        {



            redirect = srchome + "/category/all/thelab/tl_interactive"



        } else if (sortby == "BRANDING")



        {



            redirect = srchome + "/category/all/thelab/tl_branding"



        } else if (sortby == "MOTION")



        {



            redirect = srchome + "/category/all/thelab/tl_motion"



        } else if (sortby == "ART")



        {



            redirect = srchome + "/category/all/thelab/tl_art"



        } else if (sortby == "ALL")



        {



            redirect = srchome + "/category/all/thelab/"



        }



    } else if (catjs == "portafolio")



    {



        if (sortby == "PRINT")



        {



            redirect = srchome + "/category/all/portafolio/po_print"



        } else if (sortby == "INTERACTIVE")



        {



            redirect = srchome + "/category/all/portafolio/po_interactive"



        } else if (sortby == "BRANDING")



        {



            redirect = srchome + "/category/all/portafolio/po_branding"



        } else if (sortby == "MOTION")



        {



            redirect = srchome + "/category/all/portafolio/po_motion"



        } else if (sortby == "ART")



        {



            redirect = srchome + "/category/all/portafolio/po_art"



        } else if (sortby == "ALL")



        {



            redirect = srchome + "/category/all/portafolio/"



        }



    } else if (catjs == "notes from the lab")



    {



        if (sortby == "PRINT")



        {



            redirect = srchome + "/category/all/articles/no_print"



        } else if (sortby == "INTERACTIVE")



        {



            redirect = srchome + "/category/all/articles/no_interactive"



        } else if (sortby == "BRANDING")



        {



            redirect = srchome + "/category/all/articles/no_branding"



        } else if (sortby == "MOTION")



        {



            redirect = srchome + "/category/all/articles/no_motion"



        } else if (sortby == "ART")



        {



            redirect = srchome + "/category/all/articles/no_art"



        } else if (sortby == "ALL")



        {



            redirect = srchome + "/category/all/notesfromthelab/"



        }



    } else if (catjs == "ALL" || catjs == "all")



    {



        typer = 1;



        if (sortby == "PRINT")



        {



            redirect = srchome + "/?categorysortby=print";



        } else if (sortby == "INTERACTIVE")



        {



            redirect = srchome + "/?categorysortby=interactive";



        } else if (sortby == "BRANDING")



        {



            redirect = srchome + "/?categorysortby=branding";



        } else if (sortby == "MOTION")



        {



            redirect = srchome + "/?categorysortby=motion";



        } else if (sortby == "ART")



        {



            redirect = srchome + "/?categorysortby=art";



        } else if (sortby == "ALL")



        {



            redirect = srchome;



        }







    }	


    if (typer == 0) {



        try {



            window.location = redirect;



        } catch (exe)



        {



            document.location = redirect;



        }

    } else if (typer == 1)

    {



        try {



            window.location = redirect;



        } catch (exe)



        {



            document.location = redirect;



        }

    }



}







function allrepaint()



{



    document.getElementById("SALL").style.color = "#8D8D8D";



    document.getElementById("SALL").style.fontWeight = "";



}





var subcat;

var valuesub;

function selectSub(category)



{



    subcat = "SALL";



    if (category.endsWith("print"))



    {



        subcat = "SPRINT";



    } else if (category.endsWith("interactive"))



    {



        subcat = "SINTERACTIVE";



    } else if (category.endsWith("branding"))



    {



        subcat = "SBRANDING";



    } else if (category.endsWith("motion"))



    {



        subcat = "SMOTION";



    } else if (category.endsWith("art"))



    {



        subcat = "SART";







    } else



    {



        subcat = "SALL";



    }



    document.getElementById(subcat).style.color = "#42413C";



    document.getElementById(subcat).style.fontWeight = "BOLD";



    valuesub = category;



    try {



        if (category.startsWith("tl_"))



        catjs = "the lab";



        if (category.startsWith("po_"))



        catjs = "portafolio";



        if (category.startsWith("no_"))



        catjs = "notes from the lab";



        document.getElementById(catjs.toLowerCase()).style.color = "#42413C";



        document.getElementById(catjs.toLowerCase()).style.fontWeight = "BOLD";



    } catch (exe)



    {



        alert(exe);



    }







    //determineArrange();
    //alert(category);	



}



/*function writeCookie()

{

//	deleteCookie("routeindelible","","");

	// document.cookie="routeindelible="+catjs+","+subcat;

	deleteCookie('routeindelible'); 

	

	setCookie("routeindelible",""+catjs+","+subcat,10);

	

	//alert("Escribire: "+catjs+"---"+subcat);

}

*/







function reload()

{

    try {

        window.location = window.location;



    } catch (exec)

    {



        document.location = document.location;

    }



}





function mostRecentIndelible()



{

    //note quitar return para activarla
    return;
    $.cookie("tp", null);

    $.cookie("tp", "mostrecent");

    reload();

}



function mostPopularIndelible()



{
    //note quitar return para activarla
    return;
    $.cookie("tp", null);

    $.cookie("tp", "mostpopular");

    reload();

}





function mostrecentdisplay()

{

    //note quitar return para activarla
    return;
    document.getElementById("AMOSTRECENT").style.color = "#42413C";

    document.getElementById("AMOSTRECENT").style.fontWeight = "BOLD";

    arrangebyac = "mostrecent";

}



function mostpopulardisplay()

{
    //note quitar return para activarla
    return;
    document.getElementById("AMOSTPOPULAR").style.color = "#42413C";

    document.getElementById("AMOSTPOPULAR").style.fontWeight = "BOLD";

    arrangebyac = "mostpopular";

}



function determineArrange()

{

    //note quitar return para activarla
    return;

    var loc;

    try {

        loc = window.location.href;

    } catch (exe)

    {

        loc = document.location.href;

    }

    loc = loc.split("?");

    if (loc.length == 1)

    {

        document.getElementById("AMOSTRECENT").style.color = "#42413C";

        document.getElementById("AMOSTRECENT").style.fontWeight = "BOLD";

        arrangebyac = "mostrecent";

    } else

    if (loc.length > 1)

    {

        if (loc[1] == "mostrecent")

        {

            document.getElementById("AMOSTRECENT").style.color = "#42413C";

            document.getElementById("AMOSTRECENT").style.fontWeight = "BOLD";

            arrangebyac = "mostrecent";

        } else

        if (loc[1] == "mostpopular")

        {

            document.getElementById("AMOSTPOPULAR").style.color = "#42413C";

            document.getElementById("AMOSTPOPULAR").style.fontWeight = "BOLD";

            arrangebyac = "mostpopular";

        }

    }

}





function openurl(dir)

{

    try {

        window.location = homed + dir;

    } catch (exec)

    {

        document.location = homed + dir;

    }

}



function __readCookie(name)

{





    var theCookie = "" + document.cookie;

    var ind = theCookie.indexOf(name);

    if (ind == -1 || name == "") return null;

    var ind1 = theCookie.indexOf(';', ind);

    if (ind1 == -1) ind1 = theCookie.length;

    return unescape(theCookie.substring(ind + name.length + 1, ind1));







}



function selectsinglepost()

{

    if (valueread != null)

    {

        valueread = valueread.split(",");

        catjs = valueread[0];

        selectSub(valueread[1]);

        //alert("val0 "+valueread[0]+" val1" +valueread[1]);
    }



}





function openpost(url)

{

    dir = "?category=" + catjs + "&subcat=" + valuesub + "&tp=" + arrangebyac;



    try {

        window.location = url + dir;

    } catch (exec)

    {

        document.location = url + dir;

    }



    //alert(url);	
}


function setCategoryAll() {
    catjs = "ALL";
}
