(function ($){

	
	$(document).ready(function(){
		
		var expand = getUrlVars()['expand'];
		
		if (expand == 1)
		{
			return;
		}
		
		var list = $('ul.resins');
		var exp1 = list.hasClass('expandable');
		var exp2 = list.hasClass('expandable2');
		if (!exp1 && !exp2)
		{
			return;
		}
		
		var items = list.find('> li > div');
		items.hide();
		var links = '';
		if (exp1)
		{
			links = items.parent().find('a');
		}
		else
		{
			links = items.parent().find('a.expand');
		}
		links.click(function (e){
			var cur = $(this).parent();
			cur.parent().find('> li > div:not(:hidden)')	
			    .clearQueue()
			    .stop()
			    .css('width','100%')
				.slideUp(1000);
			cur.children('div')
				.clearQueue()
				.stop()
				.css('width','100%')
				.slideDown(1000);
		});
		
	});
	
})(jQuery);


function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}
