function do_search(shopping_site_id, category_id)
{               
    var attributes = $('.jqTransformHidden').not('select');    
    attributes = JSON.stringify(attributes.serializeObject());    

    var dest_url = parent.location;
    dest_url = dest_url + '&ssid=' + shopping_site_id;
    dest_url = dest_url + '&cid=' + category_id;
    dest_url = dest_url + '&att=' + attributes;    

    // console.log (dest_url);
    parent.location = dest_url;
    return false;
}

$(document).ready(function() {
    $('li[id^=find-nav-tab-] a').click(function(event) {
        event.preventDefault();
        var $target = $(event.target);    
        $target.parent().toggleClass('active');
    });
    
    $('input[id^=affcashportal-]').click(function(event) {
	    if( $(this).is(':checked') ) 
	    {
	    	var ssid = $('#ssid').val(),
	    	    cid = $("#cid").val();
	    	    
	    	do_search(ssid,cid); 	   
	    }                         
    });
});


$.fn.serializeObject = function()
{
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
        if (o[this.name] !== undefined) {
            if (!o[this.name].push) {
                o[this.name] = [o[this.name]];
            }
            o[this.name].push(this.value || '');
        } else {
            o[this.name] = this.value || '';
        }
    });
    return o;
};
